home *** CD-ROM | disk | FTP | other *** search
- Siemens ST 400 Scanner Software
- -------------------------------
-
- Author:
-
- Frank-Christian Krügel
- Rabienstraße 52
- W-2862 Worpswede
- Great Germany
- Phone: +49-4792-894
- Fax: same number, fax machine starts after 5 rings
- Bitnet/EARN: A02E@DHBRRZ41.BITNET
-
-
-
- Licence:
-
- This software is freeware. This means that anybody is allowed to do
- anything with it (duplicating, modifying,...) as long as:
- - My name stays in this program. The copyright remains to me also for
- modified versions.
- - The program is given away for free. Only the disk and postage may be
- charged.
- - Commercial use needs written permission
-
-
- Acknowledgements:
-
- I have to thank Charles Heath of Microsmith for his famous file requester,
- which I have used here. Unfortunately I had to change some small things:
- - Colors: Due to the specific color palette this program requires the
- original color settings were like a dark man in a tunnel - you saw nothing.
- - I removed the 'static' declaration of the rfnam() function in order to
- be able to use it from the main program.
- Due to the author's restrictions I am only allowed to supply the requester
- in object form. The (unmodified!) source code is on the 4th Aztec C Disk,
- so this should be no problem.
-
-
- Purpose:
-
- This program was born from the need of connecting a flatbed scanner with
- SCSI bus to my Amiga. It controls size (A4 or A5), number of gray scales
- (2 or 16) and threshold settings.
-
- In grayscale mode the scanner sends one byte per scanner pixel and uses 64
- steps of gray. These files take away a lot of memory (up to 16 Megs!) and
- cannot be previewed on an Amiga, which can only display 16 shades of gray.
- So the two least significant bits are thrown away. For printing or using
- the scanned images in DTP programs grayscale pictures can be converted into
- bilevel (black and white) pictures. Both Floyd-Steinberg and Ordered
- Dither are available for conversion.
-
- Images can be saved to disk as IFF either completely or only a small window
- of them. An image load routine is not included since I didn't need none.
- Everyone is free to add such a routine as well as saving images in
- compressed form (optionally) and send me his results.
-
- In the right bottom there is a button for switching between full page
- display and window display.
-
- Almost all scanner specific things are in the scan() function. So it should
- be quite simple to adapt this program to different scanners. If there is a
- need, simply send me the scanner and the manual, so I can create a
- special version for it.
-
- This program is not 'complete'. (Name a program and I tell you what should
- be added!) It should be considered a first step to the final solution.
-
-
- You need:
-
- - This disk
- - an Amiga
- - at best a flicker-free screen
- - as much memory as you can get (the largest pictures need 8MB)
- - a SCSI interface with the Commodore 'Exec level Direct SCSI' programming
- interface
- - a SCSI scanner with cable. When using not a Siemens scanner the program
- has to be adapted and recompiled
- - Aztec C 5.0 (It should also work with Lattice, but this is untested!)
- for Recompiling
-
-
- Recompiling:
-
- Simply change to the directory containing all source files and type 'make'.
- The program does not rely on specific path names etc.
-
-
- Start:
-
- Type 'stscan' or double-click icon. Make sure that the scanner is ready
- when booting and when starting the program. Note: The Siemens Scanner
- is hardwired on SCSI Unit 3, LUN3. Do not have any other SCSI device
- with the same unit number connected to the bus
-
-
- How the Siemens Scanner works:
-
- For a better understanding here is a short description of how the scanner is
- controlled.
-
-
- 1. Turn scanner light on:
- Send 'Mode Select' with Vendor Specific Bit (bit 7 of 5th byte of cdb) set
-
- Command Descriptor Block:
- 0x15 (Command)
- (LUN<<5)
- 0
- 0
- 0
- 128 (Vendor Specific Bit)
-
- 2. Wait 2 sec. for maximum light intensity
-
- 3. Send window descriptor block to scanner
-
- Command Descriptor Block:
- 0x24 (Command)
- (LUN<<5)
- 0
- 0
- 0
- 0
- 0
- Upper byte of data length, always 0
- Lower byte of data length, always 40=0x28
- 0
-
- Window Descriptor Block
- typedef struct DefWindow
- { ULONG dummy1;
- UWORD dummy2;
- UWORD wpsize; /*data length - 8*/
- UBYTE winnr; /*window number starting with 1*/
- UBYTE dummy3;
- UWORD resx; /*horizontal resolution in dpi*/
- UWORD resy; /*verical resolution, same as horizontal*/
- UWORD cornerx; /*left upper corner..*/
- UWORD cornery; /*..of scanning area*/
- UWORD width; /*size of ..*/
- UWORD height; /*..scanning area*/
- UBYTE dummy4;
- UBYTE threshold; /*0..63*/
- UBYTE size; /* temporary storage, ignored by scanner */
- UBYTE halftone; /*0:bilevel 2:grayscale*/
- UBYTE bitspixel; /*1:bilevel 8:grayscale*/
- UBYTE dummy5;
- UWORD dummy6;
- ULONG dummy7;
- };
- Dummies are set to 0.
-
- 4. Start scanning
-
- Command Descriptor Block:
- 0x1b (Command)
- (LUN<<5)
- 0
- 0
- 0
- 0
-
- 5. Read 32k of data until the complete image has been read
-
- Command Descriptor Block:
- 0x28 (Command)
- (LUN<<5)
- 0
- 0
- 0
- 0
- 0
- Upper byte of data length
- Lower byte of data length
- 0
-
- 6. Turn Scanner light off
-
- Send 'Mode Select' with Vendor Specific Bit (bit 7 of 5th byte of cdb) reset
-
- Command Descriptor Block:
- 0x15 (Command)
- (LUN<<5)
- 0
- 0
- 0
- 0 (Vendor Specific Bit)
-
- The scanner only has 2 MB of internal memory. Large gray scale images can
- exceed this memory limit. In this case you have to divide to page into
- horizontal stripes with the full width and a maximum height of
- (0x200000L/width) raster lines, which produce less than 2 MB each. Then
- scan each stripe as described above util the whole picture is processed.
-
-
- Still To Do:
-
- - optional IFF graphics compression when saving
- - IFF loader (although I've never missed it)
- - maybe some kind of print utility (external?)
- - Image processing functions (FIR filter, etc)
-