Upload
others
View
11
Download
1
Embed Size (px)
Citation preview
Scanner Control Language (SCL)and
C Language Libraryfor
Hewlett-Packard Scannersv 10.0
Chapter 5: Hardware and Software Sharpening i
Notice and Licensing
NoticeThe information contained in this document is subject to change without notice.
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in
connection with the furnishing, performance or use of this material
© Hewlett-Packard Company 1988, 1990-9
This document contains proprietary information which is protected by copyright. All rights reserved. No part of this document may be photocopied, reproduced, or translated into
another language without the prior written consent of Hewlett-Packard Company. Permission is prohibited, except as allowed under the copyright laws.
Restricted Rights Legend
Use, duplication or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause in DFARS 252.227-7013.
Hewlett-Packard Company
3000 Hanover Street
Palo Alto, CA 94304 USA
Rights for non-DOD U.S. Government Departments and Agencies are set forth in FAR 52.227-19(c)(1.2)
z
ii Scanner Control Language (SCL) v 10.0
Version 10.04Hewlett-Packard700 71st Avenue
Greeley, CO 80634February, 1999
Licensing ASPIThe Advanced SCSI Programming Interface (ASPI) was created by ADAPTEC to increase compatibility and simplify the connection of SCSI peripheral devices, such as scanners. Note that this set of DLLs and other files ships with each HP scanner, and is installed as part of the normal HP scanner software installation process.
ASPI for Windows 32 enables HP-supplied driver/DLL code to talk to scanners in Windows ‘95 and Windows NT 4.0. ASPI for Windows 32 is provided for developers as part of the SCL Toolkit. The license provided is for your development use only; you cannot re-distribute ASPI for Windows 32 without a license agreement from ADAPTEC. If your application uses the 32-bit version of SCL, you must obtain a license from ADAPTEC before shipping ASPI for Windows 32 to your customers.
To obtain an end-user ASPI license, contact ADAPTEC at: www.adaptec.com
Phone: (408) 945-8600 Fax: (408) 262-2533
Chapter 5: Hardware and Software Sharpening iii
Version Control for this document:
Version Date Comments1.0 1988-062.0 1990-063.0 1991-084.05.0 1992-085.15.2 Through HP ScanJet IIcx (via tech note)5.3 1993-05 Through HP ScanJet 3c (via tech note)6.0 1995-10 Added 4c tech note
Added 32-bit tech note7.0 1996-09 Added 4p and 5p tech notes
Re-structured document8.0 1997-09 Combined non-scanner-specific tech notes into main doc.
Re-structured into one doc for SCL, one for remaining tech notes.9.0 1998-08 Added support for 4100C/6200C 10.0 1999-02 Added support for 5200C
iv Scanner Control Language (SCL) v 10.0
Table of contents
Notice and Licensing iiNotice iiLicensing ASPI iiiVersion Control for this document: iv
Chapter 1: Introduction 1Scanner Toolkit Overview 1
New for SCL verison 10.0 1SCL 1Product Descriptions 1WEB Page 2
SCL v10.0 Documentation Overview 2Supported Scanners 3
Chapter 2: SCL and Scanner Concepts 5SCL Command Overview 5Coordinate System 5Windows 6Dimensional Units 7Scaling 7Model Number Scheme 8Output Data Types 8
B/W Thresholded Data 8White Data 8Black Data 8Black and White Grayscale Data 9Black and White Dithered Data 9Black and White Dither Patterns 10Color Data 11Color Thresholded Data 11Color Dithered Data 12Chunky Thresholded Data 12Chunky Dithered Data 12Color Dither Patterns 13"Fast" Data Types 14
Color Coefficient Matrix 15Image Data Transfer Curves (Tone Maps) 17Automatic Document Feeder Capabilities 18
Commands Used 18Scroll-type ADFs 18Flatbed ADFs 19
The Transparency Adapter 21
Chapter 3: SCL Command Reference 23Format of Escape Sequences 23
Two-Character Escape Sequences 23Parameterized Escape Sequences 24
Format of Inquiry Responses 26Format of Scanned Data 27
Format of One-Bit-Per-Pixel Data 27Format of (4-bit) 16-Level B/W Grayscale Data 27Format of (8-bit) 256-Level B/W Grayscale Data 27Format of (10-bit) 1024-Level B/W Grayscale Data 27Format of (12-bit) 4096-Level B/W Gray Scale Data 28Format of 24-bit Color Data 28Format of 30-bit Color Data 28Format of 36-bit Color Data 28
SCL Commands 29SCL Reset 30Scan Window 32Set X Resolution 34Set Y Resolution 35Set X Scale Factor 36Set Y Scale Factor 37Set Window X Position (Decipoints) 38Set Window Y Position (Decipoints) 39Set Window X Extent (Decipoints) 40Set Window Y Extent (Decipoints) 41Set Window X Position (Device Pixels) 42Set Window Y Position (Device Pixels) 43Set Window X Extent (Device Pixels) 44Set Window Y Extent (Device Pixels) 45Set Output Data Type 46Set Data Width 47Set B/W Dither Pattern 48Set Color Dither Pattern 49Set Matrix Coefficients 50Set Tone Map 52Inverse Image 53Mirror Image 54Set Intensity Level 54Set Filter 55Set Contrast Level 56Set Automatic Background 56Position Scanner Element, Secondary 57Light Source Test 57Set Download Type 58Download Binary Data 59Upload Binary Data 60Set Speed Mode 61
vi Scanner Control Language (SCL) v 10.0
Recalibrate 61Set Byte Order 62Set Compression 62Set Number Of Views 63Set View 65
Inquire Commands 67Inquire Present Value 67Inquire Minimum Value 67Inquire Maximum Value 68Inquire Device Parameter 68Inquire Pixels Per Scan Line 68Inquire Device Pixels Per Inch 69Inquire Native Optical Resolution 69Inquire Bytes Per Scan Line 70Inquire Number of Scan Lines 70Inquire Firmware Date Code 70Inquire HP Model Number 71Inquire Auto-Filtering 72Inquire Auto Speed Mode 72
Automatic Document Feeder SCL Commands 73SCL Reset 73Scan Window 73ADF Scan Window 73Change Document 74Unload Document 74ADF Background Change 75
Automatic Document Feeder Inquires 76Inquire ADF Connected 76Inquire ADF Ready 76Inquire Paper in ADF Bin 76Inquire ADF Open Since Last Change/Scan 77Inquire Ready to Unload 77
Transparency Adapter SCL Commands 78SCL Reset 78Scan Window 78Transparency Adapter Scan Window 78Light Source Test 79Set Calibration Y-Start 79Set Calibration Strip Parameters 80Transparency Adapter Disable/Enable 80
Transparency Adapter Inquiry Commands 81Inquire Transparency Adapter Connected 81Inquire Transparency Adapter Ready 81Inquire ADF/Transparency Adapter Open Since Last Change/Scan 81Error Reporting 82Error Stack Information 82Error Inquiries 83Clear Errors 83
Error Numbers 84
Chapter 4: The SCL C Library 85
Introduction 85Scanner Control Language Library Files 85How to Use the Scanner Library 86Scanning Process 87Library Errors 88Library Typedefs 89Compound Commands 90SCANNER.C Entry Points 90Data Structure Calls 91
GetScanInfo 92GetScanState 92SetScanState 92SetScanWindow 92
Utility Calls (SCANNER.C) 93Color 93ColorDither 93ColorThreshold 93CommandInquire 93Dither 94Download 94GrayScale 94ResetScanner 94Scan 95DualScan 96Threshold 96Upload 97SetDecipointWindow 97SetPixelWindow 97SetResolution 97SetScale 98
SCL.C Entry Points 98BuildCommand 98BuildInquire 98InquireModel 99InquireNumber 99InquireOldestError 99InquireString 99ReceiveResponse 100SendCommand 100
WINSCAN.C Entry Points 101CheckIO 101RecFromScanner 101SendToScanner 101ScannerLock 101ScannerLockButton 102ButtonPoll 102ClearButton 102
viii Scanner Control Language (SCL) v 10.0
32-bit Library and SCL for Windows 9x and Windows NT 102Library Portability 102
Scanner Control Library Commands 102
Chapter 5: Hardware and Software Sharpening 103Introduction 103Sharpening Routines 104
SetSharpening 104InitSharpenTransform 104Sharpen 104
Chapter 6: HP ScanJet Button Manager 105Introduction 105Installation 105
Button Manager Files 105Sample Code 105Overview 106
For Application Developers 106For Button Manager Users 107
Reference 108InstallLaunchApp 108RegisterLaunchApp 108UnregisterLaunchApp 108PushLaunchPending 109SetPollingState 109IsAppAlone 109CheckPollingState 109
Chapter 7: 32-bit Libraries and Drivers 111General 111
Hardware Issues 111ASPI for WIN32 112
Installing ASPI on Windows 95 or Windows NT 4.0 112Windows 98 and Windows NT 5.0 112
Windows 95 113HP C2522 Card (Plug and Play) 114HP C2502 Card (ISA without switches) 114Third-Party SCSI Cards 114HP C2503 Card (MicroChannel without switches) 115HP C1752/C1753 Card (ISA or MicroChannel with switches) 115HP ScanJet + Scanner and Interface Card 116HP ScanJet 5100C/5200C Scanners – Parallel Scanners 116HP ScanJet 6200C Scanner – SCSI I/O 117HP ScanJet 4100C/5200C/6200C USB Scanners 118
Windows 98 119HP ScanJet USB Scanners 119HP ScanJet Parallel Scanners 119HP ScanJet SCSI Scanner 120
Windows NT 4.0 121HP C2522 Card 121HP C2502 Card (ISA without switches) 122Third-Party SCSI Cards 122HP ScanJet 5100C/5200C Scanner – A Parallel Scanner 123
Windows 3.11 123HP C2522 Card 124HP C2502 Card (ISA without switches) Or HP C2503 Card (MicroChannel without switches) 124HP C1752/C1753 Card (ISA or MicroChannel with switches) 124HP ScanJet + Scanner and Interface Card 124Third-Party SCSI Cards 124
File Placements 125File Definitions 126Programming Notes 127
Data Structure 127
Chapter 8: Input/Output Protocols 129SCSI-1 Interface Protocol 129
SCSI-1 Physical Characteristics 129SCSI-1 General Operation 130SCSI-1 Phases and Support 131SCSI-1 Commands 131SCSI-1 Messages 134
SCSI-2 Interface Protocol 135Introduction 135Physical Characteristics 135General Operation 136SCSI-2 Phases and Support 137SCSI-2 Conditions 138SCSI-2 Messages 139SCSI-2 Disconnects 141SCSI-2 Commands 141SCSI-2 Hints for Use 144
Parallel Interface Protocol 145USB Interface 146
Universal Serial Bus (USB) 146Physical Characteristics 146General Operation 147USB Endpoints 147
Chapter 9: How to Build the SCL Library 149Introduction 149Directory Structure 149Building the SCL Library 150
x Scanner Control Language (SCL) v 10.0
Chapter 10: SCL Sample Code 151Introduction 151Sample Code 151
LAMPCON.EXE 151SETSCAN.EXE 152SCANNING.EXE 152DUALDATA.EXE 153LAMPSDK.EXE 154SHARPSDK.EXE 155SCAN.EXE 155
Building the 32-bit Sample Programs 157Building the 16-bit Sample Program 158Things to Remember When Creating a New Application 158
Appendix A: SCL Command Summary and Support Matrix 159Command Summary and Support 159Inquire Summary and Support 161Error Codes 162Inquire Syntax 162Scaling and Resolution Ranges 163
Appendix B: ASCII Character Codes 165ASCII Character Codes 165
Appendix C: Frequently Asked Questions 167Frequently Asked Questions 167
Appendix D: Information and Support 171Scanner Toolkit Technical Support 171TWAIN Support 171HP Peripherals Developer Program 171
Appendix E: Tech Notes 173HP ScanJet IIcx Notes 173
Changes to SCL Source Code Library 173Image Data Transfer Curves (Tone Maps) 173Scaling 173
HP ScanJet 3c/4c/6100c Notes 174Changing Your Code 174Tone Maps 174Set Speed Mode (HP ScanJet 3c/4c/6100c) 175
HP ScanJet 4p Notes 176Model Number Scheme 176SCSI Driver Considerations 176Automatic Background Mode 176Changed Behavior for Line-Dropping and Magic Resolutions 176Lamp Standby Mode with ADF and "Fast" Scans (1-bit and 4-bit) 177
HP ScanJet 5p Notes 178
A Front Scan Button 178Dual View 178Compression 178Set Speed Mode (HP ScanJet 5p Scanner) 179
HP ScanJet 5100C Notes 181HP ScanJet 4100C Notes 182HP ScanJet 6200C Notes 183
Set Speed Mode (HP ScanJet 6200C Scanner) 185HP ScanJet 5200C Notes 186
Index 187
xii Scanner Control Language (SCL) v 10.0
Chapter 1: Introduction
Scanner Toolkit Overview
New for SCL verison 10.00Support has been added for the HP ScanJet 5200C. (Model # 7190A)1Documentation has been revised.
SCLThe Scanner Control Language (SCL) is a toolkit for experienced programmers. SCL gives your application precise control over the behavior and state of the scanner and its components (such as Automatic Document Feeders and Transparency Adapters). SCL also provides inquiry routines to allow your application to determine the current state of the scanner and its components.
SCL libraries are provided to make SCL development easier. SCL is supported by any programming language that can link to compiled C libraries. Information is provided in the SCL toolkit documentation to allow a developer to write their own library, if necessary. SCL supports both 16-bit and 32-bit applications.
Product DescriptionsThe following tables show the scanners and operating systems currently supported by these toolkits (X indicates support, ns indicates no support).
Scanners SCLSupport
Operating System
DOS Windows 3.x
Windows NT
Windows 95
Windows98
Mac OS/2 UNIX
HP ScanJet X X ns ns ns ns ns ns nsHP ScanJet + X X X ns X X ns ns nsHP ScanJet IIp X X X X X X ns ns nsHP ScanJet IIc X X X X X X ns ns nsHP ScanJet IIcx X X X X X X ns ns nsHP ScanJet 3p X X X X X X ns ns nsHP ScanJet 3c X X X X X X ns ns nsHP ScanJet 4c X X X X X X ns ns nsHP ScanJet 4s ns ns ns ns ns ns ns ns nsHP ScanJet 4p X X X X X X ns ns nsHP ScanJet 4si ns ns ns ns ns ns ns ns nsHP ScanJet 5s ns ns ns ns ns ns ns ns nsHP ScanJet 5p X ns X X X X ns ns nsHP Network ScanJet 5 ns ns ns ns ns ns ns ns nsHP ScanJet 6100C X X X X X X ns ns nsHP ScanJet 5100C X ns ns X X X ns ns nsHP ScanJet 4100C X ns ns ns ns X ns ns nsHP ScanJet 6200C X ns ns SCSI
onlySCSIonly
X ns ns ns
HP ScanJet 5200C X ns ns Parallel only
X X ns ns ns
WEB PageFor more information on the HP Peripheral Developer Program and Developer Toolkits:
http://www.hp.com/go/devexchange
For more information on HP’s scanner products, see our WEB page:
http://www.scanjet.hp.com/
SCL v10.0 Documentation OverviewThis document covers the features of the Scanner Control Language (SCL) command set and the programming interface for the Hewlett-Packard HP ScanJet family of scanners. The intent of the HP Scanner Control Language (SCL) is to form a common basis for most present and future HP scanners.
The SCL toolkit documentation includes information covering the following scanners:
0HP ScanJet (HP 9190A)1HP ScanJet + (HP 9195A)2HP ScanJet IIc (HP 1750A)3HP ScanJet IIp (HP 1790A)4HP ScanJet IIcx (HP 2500A)5HP ScanJet 3p (HP 2570A)6HP ScanJet 3c (HP 2520A)7HP ScanJet 4c (HP 2520A)8HP ScanJet 4p (HP 1130A)9HP ScanJet 5p (HP 5110A)10HP ScanJet 4100C (HP 6290A)11HP ScanJet 5100C (HP 5190A)12HP ScanJet 5200C (HP 7190A)13HP ScanJet 6100C (HP 2520A)14HP ScanJet 6200C (HP 6270A)
Supported ScannersThe following tables show the capabilities of all models of HP ScanJet scanners made by Hewlett-Packard.
Scanner Capabilities Scanner TypeHP ScanJet
Plus IIp, 3p IIc IIcx
Grayscale 4-bit 4, 8-bit 4, 8-bit 4, 8-bit 4, 8-bitColor --- --- --- 3, 24-bit 3, 24-bitDevice Pixels 300 300 300 300 300Native Optical Resolution (X) 300 300 300 400 400Automatic Document Feeder single scan
per pagesingle scan per page
single scan per page
multi-scan per page
multi-scan per page
Filter --- --- --- 0, 2, 4-bit filter
0, 2, 4-bit filter
User Defined: Tone Map --- 8x8 8x8 8x8 8x8 B/W Dither Pattern --- 8x8 8x8 8x8 8x8 Color Dither Pattern --- --- --- supported supported Matrix Coefficients --- --- --- color colorUser Set-able Multi-speeds --- --- --- --- ---HP Transparency Adapter --- --- --- --- supportedFront Scan Button --- --- --- --- ---Compression --- --- --- --- ---Dual View --- --- --- --- ---HW Sharpening --- --- --- --- ---HW Interface Bi-Dir.
CentronicsBi-Dir. Centronics
SCSI SCSI SCSI
Scanner Capabilities Scanner Type3c/4c/6100C 4p 5p 4100C
Grayscale 4, 8, 10-bit 4, 8-bit 4, 8, 10, 12-bit 4, 8, 10, 12-bitColor 3, 24, 30-bit 24-bit 24, 30, 36-bit 24, 30, 36-bitDevice Pixels 300 300 300 300Native Optical Resolution (X) 600 300 300 300Automatic Document Feeder multi-scan per
pagemulti-scan per page
not available not available
Filter 0, 2, 4, 8-bit filter
0, 2, 4, 8-bit filter
--- ---
User Defined: Tone Map 8x8, 10x8 8x8 8x8, 7x12
R/G/B/bw8x8, 7x12 R/G/B/bw
B/W Dither Pattern 8x8, 16x16 8x8, 16x16 8x8, 16x16 8x8, 16x16 Color Dither Pattern supported --- --- --- Matrix Coefficients color color color, bw color, bwUser Set-able Multi-speeds normal, fast,
extra fast--- slow, normal,
fastslow, normal, fast
HP Transparency Adapter supported --- --- ---Front Scan Button --- --- supported supportedCompression --- --- supported supportedDual View --- --- supported supportedHW Sharpening --- --- supported supportedHW Interface SCSI SCSI SCSI USB
Scanner Capabilities Scanner Type5100C 5200C 6200C
Grayscale 4, 8, 10, 12-bit 4, 8, 10, 12-bit 4, 8, 10, 12-bit
Color 24, 30, 36-bit 24, 30, 36-bit 24, 30, 36-bitDevice Pixels 300 300 300Native Optical Resolution (X) 300 300 600Automatic Document Feeder single scan per
pagesingle scan per page
single scan per page
Filter --- --- ---User Defined: Tone Map 8x8, 7x12
R/G/B/bw8x8, 7x12 R/G/B/bw
8x8, 7x12 R/G/B/bw
B/W Dither Pattern 8x8, 16x16 8x8, 16x16 8x8, 16x16 Color Dither Pattern --- --- --- Matrix Coefficients color, bw color, bw color, bwUser Set-able Multi-speeds slow, normal,
fastslow, normal, fast
slow, normal, fast
HP Transparency Adapter --- --- ---Front Scan Button supported supported supportedCompression supported supported supportedDual View supported supported supportedHW Sharpening supported supported supportedHW Interface Parallel USB, Parallel USB, SCSI
Chapter 2: SCL and Scanner Concepts
SCL Command OverviewSCL commands are used to set individual scanner parameters. Once an SCL command sets a parameter, that parameter will keep that value until the same SCL command is repeated with a new value, or until the scanner is reset. Some SCL commands, while setting one parameter, have a side effect of setting another parameter. One example is the relationship between resolution and scale. Also, if you change the data type, the data width also changes.
Use SCL inquiry commands to determine the valid range for a particular parameter, and to check the current parameter value. The best way to determine the range of a particular parameter is to use the parameter’s inquiry command. Another less robust way is to code the parameter ranges for a particular scanner into your application and use the Inquire HP Model Number commands (see page 71) to determine the scanner currently being used.
Coordinate SystemThe coordinate system used in all SCL commands is a two-dimensional system. The coordinate system as viewed from above the flatbed looking down on the object is shown in Figure 1.
Figure 1 Scanner Coordinate System
Scanning directions are labeled in the same order that data is transferred from the device during a scan (provided that you have not selected the image to be mirrored). The primary scanning direction indicates pixels that are adjacent on a given scan line. The secondary scanning direction is the direction the scanning carriage moves in the scanner. For example, the scanner first sends data for consecutive pixels on a scan line. Then the scanning carriage moves down one scan line (increases the coordinate in the secondary scanning direction) and transfers data for the next scan line. If the entire area is being scanned, the first data transferred corresponds to the data point at coordinate (0,0), which is called the reference point of the scannable area (provided that you have not selected the image to be mirrored).
WindowsThe area to scan is selected by defining a window. A window is a rectangular area defined by a position and an extent in each dimension. Figure 2 shows a window defined by a position and an extent.
2x 0 = Horizontal position of window 03y 0 = Vertical position of window 04p 0 = Horizontal (X) extent of window 05q 0 = Vertical (Y) extent of window 0
Figure 2 Example of a Window
Dimensions supplied for the position and extent parameters should be non-negative (a negative value is interpreted as 0 and causes a parameter error). The upper-left corner of the window is called the reference point of the window. The power-on default for HP scanners is a single window with a position of (0,0), and the extent value being the maximum for a non-ADF scan.
In other words, the default window is the entire flatbed scannable area. The addition of the Automatic Document Feeder does not affect this default. To find the values for each scanner, see Command Summary and Support starting on page 159.
Dimensional UnitsSome HP scanners support two units of dimension, the decipoint and the device pixel. There are 720 decipoints to the inch. This unit of measure is the standard for HP printers under PCL. For HP scanners, numbers to the right of the decimal point in decipoint values are valid, but they are ignored.
Note: Since the decipoint unit of measure will no longer be supported with the HP ScanJet 5p and later scanners, you should use the device pixel measure instead.
All HP scanners use 300 device pixels per inch for compatibility. When setting up the window to be scanned using device pixels, specify positions and extents assuming 300 device pixels per inch.
Note: The unit of choice for setting the window is 300 device pixels per inch. Use this system of measurement regardless of the native optical resolution of the scanner or the resolution parameter setting.
The unit of measure for device pixels per inch may be inquired for any scanner (see Inquire Device Pixels Per Inch on page 69).
Scanner Optical Resolution in the X direction
HP ScanJet, HP ScanJet +, HP ScanJet IIp, HP ScanJet 3p, HP ScanJet 4p, HP ScanJet 5p, HP ScanJet 5100C and HP ScanJet 4100C
300 ppi
HP ScanJet IIc and HP ScanJet IIcx 400 ppiHP ScanJet 3c/4c/6100C, HP ScanJet 6200C and HP ScanJet 5200C
600 ppi
It is important to note that the unit of measure for position and extent does not depend on the current resolution variable, and dimensions set by those commands do not change when the scan resolution changes. For example, the position of a window that was defined when the scanner resolution was set at 300 pixels per inch does not change when the resolution is subsequently changed to 150 pixels per inch.
The coordinate system is also independent of any scaling that is in effect. When a scan is requested at resolutions other than 300 dpi or scale factors other than 100, the dimensions that have been specified by the user must be converted by the scanner into units of the scan data, taking resolution and scaling into account. When this occurs, dimensional calculations may result in fractional values of pixels. If this happens, the fractional value is rounded up to the next whole device pixel.
For example, consider the HP ScanJet IIc scanner, which has 300 device pixels per inch, but an optical resolution of 400 ppi in the X-direction. The user will set the X and Y position using device pixels, but the actual scanned data in the X-direction will start on the next optical pixel boundary. If the user sets the scan resolution to 75 ppi and requests a scan of a window which has been defined as five device pixels wide, the scanner returns two pixels per scan line. However, the original width specification is stored in device pixels and is not affected by the rounding. Therefore, if the scan resolution is subsequently changed back to 300 ppi, a scan of the window would result in five pixels per scan line. In the case of the HP ScanJet IIc scanner, it will always return the same number of pixels as previous scanners for identical scanner settings, but the location of the actual pixels is associated with the nearest 400th of an inch, rather than previous scanners' resolution of the nearest 300th of an inch.
ScalingThe limits on the scaling of an image depend on the current scan resolution. Because the scan resolution affects scaling, the user should set the scan resolution first, then inquire the limits of scaling, and finally set the desired scales. Failure to follow this order of commands risks a scaling error. The relationship between scan resolution and scaling for HP ScanJet scanners are detailed in Scaling and Resolution Ranges on page 163.
Model Number SchemeEach HP ScanJet scanner is assigned an SCL model number. This model number can be used to identify it as unique from other HP SCL scanners. However, it is also desirable for newer scanners which are compatible with older scanners to work with older applications without having to update the application.
In order to accommodate both needs -- to use the SCL Model Number Inquiry command to identify the scanner hardware to the application program, but also to allow existing applications to work “as expected” on newer scanners -- a strategy has been devised (the Model Number Scheme) that would add a new Model Number Inquiry command for every new scanner.
Each new scanner may or may not respond (with a non-Null model number) to previous scanners’ Model Number Inquiries. Earlier scanners will always respond with a Null response to Inquiries associated with later models.
To find out which scanners respond to each model number, see Inquire Model # in Inquire Summary and Support starting on page 161.
Output Data TypesSCL and the HP ScanJet series of scanners support a variety of data types. To find out which data types are supported by each scanner, see Command Summary and Support starting on page 159.
See Format of Scanned Data starting on page 27 for specific information on how data is passed to the scanner.
B/W Thresholded DataThe B/W thresholded data type is defined as black-and-white data. The value returned for any given pixel will be a 1 (black) if the reflectance at that location is above a specific threshold value, and 0 (white) if the reflectance is less-than or equal to the threshold. On a color scanner, the reflectance value is taken from the output of the green channel after going through the Coefficient Matrix and Tone Map. The default is to use a matrix which maps only the input of the green channel to the output of the green channel, but other combinations of colors may be selected to contribute to the monochrome reflectance by using the Set Matrix Coefficients Command (page 50) and/or downloading a custom matrix.
When inverted data is requested, black is represented by a 0 and white by a 1. The threshold can be set to any value by means of the intensity command.
The actual threshold used is:
15If intensity < 0 then threshold = (((intensity + 127) * 153) + 64) / 12716If intensity >=0 then threshold = (((intensity * 101) + 64) / 127) + 153
The "thresholded" data type always returns 1 bit/pixel. Four or eight-bit thresholded data may be achieved with the "grayscale" data type by using a downloaded Tone Map which maps each pixel to 0 or 255.
White DataThe "white" data type will return a 0 for every pixel scanned or a 1 if inverted data is requested. The "white" data type always returns 1 bit/pixel. Four or eight-bit white data may be achieved with the "grayscale" data type by using a downloaded Tone Map which maps each pixel to a 0.
Black DataThe "black" data type will return a 1 for every pixel scanned or a 0 if inverted data is requested. The "black" data type always returns 1 bit/pixel. Four or eight-bit black data may be achieved with the "grayscale" data type by using a downloaded Tone Map which maps each pixel to a 255.
Black and White Grayscale DataBlack and White grayscale data is the "n" most significant bits of the grayscale data after it has been modified by the selected Tone Map, where n is the selected data width. The default data width is 4 bits, which will be used if no explicit data width command is received. To find out which scanners support each gray scale data width, see Set Data Width in Command Summary and Support starting on page 159.
White data is represented by 0, 00, or 0000 (packed for 10- or 12- bit) and black data is represented by F, FF, 3FF or 0FFF.
Note: If inverse is set and the data width is greater than 8 bits/pixel, the zeros that pad the data to 16 bits will be inverted (e.g., 0000111111111111 will become 1111000000000000).
On a color scanner, the grayscale data before being modified by the Tone Map is taken from the output of the green channel after going through the Coefficient Matrix. The default is to use a matrix which maps a higher amount of input from the green channel and lower amounts for red and blue, respectively, to the output of the green channel -- this matrix (ID 1) approximates NTSC black and white. Other combinations of colors may be selected to contribute to the monochrome reflectance by using the Set Matrix Coefficients Command (page 50) and/or downloading a custom matrix.
Black and White Dithered DataHP ScanJet scanners implement a scheme for representing multi-level gray scale data in a one-bit-per-pixel form. An 8x8 (or 16x16) array of grayscale pixels is converted to an 8x8 (or 16x16) array of binary pixels by specifying a unique threshold to each pixel in the array. The goal of the threshold selection is to try and duplicate the tonal quality of the grayscale array with the binary array. The array is moved across the image to convert all pixels. A thresholding array is called a Dither Pattern.
On a color scanner, the original grayscale pixels (before being applied to the thresholding array) are taken from the output of the green channel after going through the Coefficient Matrix. The default is to use a matrix (ID 1) which approximates NTSC black and white. Other combinations of colors may be selected to contribute to the monochrome grayscale value by using the Set Matrix Coefficients Command (page 50) and/or downloading a custom Coefficient Matrix.
The scanners support 4 basic black and white Dither Patterns and up to 2 downloadable black and white Dither Patterns (8 x 8 and 16 x 16). The patterns are referenced by a "dither ID", which can have a value of -l, 0, 1, 2 or 3. The -1 ID references either of the downloadable patterns, and the other IDs refer to the built-in Dither Patterns. The user selects the Dither Pattern to be used with the Set B/W Dither Pattern Command (page 48). The contrast and intensity of the dithered output is affected by the contrast and intensity SCL commands. Use the Set Download Type (page 58) and Download Binary Data (page 59) commands to download a Dither Pattern. Dithered data always returns 1 bit/pixel.
Black and White Dither PatternsApplies X ScanJet X ScanJet + X ScanJet IIp X ScanJet 3pto: X ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C X ScanJet 5200C
X ScanJet 4p X ScanJet 5p X ScanJet 5100C/4100C X ScanJet 6200C
Abstract/Comment:Dithering is used to print a gray-scale picture through a black and white only printer. HP provides a set of dithering matrices which may, at the programmer's discretion, be uploaded, altered, and then downloaded.
The internal black and white Dither Patterns for the above-listed HP ScanJet scanners are described in the following matrices. The numbers in the matrices represent 8-bit grayscale values which are compared to the grayscale value of a scanned pixel. When the scanned value exceeds the value in the matrix, the result is a black pixel; otherwise, the result is a white pixel.
8X8 - B/W Coarse Fatting 8X8 - B/W Fine Fatting95 14
4229
239
236
219
166
110
243
167
218
231
245
175
220
234
152 185
207
226
222
205
190
160
226
47 110
183
228
82 124
190
214 203
196
125
134
183
200
210
210
155
137
221
215
161
148
223
245 217
175
65 88 141
234
242
240
224
198
236
242
225
205
238
237 221
169
116
103
148
230
240
245
180
220
235
243
170
219
232
224 206
192
163
156
188
208
227
229
99 131
193
227
64 118
187
130 179
198
209
212
202
194
121
216
163
152
223
213
158
143
222
79 138
232
242
245
215
172
47 242
225
208
239
241
224
202
237
8X8 - B/W Bayer 8X8 - B/W Vertical Line47 15
7236
239
83 167
235
238
47 178
210
236
83 185
215
237
196 219
242
245
202
222
241
244
112
189
220
239
127
193
223
240
231 237
113
177
233
237
137
187
141
199
226
242
154
203
229
243
240 243
208
225
240
243
213
229
165
206
231
244
171
207
233
245
100 172
235
238
65 162
236
239
100
187
217
238
65 181
212
237
205 223
241
244
199
220
242
245
134
196
224
241
119
191
222
239
234 237
149
191
232
237
124
182
160
204
230
243
147
202
227
242
240 243
216
230
240
243
210
227
174
208
234
245
168
206
232
244
The uploading of Matrices is provided for the convenience of the programmer. There is no special need to upload these matrices. Should you not like any of the patterns provided as standard by HP, you have the option of modifying them. For example, HP provides the matrix for a B/W Vertical Line dither. As the developer of an application, you may wish to also provide a horizontal dither. In that case, you would upload the Vertical Line matrix, rotate 90 degrees, and then download it.
Color DataDefault color data width is 24 bits representing one pixel: 8 bits representing red reflectance, followed by 8 bits representing green reflectance, followed by 8 bits representing blue reflectance. When light is absorbed on a surface, the surface appears dark; when light is reflected, the surface appears light. In the color scanners, the more reflectance of a color, the lower the number of the 8 bits representing the value of that pixel. So, the darkest of a color is represented by FF and the lightest of a color is represented by 00. The 24-bit value is determined from the amount of reflectance detected by the red, green, and blue sensors modified by the Coefficient Matrix chosen which maps certain percentages of each colored sensor to the appropriate red, green, or blue output channel. Each color's value is then modified by its corresponding default Tone Map adjusted by the specified contrast and intensity OR modified by the downloaded Tone Map (independent of the contrast and intensity settings).
Some scanners also support 30 and 36 bits representing one pixel: 10 or 12 bits representing red reflectance, followed by 10 or 12 bits representing green reflectance, followed by 10 or 12 bits representing blue reflectance. The 30 or 36-bit data will be sent with 2 bytes per color, three colors per pixel, for a total of 48 bits per pixel. The order of the bytes is dependent on the current setting of the byte order parameter. The bit packing inside each byte will be LSB justified (padding in MSB). So, the darkest of a color is represented by 03FF or 0FFF and the lightest of a color is represented by 0000. The 30 or 36-bit value is determined from the amount of reflectance detected by the red, green, and blue sensors modified by the Coefficient Matrix chosen which maps certain percentages of each colored sensor to the appropriate red, green, or blue output channel.
Note: If inverse is set and the data width is greater than 8 bits/color, the zeros that pad the data to 16 bits will be inverted (e.g., 0000111111111111 will become 1111000000000000).
Color Thresholded DataThe color thresholded format is 3 bits per pixel with one bit each representing red, green and blue thresholded values for that pixel. The bits are packed so that three bytes represents eight pixels with the first byte containing 8 pixels' red values, followed by a byte of those 8 pixels' green values, followed by a byte of those 8 pixels' blue values. The last three bytes of a line may each contain information for pixels beyond the actual scanning window to make the data stream end on a (three) byte boundary. The value returned for each color of each pixel will be a 1 (dark) if the reflectance for that color at that location (as modified by the Coefficient Matrix) is darker than a specific threshold value and 0 (light) if the modified reflectance is brighter than or equal to the threshold.
When inverted data is requested, dark is represented by a 0 and light by a 1.
The threshold can be set to any value by means of the intensity command. The same threshold is used for all three colors. The actual threshold used is:
threshold = intensity + 128
The color thresholded data type always returns 3 bits/pixel. Achieving 24-bit thresholded color data may be done with the "color" data type by using a downloaded Tone Map which maps each pixel to 0 or 255.
Color Dithered DataThe scheme for color dithering uses the same techniques as for black and white dithering. An 8x8 array of color pixels is converted to an 8x8 array of color binary pixels by specifying a unique threshold to each color (RGB) of each pixel in the array. The thresholding array (which is called a Color Dither Pattern) is moved across the image to convert all pixels.
The scanner may support up to one basic Color Dither Pattern and one downloadable Color Dither Pattern. The default (built-in) Color Dither Pattern has a "color dither ID" of 0 and the downloaded Color Dither Pattern has a "color dither ID" of -1. The user selects the Dither Pattern to be used with the Set Color Dither Pattern Command (page 49). The contrast and intensity of the dithered output is affected by the contrast and intensity SCL commands. A Color Dither Pattern is downloaded using the Set Download Type (page 58) and Download Binary Data (page 59) commands. A Color Dither Pattern to be downloaded is 192 bytes: 64 bytes of the thresholding array for red sent row by row, followed by 64 bytes of the thresholding array for green sent row by row, followed by 64 bytes of the thresholding array for blue sent row by row.
Color dithered data always returns 3 bits/pixel in the format similar to that for color thresholded. See Format of Scanned Data starting on page 27 for more detail.
Chunky Thresholded DataThe chunky thresholded format is 3 bits/pixel with one bit each representing red, green and blue thresholded values for that pixel. The bits are packed as two pixels per byte in the form: 0RGB0RGB as 8 bits for two pixels. The first bit for each "chunk" is always zero, followed by the thresholded values for red, green, and blue for that pixel. The last byte of a line may contain information for a pixel beyond the actual scanning window to make the data stream end on a byte boundary. The value returned for each color of each pixel is determined as described above for the Color Thresholded Data type.
Chunky Dithered DataThe chunky dithered format is 3 bits/pixel with one bit each representing red, green and blue thresholded values for that pixel. The bits are packed as two pixels per byte in the form: 0RGB0RGB as 8 bits for two pixels. The first bit for each "chunk" is always zero, followed by the dithered values for red, green, and blue for that pixel. The last byte of a line may contain information for a pixel beyond the actual scanning window to make the data stream end on a byte boundary. The value returned for each color of each pixel is determined as described above for the Color Dithered Data type.
Color Dither PatternsApplies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: X ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C ScanJet 5200C
ScanJet 4p ScanJet 5p ScanJet 5100C/4100C ScanJet 6200C
The internal Color Dither Pattern for the “C” series of scanners is described in the following three matrices. The numbers in the matrices represent 8-bit values for the appropriate color. For color dithering, these values are compared to the value of that color in a scanned pixel. When the scanned value exceeds the value in the matrix, the result is a colored pixel; otherwise, the result is a white pixel.
8 x 8 x 3 Color Coarse Fatting Dither
8X8 - Red 8X8 - Green95 144 229 239 236 219 166 110 95 144 229 239 236 219 166 110152 185 207 226 222 205 190 160 152 185 207 226 222 205 190 160214 203 196 125 134 183 200 210 214 203 196 125 134 183 200 210245 217 175 65 88 141 234 242 245 217 175 65 88 141 234 242237 221 169 116 103 148 230 240 237 221 169 116 103 148 230 240224 206 192 163 156 188 208 227 224 206 192 163 156 188 208 227130 179 198 209 212 202 194 121 130 179 198 209 212 202 194 12179 138 232 242 245 215 172 47 79 138 232 242 245 215 172 47
8X8 - Blue95 144 229 239 236 219 166 110152 185 207 226 222 205 190 160214 203 196 125 134 183 200 210245 217 175 65 88 141 234 242237 221 169 116 103 148 230 240224 206 192 163 156 188 208 227130 179 198 209 212 202 194 12179 138 232 242 245 215 172 47
The uploading of Matrices, Tone Maps, and Colors is provided for your convenience. There is no special need to upload these matrices. Should you not like any of the patterns provided as standard by HP, you have the option of modifying them. For example, HP provides the matrix for a B/W Vertical Line dither. The developer of an application may wish to also provide a horizontal dither. In that case, the developer would upload the Vertical Line matrix, rotate 90 degrees, then download it.
"Fast" Data TypesThe supported “Fast” data types are:
17Fast Black and White Thresholded18Fast Black and White Dithered19Fast Black and White Grayscale
The "fast" data types are the same as the associated non-fast data types except that the scanning speed is faster. If the effective y-direction resolution of the scan is greater than 120 ppi, the scanning speed is twice as fast in this data type than the (non-fast) B/W thresholded data type. If the effective resolution is 120 ppi or less, the scanning speed will be as fast as a "normal" (non-fast) scan at 60 ppi.
There are other ways in which using these data types will result in faster scans. All "fast" data types use a saved calibration table and will not usually do a calibration scan at the start of each scan. A calibration scan to save off the "fast" calibration will be done at the beginning of the first "fast" scan following power up, a SCSI Reset, or a Re-calibrate command.
If an ADF is detected and is "ready", the scanner light will not turn off at the end of a scan, but instead will remain on at a low level until a new scan is initiated. (If a new scan is not initiated within 5 minutes the light will be turned off).
If the Transparency Adapter is used for a scan when one of the FAST mode data types is selected, the scan will occur using the Transparency Adapter unit, but the data will be shifted to the slower mode, adopting a NORMAL mode for the same data type.
Note: The maximum resolution (at 100% scaling) for all "fast" data types is 600 ppi. (Non-fast data types can go up to 1200 ppi). If a scan is requested in one of the fast modes and the effective resolution (scaling * resolution) is greater than 600 ppi, the scan will happen in fast mode at 600 ppi and a SL_SCALEERROR will be put on the SCL stack.
Color Coefficient Matrix
Applies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: X ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C X ScanJet 5200C
X ScanJet 4p X ScanJet 5p X ScanJet 5100C/4100C X ScanJet 6200C
For the HP ScanJet IIc, IIcx, 6100c, 4C/3C, and 4p:The color image information is sensed as an analog voltage by a CCD array, and that information is transformed to a digital form for each pixel by an Analog to Digital converter. Depending on the scanner, the transformation is to a 24-bit digital form for each pixel (8 bits red, 8 bits green, 8 bits blue) or a 30-bit digital form for each pixel (10 bits red, 10 bits green, 10 bits blue).
These "input" values have been divided into the three primary colors according to the physical characteristics of the sensing mechanisms and optical path. These values do not necessarily match exactly the human perception of color composition or provide a close enough approximation to the NTSC-RGB color standard.
The HP color scanners have the ability to modify the color combinations sensed for each pixel to a different "output" RGB 24-bit/30-bit value which mixes the desired percentage of each input color into the resulting output colors. This modification is done before any other image processing that creates the desired data type, scaling, contrast, and intensity.
The proper mixture of the colors is defined by the Coefficient Matrix which is nine bytes representing what proportion of a color's input contributes to each of the three colors' outputs. The first byte is the coefficient for the red input contributing to the red output. The second byte is the coefficient for the red input contributing to the green output, etc. The format of each byte is a signed integer (-127 to 127) which represents the number of 64ths for that coefficient. A value of "-0" (80 hex) is a special case which results in an effective coefficient of 1. When a coefficient of 1 is desired, use the value "-0." The default coefficient matrices used are matrix ID 0 for color, matrix ID 1 for B/W Dithered and B/W Grayscale data types, and matrix ID 2 for B/W Thresholded type. Matrix ID 1 contains the coefficients for NTSC Black and White. Matrix ID 2 is a pass through matrix which doesn't mix any of the colors and, therefore, yields the best MTF (Modulation Transfer Function). When used with the B/W thresholded type, matrix ID 2 causes just the green channel to be used for the thresholding. The user can set a matrix other than the default for a data type AFTER the data type is selected with the Set Matrix Coefficients Command (page 50). A Coefficient Matrix can be downloaded and would have a matrix ID of -1 by using the Set Download Type (page 58) and Download Binary Data (page 59) commands. Downloaded matrices could be used to compensate for ink impurities or to drop out selected colors in a black and white scan.
For the HP ScanJet 5p, 5100C, and 4100C:The original RGB color values digitized from the CCD are divided into the three primary colors according to the optical characteristics of the CCD’s color filters. These primary colors do not necessarily match exactly the human perception of color composition nor do they provide a close enough approximation to the NTSC-RGB color standard. Each of these scanners has the ability to modify the color combinations sensed for each pixel to a different “output” RGB or monochrome value which mixes the desired percentage of each input color into the resulting output color(s) .
The proper mixture of the colors is defined by a 3x3 matrix to generate color output or a 1x3 matrix to generate monochrome output. Each matrix element is a 10-bit value which represents what proportion of a color’s input contributes to each of the output colors. For a 3x3 matrix the first element is the proportion of the red input contributing to the red output. The second element is the proportion of the red input contributing to the green output, etc. For a 1x3 matrix, the first element is the proportion of the red input contributing to the monochrome output. The second element is the proportion of the green input contributing to the monochrome output, etc. The format of each element is a 10-bit signed magnitude number with 2 digits to the left of the decimal point. Therefore, these elements can represent numbers in the range -511/128 to + 511/128 in increments of 1/128.
Separate matrices can be specified for each view to be generated unless both views are color. In this case, the same 3x3 matrix must be used for both views. If the input data stream is monochrome, no matrixing is done.
Note: The HP ScanJet 4100C can select the sRGB color matrix but it defaults to the NTSC color matrix.
For the HP ScanJet 5200C, and 6200C:The original RGB color values digitized from the CCD are divided into the three primary colors according to the optical characteristics of the CCD’s color filters. These primary colors do not necessarily match exactly the human perception of color composition nor do they provide a close enough approximation to the sRGB color standard. These scanners have the ability to modify the color combinations sensed for each pixel to a different “output” RGB or monochrome value which mixes the desired percentage of each input color into the resulting output color(s).
The proper mixture of the colors is defined by a 3x3 matrix to generate color output or a 1x3 matrix to generate monochrome output. Each matrix element is a 10-bit value which represents what proportion of a color’s input contributes to each of the output colors. For a 3x3 matrix the first element is the proportion of the red input contributing to the red output. The second element is the proportion of the red input contributing to the green output, etc. For a 1x3 matrix, the first element is the proportion of the red input contributing to the monochrome output. The second element is the proportion of the green input contributing to the monochrome output, etc. The format of each element is a signed integer (-511 to +511) which represents the number of 128ths for that element.
Separate matrices can be specified for each view to be generated unless both views are color. In this case, the same 3x3 matrix must be used for both views. If the input data stream is monochrome, no matrixing is done.
NOTE: If a Grayscale or Thresholded data type is selected, but a 3x3 Color Matrix is also selected the output will be:
Output = Red CCD Signal * Matrix ValueRR + Green CCD Signal * Matrix ValueRG + Blue CCD Signal * Matrix ValueRB
This will result in an output which is predominately based on the red channel input with some slight mixing of the green and blue channels if the default matrix values are used. Of course, if the matrix was downloaded, the user could select any mixing values they want, but only the red channel mixing coefficients are used.
It was the intention of the hardware design that if Grayscale or Thresholded scans were being selected that the monochrome matrixer would be used. The signal output with the monochrome matrixer is:
Output = Red CCD Signal * Matrix ValueMR + Green CCD Signal * Matrix ValueMG + Blue CCD Signal * Matrix ValueMB
Example:To get the following color correction:
REDnew = REDold GREENnew = 0.25 REDold + GREENold - 0.25 BLUEoldBLUEnew = 1.25 REDold - 1.25 GREENold + 1.125 BLUEold
Order the coefficients as follows:
REDold > REDnew, REDold > GREENnew, REDold > BLUEnew ,GREENold > REDnew, GREENold > GREENnew, GREENold > BLUEnew BLUEold > REDnew, BLUEold > GREENnew, BLUEold > BLUEnew where REDold > REDnew means the amount of red input contributing to the red output, etc.
The ordered coefficients are: 1, 0.25, 1.25, 0, 1, -1.25, 0, -0.25, 1.125
To encode the coefficients to be downloaded, the format of each byte is a signed integer (-127 to 127) that represents the number of 64ths for that coefficient. A value of "-0" (80 hex) is a special case which results in an effective coefficient of 1, which should be used when appropriate.
The bytes to download are: 80h, 10h, 50h, 00h, 80h, D0h, 00h, 90h, 48h
Note: The matrices must be defined assuming black (or dark color) is 00H and white (or light color) is FFH - backwards from the way SCL assumes.
Image Data Transfer Curves (Tone Maps)In the HP ScanJet scanners, the image data is affected by a transfer curve called a Tone Map. Tone Maps are used to perform gamma correction, adjust contrast and intensity, enhance shadows, etc. Conceptually the Tone Map is simply a lookup table which maps one value to a different value. A 256-byte map may be downloaded and the scanner will extrapolate to the 1024-byte map.
In the HP ScanJet 5p, 4100C, 5100C, 5200C and 6200C, four separate Tone Maps are available: red, green, blue, and monochrome. Each Tone Map consists of 128 12-bit values and an offset. A 12-bit value from the data path is mapped to a new 12-bit value by first subtracting the appropriate offset, and then using the upper 7 bits of the result as an index into the corresponding lookup table. The final 12-bit result is generated by using the bottom 5 bits of the input to perform a linear interpolation between the table values at index and index+1. If the index into the table is 127 (the maximum) the table entry at that index is used directly without interpolation. Separate Tone Maps can be specified for each view unless both views are color. In this case, both views must use the same red, green, and blue Tone Maps. Interpolation can be turned on or off independently for each view. In fact, the tonemapper itself can be turned on or off independently for each view.
The details of the Tone Map are a function of the number of bits specified (1, 4, 8, 10, 12) and the contrast and intensity control settings. The default power-on settings for the scanner are Black and White, 1-bit mode with contrast = 0 and intensity = 0. The Tone Map for 1, 4, 8, 10, 12-bit modes with default contrast and intensity for the black and white and color data types are:
1-bit a straight-line mapping of 0% to 100% reflectance which is then thresholded or dithered, depending upon the data type selected.
4-bit a straight line mapping of 4% to 74% reflectance into an output of 0 to 158-bit a straight line mapping of 0% to 100% reflectance into an output of 0 to 255.Addition for the HP ScanJet 5p, 4100C, 5100C, 5200C, 6200C:10-bit a straight line mapping of 0% to 100% into an output of 0 to 1023.12-bit a straight line mapping of 0% to 100% into an output of 0 to 4095.
The default Tone Map for all the color data types is a straight line mapping of 0% to 100% reflectance into the appropriate data format.
The Tone Map for dithered 1-bit mode or 8-bit mode becomes non-linear as the contrast and intensity are changed from 0. The Tone Map used for a scan is generated when the scan command is given using the data type, contrast, and intensity intended for that scan.
Interpolation can be turned off to get discontinuous Tone Maps. This is automatically done for the default Tone Maps when the contrast is set to its maximum value.
Automatic Document Feeder Capabilities
Applies X ScanJet X ScanJet + X ScanJet IIp X ScanJet 3pto: X ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C ScanJet 4100C
X ScanJet 4p ScanJet 5p X ScanJet 5100C X ScanJet 6200C/5200C
HP offers an Automatic Document Feeder (ADF) for all its scanners. The two kinds of ADFs are:
20“scroll feed” -- only allows one scan per page.21“flatbed” -- allows multiple scans per page.
Both kinds of ADFs will scan a page when given the Scan Window Command (page 32), but the flatbed ADF has an additional set of commands for applications to load paper onto the platen, scan the page more than once (perhaps for a preview and final scan), then unload the page while loading another.
Commands UsedHere is a table of ADF commands and the scanners to which they apply:
Command HP ScanJet, HP ScanJet +, IIp, 3p
HP ScanJet IIc, IIcx, 3c/4c/6100C, 4p
HP ScanJet 5100C, 6200C,5200C
Scan Window (page 32) x x xInquire ADF Connected (page 76) x x xInquire ADF Ready (page 76) x x xInquire Paper in ADF Bin (page 76) x xInquire Ready to Unload (page 77) x nChange Document (page 74) x xUnload Document (page 74) x xADF Scan Window (page 73) x xInquire ADF Open Since Last Change/Scan (page 77) x nPre-load x
n = implemented but essentially a no-op
The “SCL Command Reference” details the commands used to operate the ADF, and the INQUIRE commands that pertain to the ADF devices.
Scroll-type ADFsA scroll type ADF feeds the paper and scans the sheet at the same time. This allows only a single scan per page. See Supported Scanners on page 3 for which scanners support a scroll type ADF.
Flatbed ADFsThe HP ScanJet IIc, IIcx, 3c/4c/6100C, and 4p scanner ADFs are a flatbed type, allowing more flexibility in the resolution of the scan, as well as allowing multiple scans to take place on a document fed by the ADF.
The SCL protocol for scanners which support the flatbed ADF has been defined to offer as much backward compatibility as possible for applications that use SCL to operate the scroll-type ADFs. New applications can choose to use the new commands to take advantage of the flatbed features, or can ignore the new features and treat the ADF the same as the HP ScanJet + or IIp ADF by using the Scan Window Command (page 32).
The scanner assumes that sheets scanned by the ADF Scan Window Command (page 73) are placed or are located at the ADF load position. The application software must ensure that the paper is not moved.
The HP ScanJet flatbed style ADFs load paper onto the scanner's platen prior to a scan. A load operation using the Change Command also causes an unload of a paper already on the platen. A scan operation or multiple scan operations can then take place before the next load/unload operation. An unload operation can be performed without the accompanying load, if desired.
The SCL protocol to support the flatbed ADF is described in this document and includes the following commands:
Scan WindowADF Scan WindowChange DocumentUnload Document ADF Background ChangeInquire Document Feeder ConnectedInquire Document Feeder ReadyInquire Paper in ADF BinInquire ADF Open Since Last Change/ScanInquire Ready to Unload
When using the ADF commands for flatbed ADF scanners, you will need to send Change Document (page 74), ADF Scan Window (page 73), and Unload Document (page 74) commands instead of the old Scan Window Command (page 32).
Note: The only way a sheet on the platen of the flatbed ADF scanners is ejected by the ADF into the output bin is in response to a specific command to load another sheet, or unload a sheet, or a flatbed ADF scan which loads a sheet (and automatically unloads a sheet already on the platen).
No sheet is ejected at power-up, for any reset, nor due to any error or interruption.
Applications written for the flatbed ADF scanners should follow the algorithm shown on the next page.
Note: Paper loaded by the document feeder PHYSICALLY is not placed the same as paper loaded manually, it will vary by 2 mm in the X-direction and 2.4 mm in the Y-direction. However, paper loaded by the document feeder has the same LOGICAL orientation as paper manually placed at the reference corner of the glass.
Figure ADF-1. Recommended ADF Command Flow for flatbed ADF scanners
The Transparency Adapter
Applies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C ScanJet 5200C
ScanJet 4p ScanJet 5p ScanJet 5100C/4100C ScanJet 6200C
The HP ScanJet IIcx, and 3c/4c/6100C can optionally be connected to a Transparency Adapter which is an HP designed light box plugged into the ADF/ACC connector port of the scanner for communications purposes. The Transparency Adapter light will be turned on under scanner firmware control when it is needed to perform a scan. The Transparency Adapter will have a "smart" interface and contain a processor which will control the light during a scan.
The Transparency Adapter for the IIcx can be used on the 3c, 4c, or 6100C as well. The 3c, 4c, and 6100C use a new Transparency Adapter that is brighter and color-tuned slightly differently. The older Transparency Adapter had a blue reflector, while the 3c/4c/6100C version does not.
Commands for Transparency Adapter control include:
22SCL Reset (page 30)23Light Source Test (page 79)24Scan Window (page 32)25ADF Scan Window (page 73)26Transparency Adapter Scan Window (page 78) 27Set Calibration Y-Start (page 79)28Set Calibration Strip Parameters (page 80) 29Transparency Adapter Disable/Enable (page 80)30Upload Binary Data (page 60)31Inquire Transparency Adapter Connected (page 81)32Inquire ADF/Transparency Adapter Open Since Last Change/Scan (page 81)33Inquire Transparency Adapter Ready (page 81)
The Transparency Adapter Commands are designed to work with the HP designed Transparency Adapter. They are, however, flexible enough to be used with some success with other, free-standing light boxes (free-standing meaning that there is no communication with the scanner firmware through the ADF/ACC connector). It is anticipated that these free standing light boxes will have the light actually on when the Transparency Scan Window Command is given. The scan will occur with the scanner light off and the calibration prior to the scan will occur with the parameters as given in the Set Calibration Y-Start (page 79) and Set Calibration Strip Parameters (page 80) Commands.
If the HP Transparency Adapter is used it is expected that a "spacer" will be put in the first 1.75" of the normal scan window area so that calibration can be done in that area without interference from the user's material to be scanned. The application may decide to move the (0,0) reference for the user so that the "spacer" will not be part of the scan window.
Chapter 3: SCL Command Reference
Format of Escape SequencesThis section describes the general format of SCL escape sequences, used to implement control embedded in data. Complete information on the specific escape sequences implemented in HP ScanJet scanners follows in later sections.
Two-Character Escape SequencesTwo-character escape sequences take the form Esc X, where X is a character from the ASCII table within the range 30H through 7EH (0 through ~). If a character within the range 21H through 2FH (! through /) is received, the escape sequence is parameterized and should be interpreted as discussed below in "Parameterized Escape Sequences."
Illegal SyntaxIf a character within the range 0H through 20H (NUL through SPACE), 7FH (DEL) or 80H through FFH is received (after an escape), the sequence is illegal and should generate a command format error. The illegal character should then be processed at the top level of escape sequence parsing. The top level of escape sequence parsing is that level at which the character is treated as a printable character or a control code (i.e., independent of the preceding characters).
Unrecognized Two-Character Escape SequencesFor the HP ScanJet series of scanners, the only supported two-character escape sequence is Esc E. Therefore, if any character from 30H to 7EH other than 45H (E) follows the Esc character, an Unrecognized Command Error is generated.
Parameterized Escape SequencesParameterized escape sequences have the form:
Esc X y # zi # z2 # z3 ... # Zn(Data)
where y, #, zi and (Data) are optional.
X Parameterized Character A character from the ASCII table within the range 21H through 2FH (! through /). The purpose of this character is to indicate that this escape sequence is parameterized. The only parameterized character valid for HP scanners is "*" (2AH).
y Group Character A character from the ASCII table within the range 60H through 7EH (` through ~). The purpose of this is to specify the group or type of control being performed. The group character is optional. If the group character is not present, it specifies a unique group of functions.
# Value Field A group of characters specifying a numeric value. This field can contain any characters within the range 20H through 3FH (Space through ?).
zi Parameter Character Any character from the ASCII table within the range 60H through 7EH (` through ~). This character specifies the parameter to which the previous value field applies. The parameter character may optionally be replaced by its related upper case character, signifying the termination of the escape sequence.
Zn Terminating Character Any character from the ASCII table within the range 40H through 5EH (@ through ^). This character specifies the parameter to which the previous value field applies. This character terminates the escape sequence and can be used in lieu of zi.
(Data) Refers to binary data. Binary data is 8-bit data associated with an escape sequence that is not interpreted by escape sequence parsing. Binary data must immediately follow the terminating character.
Value FieldA value field contains a numeric value.
A numeric value is represented as an ASCII string of digits (i.e., "0" through "9") which may be preceded by a unary sign (i.e., "+" or "-") and succeeded by a fractional portion via use of the decimal point ("."). Value fields are assumed to be integer, unless otherwise specified in the escape sequence definition. If the numeric value field is not present and one is expected, a value of 0 is assumed.
The base of the numeric value field is decimal. Leading zeros and blanks are ignored. The magnitude of the value field should be no larger than 32767. If a value larger than 32767 is specified, the associated parameter should be set to the limit (i.e., 32767 for unsigned or positive numbers and -32767 for negative numbers).
A plus "+" or a minus "-" sign terminates the previous numeric value field, if any, and begins a new numeric value field. Spaces are ignored until the numeric value field starts.
The decimal digits "0" through "9" and "." start a numeric value field. Once a numeric value field has started, spaces act as a terminator, closing out the numeric value field.
Once a numeric value field is started, anything other than a "0" through "9" or the first occurrence of a decimal point "." closes out the value field. A decimal point "." indicates the start of a fractional portion. Once processing of a fractional portion begins, another decimal point terminates the numeric value field. If more than one value field is received and only one is expected, a Parameter Error is generated.
Terminating CharacterThe terminating character (Zn) is actually the parameter character of the last parameter in the command sequence. However, to distinguish Zn from the preceding parameter characters (zi), the last zi is changed to Zn by subtracting 32 from its ASCII value. If zi is an alphabetic character, this changes zi from lower case to upper case. For example, "Esc*f1L" and "Esc*f1l300F" both turn on the scanner lamp, but the second command also positions the scanner element. Furthermore, some group characters (y) may not be followed by any parameters. In this case, the group character (y) becomes the terminator by subtracting 32 from its ASCII value (i.e., y becomes Zn). However, no commands of this type are supported by the scanner.
ExecutionThe functions being performed should be executed as they are decoded. There may be instances in which the order of the parameters may be significant.
Binary Data TransfersOne of the uses of parameterized escape sequences is for the transfer of binary data to the scanner. To ensure that future and past products that do not support features requiring binary data transfer are still able to interpret this data in a nondisruptive fashion, a general guideline is required. The transfer of binary data within any parameterized escape sequence should use a value field to describe the number of bytes to be transferred and a parameter of "w/W". The terminator "Zn" should be followed immediately by the binary data. Only one parameter specifying binary data in an escape sequence is supported. If more than one parameter specifying binary data is sent, the first parameter is effective. The binary data for the other parameters is treated as normal user data and commands. Please note that not all binary transfer escape sequences are defined by the "w/W" parameter. However, this is the preferred parameter for standardization. The format would appear as:
Esc X y # w ... Zn ( binary data )
where the binary data string contains "#" bytes. The stripping of illegal or unsupported escape sequences should also discard the binary data associated with the sequence. Unsupported binary escape sequences, denoted by the "w/W" parameter, should be handled as an unrecognized command and the binary data stripped. The "w/W" parameter always implies binary data.
Illegal SyntaxIf an illegal character is received within an escape sequence (i.e., the syntax is incorrect), the processing of that escape sequence should terminate, and a command format error should be generated. The illegal character should be interpreted independently of the previous characters for data preservation (e.g., processed at the Top level, independent of preceding characters).
Note: Illegal syntax applies only to the user data. The device should interpret and ignore all data added to the user's data stream for protocol purposes (e.g., "ENQ" for serial ENQ/ACK protocol).
Unrecognized Parameterized Escape SequencesAny parameterized escape sequence (or portion thereof) that is syntactically correct but not recognized is ignored, and an unrecognized command error is generated.
Parameterized Escape Sequences with Invalid ParametersAny recognized parameterized escape sequence that contains an illegal parameter value generates a parameter error. However, the requested parameter is not ignored. The scanner attempts to set a supported parameter that is "close" to the one requested.
Parameter ErrorsWhen a recognized parameterized command is received by the scanner, the parameter value is pre-processed according to the following steps:
1. If no value is specified, a value of 0 is assumed.2. Negative values are truncated to negative integers.3. Positive values are truncated to positive integers.4. If the value is less than -32767, it is changed to -32767.5. If the value is greater than 32767, it is changed to 32767.
The following table illustrates these steps and shows which values will cause a parameter error.
Step Requested Value Modified Value Parameter Error1 none 0 no2 -abc.xyz -abc no3 abc.xyz abc no4 <-32767 -32767 yes5 >32767 32767 yes
Format of Inquiry ResponsesResponses to inquiries for status are in the form of SCL escape sequences. Specific status responses supported are summarized in the section on Inquiry Commands.
Format of Scanned DataScanned data is returned as a single block of binary data without header or trailer information. Since a read of scanner data typically involves the transfer of a large amount of data at a relatively high rate, it is important not to constrain the host to parse the data as it is read. Therefore, the SCL standard for unencoded data transfers is that the data does not include control embedded in the data. All scan lines in a given scan contain the same number of bytes and represent the same number of pixels.
Format of One-Bit-Per-Pixel DataOne-bit-per-pixel data includes the output data types B/W Thresholded, B/W Dithered, Black, and White Data. The first pixel of data for each scan line begins with the most significant bit of the first byte of data for that scan line, with the adjacent pixel being represented by the next most significant bit, and so forth. Each byte represents data for eight pixels, except the last byte of the scan line, which is padded if necessary to complete the transfer of the scan line in an integral number of bytes. In most cases, padding bits are image data.
Format of (4-bit) 16-Level B/W Grayscale DataAll HP scanners are capable of scanning 16-level B/W Grayscale data as two 4-bit pixels per byte. The most significant bit of the first data byte returned to the host is the most significant bit of the grayscale value of the first pixel on the scan line. The Most Significant Bit (MSB) of each grayscale value is adjacent to the Least Significant Bit (LSB) of the previous pixel. As with one-bit-per-pixel data, the last byte is padded with image data, if necessary, to achieve an integral number of bytes for the scan line.
Format of (8-bit) 256-Level B/W Grayscale DataThe 256-level grayscale data is delivered as one 8-bit pixel per byte. The most significant bit of the first data byte returned to the host is the most significant bit of the grayscale value of the first pixel on the scan line. The next pixel is contained in the next byte to the end of the line. No padding is necessary to achieve an integral number of bytes for the scan line.
Format of (10-bit) 1024-Level B/W Grayscale DataThe 10-bit B/W Grayscale data is delivered as 2 bytes per pixel. The order of the bytes is dependent on the current setting of the byte order parameter. The bit packing inside each byte will be LSB justified (padding with zeros in MSB).
The first pixel returned is contained in the first two bytes on the scan line. The next pixel is contained in the next two bytes to the end of the line. No padding is necessary to achieve an integral number of bytes for the scan line.
(10-bit) {000000GGGGGGGGGG} = 1 pixel w/byte order = 0(10-bit) {GGGGGGGG000000GG} = 1 pixel w/byte order = 1
Format of (12-bit) 4096-Level B/W Gray Scale DataThe 12-bit B/W Grayscale data is delivered as 2 bytes per pixel. The order of the bytes is dependent on the current setting of the byte order parameter. The bit packing inside each byte will be LSB justified (padding with zeros in MSB).
The first pixel returned to the host is the first pixel on the scan line. The next pixel is contained in the next two bytes to the end of the line. No padding is necessary to achieve an integral number of bytes for the scan line.
(12-bit) {0000GGGGGGGGGGGG} w/byte order = 0(12-bit) {GGGGGGGG0000GGGG} w/byte order = 1
Format of 24-bit Color DataThe 24-bit color is delivered as 8 bits of red, followed by 8 bits of green, followed by 8 bits of blue, so each pixel is represented by 256 levels of each of the three primary colors. The most significant bit of the first data byte returned to the host is the most significant bit of the red value of the first pixel on the scan line. The green value of the first pixel is contained in the next byte and the blue value is contained in the next byte. The fourth byte contains the red value of the second pixel and so on to the end of the line. No padding is necessary to achieve an integral number of bytes for the scan line.
{RRRRRRRRGGGGGGGGBBBBBBBB} = 1 pixel
Format of 30-bit Color DataThe 30-bit color is delivered as 2 bytes per color, three colors per pixel, for a total of 48 bits per pixel. The order of the bytes for each color is dependent on the current setting of the byte order parameter. The bit packing inside each byte will be LSB justified (padding in MSB). The six most significant bits in the upper byte for each color are padded with zeros. No padding is necessary to achieve an integral number of bytes for the scan line.
{000000RRRRRRRRRR000000GGGGGGGGGG000000BBBBBBBBBB} = 1 pixel w/byte order = 0
{RRRRRRRR000000RRGGGGGGGG000000GGBBBBBBBB000000BB} = 1 pixel w/byte order = 1
Format of 36-bit Color DataThe 36-bit color is delivered as 2 bytes per color, three colors per pixel, for a total of 48 bits per pixel. The order of the bytes for each color is dependent on the current setting of the byte order parameter. The bit packing inside each byte will be LSB justified (padding in MSB). The four most significant bits in the upper byte for each color are padded with zeros. No padding is necessary to achieve an integral number of bytes for the scan line.
(36 bit) {0000RRRRRRRRRRRR0000GGGGGGGGGGGG0000BBBBBBBBBBBB} w/byte order = 0(36 bit) {RRRRRRRR0000RRRRGGGGGGGG0000GGGGBBBBBBBB0000BBBB} w/byte order = 1
SCL CommandsSCL commands in the following section are presented as an Escape Code Series, as a SET macro, and as the SENDCOMMAND or INQUIRECOMMAND. Commands are organized as:
34General Commands35Inquiry Commands36Peripheral Attachment Commands (ADF)37Error Reporting38Error Numbers
The following information is provided for each command:39Command Name40Escape Sequence41Range of Values as applied to various Scanner Models42Default Value43SCL Functions, macros, and commands44Purpose of Command45Comments about Command46References to Related Commands47An Example Code Fragment
Access to the features of HP scanners is achieved exclusively through the use of these SCL commands in the form of escape sequences. The scanner treats ASCII strings that start with the escape character as a command. All unrecognized character codes and control codes are discarded by the scanner. ASCII character codes are shown in Appendix B: ASCII Character Codes on page 165. To find out which scanners support each command and what range of values they support, see Command Summary and Support starting on page 159.
Each command to set a parameter has three inquiry commands to request information on that parameter. The various inquiry commands are differentiated by the terminating character. The terminating character is set to 'L' to inquire the lowest valid value for the parameter. It is set to 'H' to inquire the highest valid value for the parameter. It is set to 'R' to request the current setting of the parameter. The scanner returns an escape sequence in response to the inquiry commands. The response escape sequence includes information as to what command the scanner is responding to and the requested value.
Note: Use of the inquiry commands is highly recommended for developing upwardly compatible scanner applications. By inquiring for the minimum and maximum values, features such as contrast and intensity, scaling, resolution, and other features of newer, more powerful SCL devices will be supported by your applications.
The numbers shown in the commands must be the ASCII characters representing those numbers. That is, if the command is
Esc * a 257 Rthe command sequence is
character escape (1BH)character '*' (2AH)character 'a' (61H)character '2' (32H)character '5' (35H)character ''7' (37H)character 'R' (52H)
Note: Spaces shown in the commands are for reading clarity only and should not be part of the command. Replace the '#' with the appropriate ASCII characters representing the parameter setting for the command.
SCL ResetCommand: SCL ResetEscape Sequence Esc ERange: n/aDefaults: n/aMacro: n/aSCL Function: status=ResetScanner(void); SendCommand: status=SendCommand(SL_RESET_SCANNER, 0)
Purpose: Set scanner variables to factory settings
Comment: At the time of an SCL Reset all SCL parameters are returned to their power on defaults as shown in the table below. Any downloaded structure is erased when an SCL Reset is received.
Data Type 0 (B/W Thresholded)Data Width 1 bit/pixelB/W Dither Pattern 0 (coarse fattening)Color Dither Pattern 0 (built-in) Coefficient Matrix 2 (green only) Tone Map 0 (contrast/intensity) Intensity 0Contrast 0 Mirror 0 (off) Filter 0 (auto filter) Auto Background 0 (off)Inverse Image 0 (off)X Resolution 300 ppiY Resolution 300 ppiX Scale Factor 100%Y Scale Factor 100%X Location 0Y Location 0X Extent 2550 (device pixels)Y Extent 4200/3508 (device pixels)
(scanner dependent)Lamp 0 (off)Scanning bar position Home (Reported as 0) or stops where it is
(scanner dependent)Download Type 0 (B/W dither)Downloaded B/W Dither Pattern none (old pattern is erased) Downloaded Color Dither Pattern none (old pattern is erased) Downloaded Tone Map none (old map is erased)Downloaded Matrix none (old matrix is erased) Downloaded Calibration Strip old parameters erasedCalibration Y-Start -1 (white strip)Calibration Strip Parameters 0 (auto select)Transparency Adapter Disable/Enable 0 (enable)
The last 4 commands shown are for the Transparency Adapter.
For scanners supporting two views, the defaults for the following parameters are set the same for both views. See Command Summary and Support starting on page 159 for proper parameter ranges.
48Mirror49Auto Background50X Location51Y Location52X Extent53Y Extent54Lamp55Scan Bar Position56All downloading parameters57All calibration parameters58Speed Mode59Max Lines Per Buffer
Errors:status = OKAY /* commands sent to scanner successfully.status = SL_BADACCESS /*transfer terminated in error. */status = SL_NOACCESS /* IO channel not properly installed */
Example: #include "stdio.h"
#include "ctype.h"#include "scanner.h"main(){
INT16 status;
SCANSTATE ScanState;
/* should always reset the scanner
before a session and initialize the
SCANDATA structure through the
GetScanState call.
*/
status=ResetScanner();
switch(status)
{
case OKAY: break;
case SL_BADACCESS: PrntErr("Scanner Problem");
break;
case SL_NOACCESS: PrntErr("Can't Find Scanner");
break;
}
/***more code
***/}
Scan WindowCommand: Scan WindowEscape Sequence: Esc * f 0 SRange: n/aDefaults: n/aMacro: n/aSCL Function: INT16 FP Scan(INT16 Phase, PUINT8 pBuffer, INT32 Length, PINT32 pReceived)Parameters: Phase - Flag indicating if this is the first transfer in a sequence. Can be one of the
following values.SL_FIRST or SL_SCAN - The first buffer in the transferSL_ADF_SCAN - The first buffer in an ADF transfer.SL_NEXT - Each additional buffer transfer.
pBuffer - Pointer to data buffer to receive the data.Length - Size of the data buffer in bytes.pReceived - Pointer to the actual number of bytes received from the scanner.
SendCommand: n/a
Purpose: Cause the scanner to start scanning.
Comment: This command causes the scanner to scan the area defined by the Scan Window. The value field of the escape sequence must always be 0. A window position must be within the scannable area but may have an extent which extends beyond the scannable area. However, when the window is scanned, data is returned only for the portion of the window that lies within the scannable area.
Errors: If the intersection of the window and the scannable area is null, an Illegal Window error is generated. If the requested X scale or Y scale value is outside of the valid scaling range, the minimum or maximum valid scale factor is used and a Scaling Error is generated. If the scanning carriage does not return to home position (Y=0), the scan is aborted and a Home Position Missing Error is generated. If a downloadable Dither Pattern or Tone Map has been selected but not downloaded, a Dither ID Error or Tone Map ID Error is generated, and the default Dither Pattern or Tone Map is used for the scan. If a downloadable Coefficient Matrix has been selected but not downloaded, a Matrix ID Error is generated and the default Coefficient Matrix is used for the scan. Lamp calibration is done before each scan; if the lamp intensity is incorrect, during any portion of the scan, a Lamp Error is generated.
Example: This code is taken from the SCAN.C file on the distribution disk. It is always a good idea to clear any scanner errors before and after starting a scan. This was taken care of earlier in the program.
Fdat=fopen("scan.dat","w+b");if (ReportState) printf("\nScanning: . ");rc = Scan(SL_FIRST, Buffer, BUFFERSIZE, &received);while (received){
for(i=0;i<received;i++){
ch=fputc(Buffer[i],Fdat);}rc = Scan(SL_NEXT, Buffer, BUFFERSIZE, &received);if (ReportState) printf(". ");
} /* while */fclose(Fdat);ResetScanner();rc = InquireOldestError();if (ReportState) printf("done");exit(0);
Using Scan Window with a Transparency AdapterIf the scanner receives this command when a Transparency Adapter is attached and ready, a custom Transparency Adapter Scan Window Command (page 78) is performed by the firmware as follows:
60The Transparency Adapter lights will be turned on and stabilized. If the light does not stabilize, a Lamp Error will be generated.
61A calibration scan will occur in the first 1.75" of the scan area with the scanner light off and using the calibration tables built with the default transparency or calibration strip parameters set using the Set Calibration Strip Parameters Command (page 80). If something is blocking the calibration area, a Gross Calibration Error will be generated.
62The scan will occur normally but with the scanner's light off. If a "fast" data type is to be scanned, the scan will NOT be done "fast" but no error will be recorded.
63The Transparency Adapter lights will be turned off at the end of the scan, if an interruption occurred during the scan, or if there are five minutes of inactivity on the SCSI bus.
Comment: If the Transparency Adapter is not ready as defined by the Inquire Transparency Adapter Ready Command (page 81), a normal scan is performed using the scanner light.
If a FAST data type is to be scanned and the Transparency Adapter is used, the scan will NOT be done in the FAST mode, but will instead return to the equivalent normal speed data mode and the Transparency Adapter will continue with the scan.
Errors: Lamp Error if lamp does not stabilize. Gross Calibration Error if calibration error blocked.
Using Scan Window with an Automatic Document FeederIf the ADF is not ready as defined by the Inquire ADF Ready Command (page 76), a normal scan is performed, assuming that the document was placed on the platen manually using the normal reference position flush against the "Document Set Mark".
For the HP ScanJet, ScanJet + , IIp, and 3p scanners: If the document feeder is ready the page feeds and is scanned.
For the HP ScanJet IIc, IIcx, 3c/4c/6100C, and 4p scanners: when a Scan Window Command (page 32) is received and the ADF is ready with paper in the paper bin, an HP ScanJet +/IIp emulation ADF Scan Window Command (page 73) is performed as follows:
64Paper is loaded and any paper already on the platen is unloaded by the ADF. 65Any paper jam error detected during the load/unload is put on the SCL error stack as a Document Feeder Jam
error. If there is a jam error, the scan is terminated and no transfer of data to the host will take place.66The paper is scanned using the reference position appropriate for the ADF (inside 2 mm X-dir, 2.4 .mm Y-dir). 67If there is no paper left in the input tray, the paper on the platen is unloaded by the ADF. If there is still paper in
the input tray, no unload is done. 68The unload is occurring in the background; the user does not have to wait. A paper jam error detected during
the unload will not be reported unless it is detected on the next load/unload operation.
Errors: If a paper jam is detected during the load portion of an HP ScanJet +-type ADF scan, the scan is terminated and a Document Feeder Jam error is put on the SCL error stack. This is the same as the HP ScanJet and HP ScanJet +/IIp scanner.
See also: ADF Scan Window on page 73 and Transparency Adapter Scan Window on page 78.
Set X ResolutionCommand: Set X Resolution Escape Sequence: Esc * a # RRange: variable (see Command Summary and Support starting on page 159)Defaults: 300 dpi (all scanners)Macro: SetXResolution(x)SCL Function: INT16 FP SetResolution(INT16 x, INT16 y)Parameters: x - The new resolution in dots-per-inch in x direction.
y - The new resolution in dots-per-inch in y direction.
SendCommand: SendCommand(SL_X_RESOLUTION, x)
Purpose: This command may be used to match the X resolution of the scanner to the X resolution of the printer. When this is done, a printed image is the same width as the original image when the original is scanned with 100% scaling.
Comment: This command sets the spatial resolution of the scanner data in the X or primary scanning direction. The value field is the number of pixels per inch.
Resolution may be incremented in steps of 1 ppi. The default X resolution for all scanners is 300.
See Also: Set Y Resolution on page 35.
Example:#include "stdio.h"#include "ctype.h"#include "scanner.h"#define BUFFERSIZE 16384 // ( ...or 0x4000 in hex)static UINT8 Buffer[BUFFERSIZE];main(int argc, char * argv){
INT16 status;SCANSTATE ScanState;ResetScanner(); // clear errorsstatus = InquireOldestError();// Method 1 of setting both X and Y scanner resolution//SetXResolution(200);SetYResolution(200);/**** or: SetResolution(200,200);****/// Or, alternatively, Method 2 of setting both X and Y scanner // resolution//status = GetScanState(&ScanState);&SetScanState->Xresolution = 200;&SetScanState->Yresolution = 200;status = SetScanState (&ScanState, SL_PIXEL);/*** more code ...***/
}
Set Y ResolutionCommand: Set Y Resolution Escape Sequence: Esc * a # SDefaults: 300 dpiRange: variable (see Command Summary and Support starting on page 159)Macro: SetYResolution(y);SCL Function: INT16 FP SetResolution(INT16 x, INT16 y)Parameters: x - The new resolution in dots-per-inch in x direction.
y - The new resolution in dots-per-inch in y direction.
SendCommand: SendCommand(SL_Y_RESOLUTION, y);
Purpose: This command may be used to match the Y resolution of the scanner to the Y resolution of the printer. When this is done, a printed image is the same width as the original image when the original is scanned with 100% scaling.
Comment: This command sets the spatial resolution of the scanner data in the Y or secondary scanning direction. The value field is the number of pixels per inch.
Resolution may be incremented in steps of 1dpi. The default Y resolution for all scanners is 300.
See Also: Set X Resolution on page 34.
Example: See example code for Set X Resolution on page 34.
Set X Scale FactorCommand: Set X Scale FactorEscape Sequence Esc * a # ERange: variable (see Command Summary and Support starting on page 159)Defaults: 100Macro: SetXScale(x)SCL Function: INT16 FP SetScale(INT16 x, INT16 y);Parameters: x - The percent of scaling in the x-dimension.
y - The percent of scaling in the y-dimension.SendCommand: SendCommand(SL_X_SCALE, x)
Purpose: This command sets the scale factor in the primary (X) direction. The data samples are dependent upon:
69x resolution70scale factor71data width72model of scanner
Comment: The value field, #, is the scale factor times 100, so a value of 100 means the data is unscaled.
If the field is 50 and the scanner is operating at an X resolution of 400 pixels per inch, the scanner will return 200 data samples per inch. This is like having two "knobs" to control the data sampling. Scaling factors are not the same for each scanner (see Command Summary and Support starting on page 159) and can vary with the data type and scanning speed (see Scaling and Resolution Ranges on page 163). You should always set the X resolution before inquiring for the minimum and maximum X scale values.
Errors: If an X scale parameter is requested that is outside of the valid range but between the minimum and maximum, a Parameter Error is not generated, since it is not known before scanning starts if the resolution has changed.
Some scanners let you set the scanning speed using the Set Speed Mode Command (page 61). If the combination of resolution, scaling, data type, and speed at the time a Scan Command is given violates the appropriate formula (see Scaling and Resolution Ranges on page 163), and the Set Speed Mode is set to “auto,” the speed will be adjusted slower to try to not induce a Scaling Error. If that is not possible or Set Speed Mode was not “auto” the scan will continue at the expected speed, with the expected data type, but the effective resolution will be adjusted to be within the bounds of the formula and a Scaling Error will be put on the SCL error stack (see Error Codes on page 161).
If an Inquire Pixels Per Scan Line (page 68) or Inquire Bytes Per Scan Line (page 70) or Scan Window (page 32) Command is attempted, it is executed using the closest allowable scale factor that does not violate the above restriction, and a Scaling Error is generated. The requested scale factor is not modified, so that if subsequent action changes the resolution the requested scale can be used without re-sending the command to the scanner.
See Also: Set Y Scale Factor on page 37 and Set Data Width on page 47.
Set Y Scale FactorCommand: Set Y Scale FactorEscape Sequence: Esc * a # FRange: variable (see Command Summary and Support starting on page 159)Defaults: 100Macro: SetYScale(y)SCL Function: INT16 FP SetScale(INT16 x, INT16 y);Parameters: x - The percent of scaling in the x-dimension.
y - The percent of scaling in the y-dimension.SendCommand: SendCommand(SL_Y_SCALE, y)
Purpose: This command sets the scale factor in the secondary (Y) direction. The data samples are dependent upon:73y resolution74scale factor75data width76model of scanner
Comment: The value field, #, is the scale factor times 100, so a value of 100 means the data is unscaled.
Thus, if the field is 50 and the scanner is operating at an Y resolution of 400 pixels per inch, the scanner will return 200 data samples per inch. Scaling factors are not the same for each scanner (see Command Summary and Support starting on page 159) and can vary with the data type and scanning speed (see Scaling and Resolution Ranges on page 163). You should always set the Y resolution before inquiring for the minimum and maximum Y scale values. Though scale factors can vary greatly, they are constrained by hardware limitations.
Errors: If an Y scale parameter is requested that is outside of the valid range but between the minimum and maximum, a Parameter Error is not generated, since it is not known before scanning starts if the resolution has changed.
Some scanners let you set the scanning speed using the Set Speed Mode Command (page 61). If the combination of resolution, scaling, data type, and speed at the time a Scan Command is given violates the appropriate formula (see Scaling and Resolution Ranges on page 163, and the Set Speed Mode is set to “auto,” the speed will be adjusted slower to try to not induce a Scaling Error. If that is not possible or Set Speed Mode was not “auto” the scan will continue at the expected speed, with the expected data type, but the effective resolution will be adjusted to be within the bounds of the formula and a Scaling Error will be put on the SCL error stack (see Error Codes on page 161).
If an Inquire Pixels Per Scan Line (page 68) or Inquire Bytes Per Scan Line (page 70), or Scan Window (page 32) Command is attempted, it is executed using the closest allowable scale factor that does not violate the above restriction, and a Scaling Error is generated. The requested scale factor is not modified, so that if subsequent action changes the resolution the requested scale can be used without re-sending the command to the scanner.
See Also: Set X Scale Factor on page 36 and Set Data Width on page 47.
Set Window X Position (Decipoints)Command: Set Window X Position (Decipoints)Escape Sequence: Esc * a # XRange: 0 to 6118 (see Command Summary and Support starting on page 159 for supporting
scanners)Defaults: 0Macro: SetXPosDp(x)SCL Function: INT16 FP SetDecipointWindow(INT16 X, INT16 Y, INT16 Xextent, INT16
Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in decipoints.Yextent - The height of the window in decipoints.
SendCommand: SendCommand(SL_XPOS_DECI, x)
Purpose: This command sets the distance in decipoints in the primary (X) scanning direction from the reference point of the scannable area to the reference point of the window.
Comments: There are 720 decipoints to an inch. The X range for all scanners is 0 to 6118. The command can be implemented two ways:
77SetXPosDp(x)78SetDecipointWindow(X, Y, Xext, Yext)
See Also: Set Window Y Position (Decipoints) on page 39, Set Window X Position (Device Pixels) on page 42, Set Window Y Position (Device Pixels) on page 43, Set Window X Extent (Decipoints) on page 40, Set Window Y Extent(Decipoints) on page 41, Set Window X Extent (Device Pixels) on page 44, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches.
status = SetXPosDp(2160);status = SetYPosDp(2160);status = SetXExtDp(1440);status = SetYExtDp(1440);
or,
status = SetDecipointWindow(2160,2160,1440,1440);
Set Window Y Position (Decipoints)Command: Set Window Y Position (Decipoints)Escape Sequence: Esc * a # YRange: variable (see Command Summary and Support starting on page 159 for supporting
scanners)Defaults: 0Macro: SetYPosDp(y)SCL Function: INT16 FP SetDecipointWindow(INT16 X, INT16 Y, INT16 Xextent, INT16
Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in decipoints.Yextent - The height of the window in decipoints.
SendCommand: SendCommand(SL_YPOS_DECI, y)
Purpose: This command sets the distance in decipoints in the secondary (Y) scanning direction from the reference point of the scannable area to the reference point of the window.
Comments: There are 720 decipoints to an inch. The command can be implemented two ways:
79SetYPosDp(x)80SetDecipointWindow(X, Y, Xext, Yext)
See Also: Set Window X Position (Decipoints) on page 38, Set Window X Position (Device Pixels) on page 42, Set Window Y Position (Device Pixels) on page 43, Set Window X Extent (Decipoints) on page 40, Set Window Y Extent(Decipoints) on page 41, Set Window X Extent (Device Pixels) on page 44, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches.
status = SetXPosDp(2160);status = SetYPosDp(2160);status = SetXExtDp(1440);status = SetYExtDp(1440);
or,
status = SetDecipointWindow(2160,2160,1440,1440);
Set Window X Extent (Decipoints)Command: Set Window X Extent (Decipoints)Escape Sequence: Esc * a # PRange: 3 to 6120 (see Command Summary and Support starting on page 159 for supporting
scanners)Defaults: 6120Macro: SetXExtDp(x)SCL Function: INT16 FP SetDecipointWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in decipoints.Yextent - The height of the window in decipoints.
SendCommand: SendCommand(SL_XEXT_DECI, x)
Purpose: This command sets window width distance in decipoints in the primary (X) scanning direction, starting from the window’s origin.
Comments: There are 720 decipoints to an inch. The X range for all scanners is 3 to 6120. The command can be implemented two ways:
81SetXExtDp(x)82SetDecipointWindow(X, Y, Xext, Yext)
See Also: Set Window X Position (Decipoints) on page 38, Set Window Y Position (Decipoints) on page 39, Set Window X Position (Device Pixels) on page 42, Set Window Y Position (Device Pixels) on page 43, Set Window Y Extent (Decipoints) on page 41, Set Window X Extent (Device Pixels) on page 44, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches.
status = SetXPosDp(2160);status = SetYPosDp(2160);status = SetXExtDp(1440);status = SetYExtDp(1440);
or,
status = SetDecipointWindow(2160,2160,1440,1440);
Set Window Y Extent (Decipoints)Command: Set Window Y Extent (Decipoints)Escape Sequence: Esc * a # QRange: variable (see Command Summary and Support starting on page 159 for supporting
scanners)Defaults: 10080 (all scanners)Macro: SetYExtDp(y)SCL Function: INT16 FP SetDecipointWindow(INT16 X, INT16 Y, INT16 Xextent, INT16
Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in decipoints.Yextent - The height of the window in decipoints.
SendCommand: SendCommand(SL_YEXT_DECI, y)
Purpose: This command sets the height of the window in decipoints in the secondary (Y) scanning dimension, starting from the window’s origin.
Comments: There are 720 decipoints to an inch.
See Also: Set Window X Position (Decipoints) on page 38, Set Window Y Position (Decipoints) on page 39, Set Window X Position (Device Pixels) on page 42, Set Window Y Position (Device Pixels) on page 43, Set Window X Extent (Decipoints) on page 40, Set Window X Extent (Device Pixels) on page 44, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches.
status = SetXPosDp(2160);status = SetYPosDp(2160);status = SetXExtDp(1440);status = SetYExtDp(1440);
or,
status = SetDecipointWindow(2160,2160,1440,1440);
Set Window X Position (Device Pixels)Command: Set Window X Position (Device Pixels)Escape Sequence Esc * f # XRange: variable (see Command Summary and Support starting on page 159)Defaults: 0 (all scanners)Macro: SetXPosPix(x)SCL Function: INT16 FP SetPixelWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in device pixels.Yextent - The height of the window in device pixels.
SendCommand: SendCommand(SL_XPOS_PIXEL, x)
Purpose: Set the x-origin of the scan window in device pixels
Comment: This command sets the distance in device pixels in the primary scanning direction from the reference point of the scannable area to the reference point of the window. This command is identical in operation to the similar command that uses decipoints, except for the units of the value field.
Note: The number of device pixels per inch is always 300, regardless of settings for scan resolution or scaling and is also independent of the native optical resolution
The range is 0 to 2549 with a default of 0.
See Also: Set Window X Position (Decipoints) on page 38, Set Window Y Position (Decipoints) on page 39, Set Window Y Position (Device Pixels) on page 43, Set Window X Extent (Decipoints) on page 40, Set Window Y Extent (Decipoints) on page 41, Set Window X Extent (Device Pixels) on page 44, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches in Device Pixels:
status = SetXPosPix(900); // upper left cornerstatus = SetYPosPix(900);status = SetXExtPix(600);status = SetYExtPix(600);
or,
status = SetPixelWindow(900,900,600,600);
Set Window Y Position (Device Pixels)Command: Set Window Y Position (Device Pixels)Escape Sequence: Esc * f # YRange: variable (see Command Summary and Support starting on page 159)Defaults: 0 (all scanners)Macro: SetYPosPix(y)SCL Function: INT16 FP SetPixelWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in device pixels.Yextent - The height of the window in device pixels.
SendCommand: SendCommand(SL_YPOS_PIXEL, y);
Purpose: Set y-origin of scan window in device pixels.
Comment: This command sets the distance in device pixels in the secondary scanning direction from the reference point of the scannable area to the reference point of the window. This command is identical in operation to the similar command that uses decipoints, except for the units of the value field.
Note: The number of device pixels per inch is always 300, regardless of settings for scan resolution or scaling and is also independent of the native optical resolution.
See Also: Set Window X Position (Decipoints) on page 38, Set Window Y Position (Decipoints) on page 39, Set Window X Position (Device Pixels) on page 42, Set Window X Extent (Decipoints) on page 40, Set Window Y Extent(Decipoints) on page 41, Set Window X Extent (Device Pixels) on page 44, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches in Device Pixels:
status = SetXPosPix(900); // upper left cornerstatus = SetYPosPix(900);status = SetXExtPix(600);status = SetYExtPix(600);
or,
status = SetPixelWindow(900,900,600,600);
Set Window X Extent (Device Pixels)Command: Set Window X Extent (Device Pixels)Escape Sequence: Esc * f # PRange: 1 to 2550Defaults: 2550 (all scanners)Macro: SetXExtPix(x)SCL Function: INT16 FP SetPixelWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in device pixels.Yextent - The height of the window in device pixels.
SendCommand: SendCommand(SL_XEXT_PIXEL, x)
Purpose: Set the X extent of the scan window.
Comment: This command sets the width of the window in device pixels in the primary scanning dimension, starting at the window’s origin.
Note: The number of device pixels per inch is always 300, regardless of settings for scan resolution or scaling and is also independent of the native optical resolution
The range is 1 to 2550 with a default of 2550.
See Also: Set Window X Position (Decipoints) on page 38, Set Window Y Position (Decipoints) on page 39, Set Window X Position (Device Pixels) on page 42, Set Window Y Position (Device Pixels) on page 43, Set Window X Extent (Decipoints) on page 40, Set Window Y Extent (Decipoints) on page 41, and Set Window Y Extent (Device Pixels) on page 45.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches in Device Pixels:
status = SetXPosPix(900); // upper left cornerstatus = SetYPosPix(900);status = SetXExtPix(600);status = SetYExtPix(600);
or,
status = SetPixelWindow(900,900,600,600);
Set Window Y Extent (Device Pixels)Command: Set Window Y Extent (Device Pixels)Escape Sequence: Esc * f # QRange: variable (see Command Summary and Support starting on page 159)Defaults: variable (see Command Summary and Support starting on page 159)Macro: SetYExtPix(y)SCL Function: INT16 FP SetPixelWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent)Parameters: X - The X coordinate of the upper left hand corner.
Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in device pixels.Yextent - The height of the window in device pixels.
SendCommand: SendCommand(SL_YEXT_PIXEL, y)
Purpose: Set the Y extent for the scan window.
Comment: This command sets the height of the window in device pixels in the secondary scanning dimension, starting at the window’s origin.
Note: The number of device pixels per inch is always 300, regardless of settings for scan resolution or scaling and is also independent of the native optical resolution
See Also: Set Window X Position (Decipoints) on page 38, Set Window Y Position (Decipoints) on page 39, Set Window X Position (Device Pixels) on page 42, Set Window Y Position (Device Pixels) on page 43, Set Window X Extent (Decipoints) on page 40, Set Window Y Extent (Decipoints) on page 41, and Set Window X Extent (Device Pixels) on page 44.
Example: To set a scan window 2 inches by 2 inches square, and the window's origin at 3 inches by 3 inches in Device Pixels:
status = SetXPosPix(900); // upper left cornerstatus = SetYPosPix(900);status = SetXExtPix(600);status = SetYExtPix(600);
or,
status = SetPixelWindow(900,900,600,600);
Set Output Data TypeCommand: Set Output Data TypeEscape Sequence: Esc*a#TInquire ID: 10325Range: 0 through 9, 50, 51, and 52, depending on the scanner.Default: 0Macro: SetDataType(x)SCL Function: n/aSendCommand: SendCommand(SL_DATA_TYPE, x);
Purpose: Select the type of data returned by the scanner.
Comment: This command selects the type of data associated with the current window. For the data types supported by each scanner, see the table below for the meaning of the parameter, and Command Summary and Support starting on page 159 for which scanners support each data type. See also Format of Scanned Data starting on page 27.
The default is 0 (B/W Thresholded). Data Types 4 and 5 below have been expanded:
# Data Type Name Constant Width Appearance PxlsByte Order
0 B/W Threshold SL_THRESHOLD1 WHITE SL_WHITE2 BLACK SL_BLACK3 B/W Dithered SL_DITHER4 B/W GrayScale SL_GRAYSCALE 4-bit {g1g1 g1g1 g2g2 g2g2} 2
SL_GRAYSCALE 8-bit {gggg gggg} 1SL_GRAYSCALE 10-bit {0000 00gg gggg gggg} 1 0SL_GRAYSCALE 10-bit {gggg gggg 0000 00gg} 1 1SL_GRAYSCALE 12-bit {0000 gggg gggg gggg} 1 0SL_GRAYSCALE 12-bit {gggg gggg 0000 gggg} 1 1
5 24-bit color SL_COLOR 8-bit {RRRR RRRR GGGG GGGG BBBB BBBB}
1
30-bit color SL_COLOR 10-bit {0000 00RR RRRR RRRR 0000 00GG GGGG GGGG 0000 00BB BBBB BBBB}
1 0
30-bit color SL_COLOR 10-bit {RRRR RRRR 0000 00RR GGGG GGGG 0000 00GG BBBB BBBB 0000 00BB}
1 1
36-bit color SL_COLOR 12-bit {0000 RRRR RRRR RRRR 0000 GGGG GGGG GGGG 0000 BBBB BBBB BBBB}
1 0
36-bit color SL_COLOR 12-bit {RRRR RRRR 0000 RRRR GGGG GGGG 0000 GGGG BBBB BBBB 0000 BBBB}
1 1
6 Color Thresholded SL_COLOR_THRESHOLD {RRRR RRRR GGGG GGGG BBBB BBBB}
8
7 Color Dithered SL_COLOR_DITHER {RRRR RRRR GGGG GGGG BBBB BBBB}
8
8 Chunky Thresh SL_CHUNKY_THRESHOLD {0RGB 0RGB} 29 Chunky Dithered SL_CHUNKY_DITHER {0RGB 0RGB} 250 Fast B/W Thresh SL_FAST_THRESH51 Fast B/W Dithered SL_FAST_DITHER52 Fast B/W Gray SL_FAST_GRAY
Note: For SL_COLOR data types the Width column represents the number of bits of R, G and B.
See Also: Set Data Width on page 47.
Example:/* code fragment */switch (SelectedDataType) {
case LINEART : SetDataType(SL_THRESHOLD) break;case PHOTO : SetDataType(SL_GRAYSCALE) break;}
Note: This example resets the data width and the matrix coefficients to their defaults.
Set Data WidthCommand: Set Data WidthEscape Sequence Esc * a # GRange: See Command Summary and Support starting on page 159Default: 1 bit/pixelMacro: SetPixelBits(x)SCL Function: n/aSendCommand: SendCommand (SL_BITS_PER_PIXEL, x)
Where x can be: 1 - If the data type is binary threshold, white, black, or black and
white dithered.4, 8, 10, or 12 - If the data type is grayscale.24, 30, or 36 - If the data type is color.
Purpose: This command selects the format in which data is sent to the host application.
Comment: This command selects the format in which data is sent to the host. Each time a data type is selected, the data width parameter is reset to the default data width for that data type. For the data widths supported by each scanner (according to data type), see Command Summary and Support starting on page 159.
For black and white data types, a parameter value of
width return format12 returns data back in 2 bytes per pixel10 returns data back in 2 bytes per pixel8 returns back data as 1 8-bit pixel per byte4 returns data as 2 4-bit pixels per byte1 returns data as 8 1-bit pixels per byte
For color, allowable parameter values are 3 bits/pixel, 4 bits/pixel, 24 bits/pixel, 30 bits/pixel, or 36 bits/pixel.
For values allowed by each scanner, see Command Summary and Support starting on page 159.
DataWidth, thresholding, and grayscaling are very much intertwined. If you threshold your data you must return data as 1-bit/pixel. The 4 or 8-bit thresholded data requires using the grayscale data type and processing data via a downloaded Tone Map.
Note: The FAST B&W Grayscale type can only have a data width of 4 — not the 8 bits of the regular grayscale.
See Also: Format of Scanned Data starting on page 27 and Set Output Data Type on page 46.
Set B/W Dither PatternCommand: Set B/W Dither PatternEscape Sequence: Esc * a # JRange: See Command Summary and Support starting on page 159Defaults: See Command Summary and Support starting on page 159Macro: SetDitherPattern(x)SCL Function: INT16 FP Dither(INT16 Pat);Parameters: Pat - The Dither Pattern to be used as described in the table below.SendCommand: SendCommand(SL_PATTERN, x)
Purpose: Dither patterns are used to optimize the image for the output device. This command allows the developer to provide various Dither Patterns. Others may be created by manipulating these matrices.
Comment: This command selects the B/W Dither Pattern to be used for Dithered Data. Dither patterns are either fixed values stored in ROM or downloadable values. Each Dither Pattern has an associated ID number. ID numbers for fixed patterns are non-negative, numbered from 0 up, while downloaded dither IDs are negative numbers from -1 down. The default B/W Dither Pattern ID is zero. The B/W Dither Patterns are:
Pattern SCL Define Description-1 SL_USER_DEFINED User Defined0 SL_COARSE_FATTING Coarse Fatting 1 SL_FINE_FATTING Fine Fatting 2 SL_BAYER Bayer Dither3 SL_VERTICAL_LINE Vertical Line
Patterns 0 to 3 are optimized for HP LaserJet series II printers.
Errors: If a B/W Dither Pattern of -1 is selected but no pattern downloaded for that ID, a Dither ID Error is generated if a B/W dithered scan is requested, and pattern 0 is used.
See Also: Black and White Dithered Data on page 9.
Example:SetDitherPattern (SL_COARSE_FATTING);Dither (SL_COARSE_FATTING);
Set Color Dither PatternCommand: Set Color Dither PatternEscape Sequence: Esc * u # J Range: See Command Summary and Support starting on page 159Defaults: 0Macro: SetColorDitherPat(x);SCL Function: INT16 FP ColorDither(INT16 Pat);Parameters: Pat - The Color Dither Pattern to be used as described
below.SendCommand: SendCommand(SL_COLOR_DITHER, x);
Purpose: Dither patterns are used to optimize the image for the output device. This command allows the developer to provide various Dither Patterns. Others may be created by manipulating these matrices.
Comment: This command selects the Color Dither Pattern to be used for Dithered Data. Dither patterns are either fixed values stored in ROM or downloadable values. Each Dither Pattern has an associated ID number. ID numbers for fixed patterns are non-negative, numbered from 0 up, while downloaded dither IDs are negative numbers from -1 down. The default Color Dither Pattern ID is zero. The HP ScanJet IIc scanner Color Dither Patterns are:
Pattern -1: User-DefinedPattern 0: Coarse Fatting
Errors: If Color Dither Pattern -1 is selected but no Color Dither Pattern downloaded, a Dither ID Error is generated if a Color Dithered Scan is requested, and Color Dither Pattern 0 is used.
See Also: Color Dither Patterns on page 13.
Set Matrix CoefficientsCommand: Set Matrix CoefficientsEscape Sequence Esc * u # T Range: See Command Summary and Support starting on page 159Defaults: Depends on Data Type and Transparency AdapterMacro: SetMatrix(x)SCL Function: n/aSendCommand: SendCommand(SL_MATRIX, x)
Purpose: Use a color matrix to fine tune the color response for a particular application.
Note: Use of Color Matrices assumes the application developer has knowledge of color space and color technology.
Comment: This command selects which Coefficient Matrix is to be used for the scan. If none is explicitly selected after choosing a data type, the default matrix for that data type is used. If a matrix other than the default is desired, it must be selected after the data type is selected. There are a possibility of seven built-in matrices and two user-defined (downloadable) matrices with identifications as follows:
Val SCL Define Description-2 SL_USER_DEFINED_BW User Defined-1 SL_USER_DEFINED_COLOR User Defined (downloadable color)0 SL_RGB_MATRIX Red, Green, Blue NTSC* (default for all color data types)1 SL_BW_NTSC_MATRIX Black and White NTSC* & B/W (default for B/W Dithered and
Grayscale)2 SL_PASS_THRU_MATRIX All three colors pass through (default for B/W Thresholded)3 SL_RED_MATRIX Red appears on all three channels4 SL_BLUE_MATRIX Blue appears on all three channels5 SL_XPA_RGB_MATRIX Transparency Adapter RGB (default for color Transparency Adapter
scans)5 SL_sRGB_MATRIX Red, Green, Blue sRGB (for HP ScanJet 4100C, 5100C, 6200C)6 SL_XPA_BW_MATRIX Transparency Adapter B/W NTSC (default for B/W Transparency
Adapter scans)* National Television Standard Committee.
The pass through matrix (ID 2) causes the matrixing function to be bypassed. When the data type is one of the black and white types, pass through will appear as green only.
Note: "fast" data types use the pass through matrix for the ScanJet IIcx — the application is advised not to change the matrix for fast mode.
For scanners that support the Transparency Adapter, the default matrices for each data type are dependent on whether the Transparency Adapter is "ready" at the time the Set Matrix Coefficients Command (page 50) is received. The following table describes the defaults used:
Data Type Default Matrix - Transparency Adapter not ready or scanner does not support Transparency Adapter.
Default Matrix - Transparency Adapter ready
0 B/W Thresholded 2 21 White 2 22 Black 2 23 B/W Dithered 1 64 B/W Grayscale 1 65 Color 0 56 Color Thresholded 0 57 Color Dithered 0 58 Chunky Thresholded 0 59 Chunky Dithered 0 550 Fast B/W Thresholded 2 251 Fast B/W Dithered 2 652 Fast B/W Grayscale 2 6
To find out which scanners support each matrix, see Command Summary and Support starting on page 159.
See Also: Color Coefficient Matrix on page 15
Set Tone MapCommand: Select Tone MapEscape Sequence Esc * u # K Range: See Command Summary and Support starting on page 159
0 = Tone Map based upon contrast and intensity parameters-1 = downloaded Tone Map-2 = downloaded B/W Tone Map
Defaults: 0 (meaning a function of Intensity and Contrast)Macro: SetToneMap(x)SCL Function: n/aSendCommand: SendCommand(SL_TONEMAP, x)
Purpose: Allows for a grayscale transfer curve to be used for the next scan.
Comment: This command selects the transfer-curve look-up table (Tone Map) to be used for the next scan in the currently selected view. A -1 or -2 selects the downloaded Tone Map, and a 0 selects the Tone Map defined by the contrast and intensity parameters.
Some scanners can send two data streams (views) from the scanner for the same window on the same scan. For these scanners, parameter values can be set separately for each view. If two views are enabled and there are two different color Tone Maps set at scan time (one for each view), the Color Tone Map set for view one will be used in both views (there can be two different B/W Tone Maps for the two views when both views are B/W). If a downloaded Color Tone Map is selected with a B/W image type the Green Tone Map will be used. Download types 1 and 10 are both Color Tone Maps. If download type 1 is downloaded and Tone Map -1 is selected, the same downloaded Tone Map is used in all three colors and the dark point is the first value in the downloaded Tone Map. The mapping from the 256 1-byte values in download type one to the 128 12-bit values in the internal Tone Maps will be to drop every other 1-byte value in the downloaded Tone Map and left shift each remaining value by four.
Errors: If Tone Map -1 or -2 is selected but no pattern downloaded a Tone Map ID Error will be generated if a scan is requested, and Tone Map 0 will be used.
See Also: Image Data Transfer Curves (Tone Maps) on page 17
Inverse ImageCommand: Inverse ImageEscape Sequence Esc * a # IRange:
Param. Value Data Types0=white1=black
B/W Threshold and Dithered
0=white15=black
16 level B/W Grayscale
0=white255=black
256 level B/W Grayscale
0=bright1=colored
Color Threshold and Color Dither
0=bright255=dark color
for each color for 24-bit/pixel color
0=bright1023=dark color
for each color for 30-bit/pixel color
0=bright4095=dark color
for each color for 36-bit/pixel color
A parameter of 1 inverts the matrix
Param. Value Data Types0=black1=white
B/W Threshold and Dithered
0=black15=white
16 level B/W Grayscale
0=black255=white
256 level B/W Grayscale
0=colored1=bright
Color Threshold and Color Dither
0=dark color255=bright
for each color for 24-bit/pixel color
0=dark color1023=bright
for each color for 30-bit/pixel color
0=dark color4095=bright
for each color for 36-bit/pixel color
Defaults: 0Macro: SetNegative(x)SCL Function: n/aSendCommand: SendCommand(SL_NEGATIVE, x)
Comment: This command inverts the polarity of the data returned from scanner. A parameter value of 0 is the default.
Mirror ImageCommand: Mirror ImageEscape Sequence Esc * a # MRange: See Command Summary and Support starting on page 159Defaults: 0Macro: SetMirror(x)SCL Function: n/aSendCommand: SendCommand(SL_MIRROR, x)
Purpose: Provide a reversed (axis) image.
Comment: This command turns the mirror image feature on or off. When Mirror Image is on, the order of the data is reversed in the primary scanning direction. A 0 in the value field turns the feature off; a value of 1 turns it on. Default is off.
Note: Pad bits, if needed, appear at the end of the data stream.
Set Intensity LevelCommand: Set Intensity LevelEscape Sequence: Esc * a # LRange: See Command Summary and Support starting on page 159Defaults: 0Macro: SetIntensity(x)SCL Function: n/aSendCommand: SendCommand(SL_INTENSITY, x)
Purpose: Control the lightness or darkness of the scanned image.
Comment: This command controls the lightness or darkness of the scanned image. The value field for the HP ScanJet scanner can range from -1 to +1, with 3 intensity levels Normal, Brighter, and Darker. The value field for all other scanners can range from -127 to +127, for a total of 255 intensity levels. The default intensity level is 0 (Normal).
A positive value results in a lighter image, and a negative value results in a darker image.
Data types of Dithered, Color, and Grayscale are affected when Tone Map 0 is used. Thresholded data is also affected when Auto Background is off and Tone Map 0 is used.
See Also: Image Data Transfer Curves (Tone Maps) on page 17
Set FilterCommand: Set FilterEscape Sequence Esc * u # FRange: See Command Summary and Support starting on page 159Defaults: 0Macro: SetFilter(x)SCL Function: n/aSendCommand: SendCommand(SL_FILTER, x)
Purpose: Provide a "smoothing" control for image appearance.
Some scanners can smooth image data to reduce interference patterns when scaling down. This is done by averaging pixels in the X direction. Five options are available using the SetFilter() Command:
Value SCL Define Description0 SL_DEF_FILTER auto-filter (default)1 SL_2BIT_FILTER 2-pixel averaging2 SL_4BIT_FILTER 4-pixel averaging3 SL_NO_FILTER off always4 SL_8BIT_FILTER 8-pixel averaging
Option 0, Auto-Filter, will cause the scanner to pick the "best" type of filtering for a scan, depending on the current scaling and resolution parameters. Use Inquire Auto-Filtering on page 72 to determine which filter will be used for a scan when Auto-Filter is chosen.
Comment: Some scanners let you set the speed mode. For these scanners, the speed mode parameters supporting speed mode are also factored in for setting the "best" filter for a scan.
For 600 dpi scanners supporting Speed ModeX Resolution
speed 1200-400 399-200 199-133 132-100 99-66 65-50 49-33 32-12normal NF 2 pix 4 pix 4 pix 8 pix 8 pix 8 pix 8 pixfast NF NF 2 pix 2 pix 4 pix 4 pix 8 pix 8 pixextra fast NF NF NF 2 pix 2 pix 4 pix 4 pix 8 pix
For 300 dpi scanners supporting Speed ModeEffective
x-resolution
600-200 199-100 99-50 49-12
no filter 2-pixel 4-pixel 8-pixel
For 300 dpi scanners, the syntax of this command remains unchanged. However, the break points for the auto-filtering have changed to approximately 1/2 of the HP ScanJet 3c/4c/6100C values (since HP ScanJet 4p is 300 dpi). The table above shows how auto-filtering works in the HP ScanJet 4p.
To find out which scanners support this command, see Command Summary and Support starting on page 159.
Set Contrast LevelCommand: Set Contrast LevelEscape Sequence Esc * a # K Range: See Command Summary and Support starting on page 159Defaults: 0Macro: SetContrast(x)SCL Function: n/aSendCommand: SendCommand(SL_CONTRAST, x)
Purpose: Contrast controls the difference between the lightest area and darkest area within the scanned image.
Comment: This command controls the difference between light and dark in the scanned image. The value field can range from -127 to +127, for a total of 255 contrast levels. The default contrast level is 0 (normal).
A positive value results in a larger difference, and a negative value results in a smaller difference.
This command affects Dithered and Grayscale Data types when Tone Map 0 is used.
See Also: Image Data Transfer Curves (Tone Maps) on page 17.
Set Automatic BackgroundCommand: Set Automatic BackgroundEscape Sequence: Esc * a # BRange: 0 or 1 (all scanners)Defaults: 0 (off)Macro: SetAutoBackground(x)SCL Function: n/aSendCommand: SendCommand(SL_AUTO_BACKGROUND, x)
Purpose: Turn on/off Automatic Background Control feature.
Comment: This command turns the Automatic Background Control feature on or off. Automatic Background Control is used to adjust the threshold automatically for B/W Thresholded data. A 0 turns it off, and a 1 turns it on. The default is off.
Note: Automatic Background does not work with FAST data modes. A 0 turns it off, and a 1 turns it on. The default is off.
Note: This command only works with B/W Thresholded data, and has no effect on other data types. For scanners that fully support this command, contrast and intensity parameters have no effect when Automatic Background Control is in use.
To find out which scanners support this command, see Command Summary and Support starting on page 159.
Position Scanner Element, SecondaryCommand: Position Scanner Element, SecondaryEscape Sequence: Esc * f # FRange: See Command Summary and Support starting on page 159Defaults: 0Macro: SetPosition(x)SCL Function: n/aSendCommand: SendCommand(SL_YPOS_BAR, x)
Purpose: Move the light bar to a predetermined position.
Comment: When the scanner receives this escape sequence, the scanning element is moved to the position specified in the value field in the secondary scanning dimension. The value field is a dimension in pixels (300 dpi). The default setting is 0.
Note: Even though home position is not the same as Y = 0, an inquiry with the scanning carriage in either position is reported as 0.
Light Source TestCommand: Light Source TestEscape Sequence: Esc * f # LRange: 0 to 1 (all scanners)Defaults: 0 (off)Macro: SetLamp(x)SCL Function: n/aSendCommand: SendCommand(SL_TEST_LAMP, x)
Purpose: Some scanning operations may require the lamp to turn on and remain on for some extended period. This command facilitates such operations.
Comment: This command turns the scanner light on and off. A value of 0 turns off the light, and a value of 1 turns it on. When the light has been on for three to five minutes, the scanner will automatically turn the light off. The default setting is OFF.
See Also: Transparency Adapter SCL Commands starting on page 78 and SCL sample code lampsdk.exe and lampcon.exe.
Set Download TypeCommand: Set Download TypeEscape Sequence: Esc * a # D Inquire ID: 10309Range: See Command Summary and Support starting on page 159Defaults: 0Macro: SetDownloadType(x)SCL Function: n/aSendCommand: SendCommand(SL_DOWNLOAD_TYPE, x)
Purpose: Used to indicate the type of download operation about to be performed.
Comment: The value field specifies what kind of download is about to be executed. The possible values are as follows:
Val. Constant Data to Download Bytes
Data Format0 SL_BW_PAT_LOAD 8 x 8 B/W Dither Pattern 64 8x8 by row1 SL_TONEMAP_LOAD 8 x 8-bit Tone Map 256 0,1,2..2552 SL_MATRIX_LOAD Matrix Coefficients 9 r>r, r>g, r>b...3 SL_COLOR_PAT_LOAD Color Dither Pattern 192 8x8r, 8x8g, 8x8b 4 SL_CAL_STRIP_LOAD Calibration Strip Parameters 3 r, g, b5 SL_16X16_DITH_LOAD 16 x 16 B/W Dither Pattern 256 downloaded row-wise6 SL_10TO8BIT_LOAD 10 x 8 Tone Map 1024 lightest (0, 1, ..., 1023) darkest8 SL_BW_MATRIX_LOAD B/W Matrix Coefficients 6 least significant 10 bits per 2 bytes used9 SL_FULL_MATRIX_LOAD 10-bit Color Matrix Coefficients 18 r>r, r>g, r>b...
least significant 10 bits per 2 bytes used10 SL_RGB_TONEMAP_LOAD RGB three 7x12 Tone Maps 774 6 bytes for the 3 dark point values followed by
384 two-byte Tone Map values -- least significant 12 bits per two bytes used
11 SL_BW_TONEMAP_LOAD B/W 7x12 Tone Maps 258 2 bytes for the dark point value followed by 218 two-byte Tone Map values -- least significant 12 bits per two bytes used
Note: Type 1 and type 10 interact. Downloading type 1 will overwrite any downloaded type 10 that may have been present (and vice versa for 10 to 1).
Note: Setting and downloading either size black and white Dither Pattern would replace the currently downloaded B/W Dither Pattern. Downloading the 16 x 16 B/W Dither Pattern replaces the 8 x 8 B/W downloaded Dither Pattern, and vice versa. To set the currently downloaded B/W Dither Pattern, send a -1 for the normal Set B/W Dither Pattern (page 48).
Format for download types 8 and 9Each matrix coefficient is a 10-bit signed magnitude number with 2 digits to the left of the decimal point. Therefore, these coefficients can represent numbers in the range -511/128 to + 511/128 in increments of 1/128.
8 - {000000rrrrrrrrrr000000gggggggggg000000bbbbbbbbbb}9 - {000000rrrrrrrrrr000000gggggggggg000000bbbbbbbbbb
000000rrrrrrrrrr000000gggggggggg000000bbbbbbbbbb000000rrrrrrrrrr000000gggggggggg000000bbbbbbbbbb}
Note: Types 2 (Color Matrix Coefficients) and 9 (10-bit color matrix coefficients) are the same thing with different resolutions (8-bits vs. 10-bits). Therefore they will overwrite each other. Downloading 10-bit color matrix coefficients (type 9) will replace any 10-bit color matrix coefficients (type 9) that were there as well as any color matrix coefficients (type 2) that were there (and vice versa).
To find out which scanners support this command, and the allowed download types for each scanner, see Command Summary and Support starting on page 159.
Download Binary DataCommand: Download Binary DataEscape Sequence: Esc * a # W (data) Inquire ID: 10328Range: See Set Download Type on page 58 and Command Summary and Support starting on page
159.Defaults: n/aMacro: n/aSCL Function: INT16 FP Download(INT16 Kind,PUINT8 pBuffer)Parameters: Kind - The type of upload to be performed.
SL_BW_PAT_LOAD - Download a B/W Dither Pattern.SL_TONEMAP_LOAD - Download a Tone Map.SL_MATRIX_LOAD - Download a Coefficient Matrix.SL_COLOR_PAT_LOAD - Download a Color Dither Pattern.SL_CAL_STRIP_LOAD - Download a calibration strip.SL_16X16_DITH_LOAD - Download a B/W Dither Pattern.SL_10TO8BIT_LOAD - Download a Tone Map.SL_FULL_MATRIX_LOAD - Download double byte Coefficient
Matrix.SL_BW_MATRIX_LOAD - Download a 6 byte Coefficient Matrix.SL_RGB_TONEMAP_LOAD -
Download a 774 byte RGB Tone Map.
SL_BW_TONEMAP_LOAD - Download a 258 byte Tone Map.pBuffer - Pointer to data buffer to be sent.
SendCommand: n/a
Purpose: Used to specify how many bytes of data follow.
Comment: This is the generic command to send binary data to a scanner, with the parameter specifying how many bytes of data follow. The Set Download Type Command (page 58) determines the number of bytes expected. A Parameter Error occurs if the number of bytes sent is different than the number expected. An “Unrecognized Command Error” is generated if any group character other than ‘a’ is received. Whenever the escape sequence with a “W” is received the sequence is continued until the terminating character is received and the next “#” characters are treated as binary data, being used appropriately if it is a valid command and being thrown away if it is an invalid command.
The Command Summary and Support starting on page 159 shows which scanners allow each data type.
Note: For the SCL Function, Download, the first parameter is the type download to perform (See Set Download Type on page 58 for possible values). The second value is a pointer to the buffer containing the downloaded data.
Errors: If the number of bytes sent is different than the number expected, a Parameter Error occurs. If any group character other than “a” is received, an Unrecognized Command Error is generated.
Upload Binary DataCommand: Upload Binary DataEscape Sequence: Esc * s # UInquire ID: 10902Range: See Command Summary and Support starting on page 159.Defaults: n/aMacro: n/aSCL Function: INT16 FP Upload(INT16 Kind, PUINT8 pBuffer, INT16 Length, PINT16 pReceived)Parameters: Kind - The type of upload to be performed.
SL_BW_PAT_LOAD - Upload a bw Dither Pattern.SL_TONEMAP_LOAD - Upload a Tone Map.SL_MATRIX_LOAD - Upload a Coefficient Matrix.SL_COLOR_PAT_LOAD - Upload a Color Dither Pattern.SL_CAL_STRIP_LOAD - Upload a calibration strip.SL_16X16_DITH_LOAD - Upload a B/W Dither Pattern.SL_10TO8BIT_LOAD - Upload a Tone Map.SL_FULL_MATRIX_LOAD - Upload double byte Coefficient
Matrix.SL_BW_MATRIX_LOAD - Upload a 6 byte Coefficient Matrix.SL_RGB_TONEMAP_LOAD - Upload a 774 byte RGB Tone Map.SL_BW_TONEMAP_LOAD - Upload a 258 byte Tone Map.
pBuffer - Pointer to data buffer to receive the data.Length - Size of the data buffer in bytes.pReceived - Pointer to the actual number of bytes received from the scanner.
SendCommand: n/a
Purpose: Moves selected binary type from scanner to host.
Comment: Requests that the currently selected B/W Dither Pattern (#=0), currently selected Tone Map (#=1), currently selected Coefficient Matrix (#=2), etc., to be uploaded to the host. If the requested data hasn't been downloaded yet or if a value not equal to a supported download ID is specified, a null response will be returned. The data is uploaded in the following formats where the "#" is the requested parameter number and [data] is the data being uploaded:
8x8 B/W Dither Response: Esc * s 0 t 6 4 W [data]8 bit to 8 bit Tone Map Response: Esc * s 1 t 2 5 6 W [data]Matrix Coef. Response: Esc * s 2 t 9 W [data]Color Dither Response: Esc * s 3 t 19 2 W [data]Calibration Strip. Parms Response: Esc * s 4 t 3 W [data]16x16 B/W Dither Response: Esc * s 5 t 256 W [data]10 bit to 8 bit Tone Map Response: Esc * s 6 t 1024 W [data]B/W Matrix Coefficients Esc * s 8 t 6 W [data] 10 bit Color Matrix Coefficients Esc * s 9 t 18 W [data]RGB three 7 x 12 Tone Maps Esc * s 10 t 774 W [data]B/W 7 x 12 Tone Map Esc * s 11 t 258 W [data]Null Response: Esc * s # t N
Set Download Type on page 58 shows the types of data allowed. Command Summary and Support starting on page 159 shows which scanners allow each data type.
See Also: The Transparency Adapter starting on page 21.
Set Speed ModeCommand: Set Speed ModeInquire ID: 10950Escape Sequence: Esc*u#ERange: See Command Summary and Support starting on page 159Default: 0SCL Command n/aMacro: SetSpeedMode(x)SendCommand: SendCommand(SL_SPEED_MODE, x)
Where x can be:SL_AUTO_SPEED_MODESL_SLOW_SPEED_MODE (Not supported by all scanners)SL_NORMAL_SPEED_MODESL_FAST_SPEED_MODESL_EXTRA_FAST_SPEED_MODE (Not supported by all scanners)
Comment: Use this command to set the speed of the scanner. The default is 0 (auto mode).
See Also: Set Speed Mode (HP ScanJet 3c/4c/6100c) (page 175) , Set Speed Mode (HP ScanJet 5p Scanner) (page 179) and Set Speed Mode (HP ScanJet 6200C Scanner) (page 185).
RecalibrateCommand: RecalibrateEscape Sequence Esc * u 0 RRange: n/aDefaults: n/aMacro: n/aSendCommand: n/a
Purpose: This command will cause the scanner to perform a calibration scan at the beginning of the next scan, and the calibration values will be calculated and stored. Issuing the Recalibrate Command only affects the next scan. Following scans may or may not do a calibration scan depending on the data type, data width or calibration mode set in the scanner.
Comment: On the HP ScanJet IIcx, a scan at normal speed will always have a calibration scan done. On other scanners that support the Recalibrate Command, the decision to perform a calibration is not dependent on speed, but on a combination of data type and data width.
For the HP ScanJet IIcx, this command will cause the scanner to perform a calibration scan at the beginning of the next fast scan and these new values will be used for all the FAST data types. In fast mode the lamps of the scanner calibrate on the first scan, and thereafter they will, after a scan, reduce to 20% power. Upon the next scan no calibration is done, the lamp is brought to full power, and the scan begins. If you believe there may be calibration drift over some time, this command allows the application to initiate a re-calibration every X periods (periods being time or number of scans — up to the app). The Recalibrate Command only works under this condition:
if (data type = FAST data)if (ADF is connected)
if (paper in ADF && no jam error)if (last scan was an ADF scan) then
light drops to 20% powercarriage returns to "home"light returns to full powerno calibrationnew scan initiates
fifi
fifi
Set Byte OrderCommand: Set Byte OrderEscape Sequence: Esc * u # BRange: 0 - 1Defaults: 0Macro: n/aSCL Function: n/aSendCommand: n/a
Purpose: Used to set the order of a two byte data word.
Comments: When scanning data in 10-bit, 12-bit, 30-bit, or 36-bit format, the orientation of the two bytes which contain a pixel’s worth of one color of data can be controlled. This command will set the order of a two byte data word with the first byte as the most significant byte, or with the second byte as the most significant. This command is used with the 10 or 12-bit (or 30 or 36-bit) per pixel data types. The default is 0. The supported values are:
# Choice Example0 MSB, LSB 398 = 01, 8e hex1 LSB, MSB 398 = 8e, 01 hex
Set CompressionCommand: Set CompressionEscape Sequence: Esc*a#CInquire ID: 10308Range: 0 - 1Default: 0Macro: SetCompressionType(x)SCL Command n/aSendCommand: SendCommand(SL_COMPRESSION, x)
Where x can be:SL_NOCOMPRESSION -- no compressionSL_PACKBITS -- use packbit compression
Comment: This command selects the compression to be used. Supported values are 0 (no compression) and 1 (packed bits). The default is no compression.
Set Number Of ViewsApplies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C X ScanJet 5200C
ScanJet 4p X ScanJet 5p X ScanJet 5100C/4100C X ScanJet 6200C
Command: Set Number of ViewsEscape Sequence: Esc*f#AInquire ID: 10466Range: 1 - 2Default: 1Macro: SetNumberofViews(x)SCL Command n/aSendCommand: SendCommand(SL_NUM_OF_VIEWS, x)
Where x can be either 1 or 2.
Comment: This command will set how many views of the window will be sent by the scanner. The default will be one. Supported values are: 1 = one view, 2 = two views. When two views are enabled, the data for the two views will be sent out interleaved on a line basis dependent on the ratio of their Y resolutions. For example, if view one's Y resolution was 300 and view two's Y resolution was 150, the data would alternate with two lines of view one's image and then one line of view two's image (except at the start; see examples).
The Y resolutions for view 1 and view 2 must be an integer ratio of each other, from a “1 to 9 ratio” to a “9 to 1 ratio.” Examples of all the allowable ratios follow (including their startup sequence):
Example (2 to 1 ratio) output 300 to 150 ratio: 300, 150, 300, 300, 150, 300, 300, 150 ...Example (1 to 2 ratio) output 150 to 300 ratio: 150, 300, 300, 150, 300, 300, 150, 300 ...Example (3 to 1 ratio) output 300 to 100 ratio: 300, 300, 100, 300, 300, 300, 100, 300, 300, 300, 100 ...Example (1 to 3 ratio) output 100 to 300 ratio: 300, 100, 300, 300, 300, 100, 300, 300, 300, 100, 300 ...Example (4 to 1 ratio) output 300 to 75 ratio: 300, 300, 75, 300, 300, 300, 300, 75, 300, 300, 300 ...Example (1 to 4 ratio) output 75 to 300 ratio: 300, 75, 300, 300, 300, 300, 75, 300, 300, 300, 300 ...Example (5 to 1 ratio) output 300 to 60 ratio: 300, 300, 300, 60, 300, 300, 300, 300, 300, 60, 300 ...Example (1 to 5 ratio) output 60 to 300 ratio: 300, 300, 60, 300, 300, 300, 300, 300, 60, 300, 300 ...Example (6 to 1 ratio) output 300 to 50 ratio: 300, 300, 300, 50, 300, 300, 300, 300, 300, 300, 50 ...Example (1 to 6 ratio) output 50 to 300 ratio: 300, 300, 50, 300, 300, 300, 300, 300, 300, 50, 300 ...Example (7 to 1 ratio) output 300 to 43 ratio: 300, 300, 300, 300, 43, 300, 300, 300, 300, 300, 300, 300, 43, 300 ...Example (1 to 7 ratio) output 43 to 300 ratio: 300, 300, 300, 43, 300, 300, 300, 300, 300, 300, 300, 43, 300, ...Example (8 to 1 ratio) output 300 to 60 ratio: 300, 300, 300, 300, 38, 300, 300, 300, 300, 300, 300, 300, 300, 38, 300, ...Example (1 to 8 ratio) output 60 to 300 ratio: 300, 300, 300, 38, 300, 300, 300, 300, 300, 300, 300, 300, 38, 300 ...Example (9 to 1 ratio) output 300 to 60 ratio: 300, 300, 300, 300, 300, 33, 300, 300, 300, 300, 300, 300, 300, 300, 300, 33, 300 ...Example (1 to 9 ratio) output 60 to 300 ratio: 300, 300, 300, 300, 33, 300, 300, 300, 300, 300, 300, 300, 300, 300, 33, 300 ...
As stated in the preceding example Dual View scanning is intended to be used to acquire both a color and grayscale (or black and white) image. However, you can set the same data type (for example, 24-bit color) for both views. If you choose the same data type the image ratio must be no greater than a “2 to 1 ratio” (i.e., 1:1, 1:2, or 2:1). You will get unexpected results if the data type is color for both views and the image ratio is not one of these three ratios.
If both views are set, the Default Matrix and Tone Maps are dependent on the image types and the ratio of the X resolutions of the two views as shown below. In the following table, 3c represents three color channels and 1m represents one mono channel. Scans of just view 2 are not allowed.
View One View Two Into Buffer Matrix (default) Tone MapColor Threshold 3 c + 1 m NTSC, Green RGB + m
4, 8, Dithered 3 c (SS*) NTSC RGB + m3 c + 1 m (CS+) NTSC, Green RGB + m
Color 3 c (SCL limit) NTSC RGB4, 8-bit gray Color 3 c (SS*) NTSC m + RGB
3 c (CS+) Green, NTSC m + RGBThreshold 3 c + 1 m NTSC, Green m + g4, 8, Dithered 3 c (SS*) NTSC m + g
3 c + 1 m (LS+) NTSC, Green m + gThreshold Color m + 3 c Green, NTSC m + RGB
Threshold m Green mThreshold m + m (SS+) Green, Green m + g4, 8, Dithered m + 3 c Green, NTSC m + g
SS* -- if the scaling between the two images (in x) is less than or equal to a factor of 2
LS+ -- if the scaling between the two images (in x) is greater than a factor of 2 (the higher resolution image would use the mono channel)
CS+ -- if the scaling between the two images (in x) is greater than a factor of 2 (the gray scale image would use the mono channel)
Scaling is defined as:
( x-resolution[a] * x-scale[a] ) / ( x-resolution[b] * x-scale[b] )
Where a is the higher of the two products.
Note: The SCL library now has a function to handle scanning with two views, called DualScan. For more information, see Chapter 4: The SCL C Library starting on page 85.
Set ViewApplies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C X ScanJet 5200C
ScanJet 4p X ScanJet 5p X ScanJet 5100C/4100C X ScanJet 6200C
Command: Set View Escape Sequence: Esc*f#BInquire ID: 10467Range: 0 - 1Default: 0Macro: SetViewType (x)SCL Command n/aSendCommand: SendCommand (SL_VIEW_TYPE, x)
Where x can be:0 - This is view one.1 - This is view two.
Comment: Use this command to set scanner settings for the view or views you want to work with. You must set the view before choosing the scanner settings. This command selects which view the subsequent SCL commands or inquires refer to. Supported values are 0 (view 1) and 1 (view 2). The default is view 1. The parameters for view 2 can be set even if only one view is currently selected. Maximum and Minimum values do not change with different views. The following SCL commands and inquires are dependent on which view is selected
83Set Output Data Type and Inquire Present Data Type (page 46)84Set Data Width and Inquire Present Data Width (page 47)85Set X Resolution and Inquire Present X Resolution (page 34)86Set Y Resolution and Inquire Present Y Resolution (page 35)87Set X Scale Factor and Inquire Present X-scale (page 36)88Set Y Scale Factor and Inquire Present Y-scale (page 37)89Set B/W Dither Pattern and Inquire Present B/W Dither Pattern (page 48)90Set Tone Map and Inquire Present Tone Map (page 52)91Set Compression and Inquire Present Compression (page 62)92Set Matrix Coefficients and Inquire Present Matrix (page 50)93Set Contrast Level and Inquire Present Contrast (page 56)94Set Intensity Level and Inquire present Intensity (page 54)95Set Byte Order and Inquire Present Byte Order (page 62)96Inverse Image and Inquire Present Inverse Image (page 53)97Inquire Bytes Per Scan Line (page 70)98Inquire Pixels Per Scan Line (page 68)99Inquire Number of Scan Lines (page 70)
If view two is selected and a parameter setting command that does not have a definition for view two is sent, the command is ignored. If view two is selected and an SCL action command is sent, that action will occur (an action command is any command that causes the scanner to do something: scan, recalibrate, etc.). If view two is selected and an inquire is requested for a command that doesn't have a view two parameter, view one's value is sent.
As stated in the previous section, Dual View scanning is intended to be used to acquire two views: a low resolution color (for a graphics image) view and a higher resolution grayscale (for text) view. However, you can set the same data type (for example, 24-bit color) for both views. If you choose the same data type, the image ratio must be no greater than a “2 to 1 ratio” (i.e., 1:1, 1:2, or 2:1). You will get unexpected results if the data type is color for both views and the image ratio is not one of these three ratios.
Examples:View 1 selected View 2 selected
Set Xpos Sets Xpos (view1) No change to XposScan (action) Scans ScansSet Data Type Sets Data Type (view1) Sets Data Type (view2)Inquire Xpos Returns Xpos (view1) Returns Xpos (view2) Inquire Date Code Returns Date Code Returns Date CodeInquire Data Type Returns Data Type (view1) Returns Data Type (view2)
The two views can have different Y resolutions. However, the Y resolution of the lower resolution view may be automatically changed/modified by the scanner hardware. To determine the actual Y resolution of a dual view scan, send an Inquire Y Resolution Command for each view (at least for the lower resolution view) to the scanner.
The two views can also have different X resolutions. As in the case of the different Y resolutions, the X resolution of the lower resolution view may be automatically changed/modified by the scanner hardware. To determine the actual X resolution of a dual scan view, send an Inquire X Resolution Command for each view (at least for the lower resolution view) to the scanner.
Each view can also have different matrices, Tone Maps, data types, data widths, etc. (with some restrictions that are covered in later sections).
For scanners supporting two views, the following parameters must be set the same for both views. See Command Summary and Support starting on page 159 for proper parameter ranges.
100Mirror101Auto Background102X Location103Y Location104X Extent105Y Extent106Lamp107Scan Bar Position108All downloading parameters109All calibration parameters110Speed Mode111Max Lines Per Buffer
Inquire CommandsBuilding lookup tables of allowable parameters for each command and for each scanner begins to consume a significant portion of your code. An alternative method, one that will allow some upwards compatibility with new features of new scanners as HP releases them can be accomplished with the INQUIRE commands.
Note: The INQUIRE Commands for the ADF are contained within the ADF Reference Section.
Inquire Present ValueCommand: Inquire Present ValueEscape Sequence: Esc * s $ RReturn: Esc * s $ p # VNull Response: Esc * s $ p NSCL Function: InquireNumber(param, type, variable)
Purpose: This command is used to read back the present values of parameters that can be set with various SCL commands. An inquiry number is placed in the value field to identify which parameter is being requested. To find the Inquiry ID for each command, see Inquire Summary and Support starting on page 161.
If the value field of an Inquiry command is not recognized, a null response is returned, but no error is generated. If the host sends the scanner any command after an Inquiry command before reading the response to the inquiry, the response is lost.
Example: See Inquire Minimum Value on page 67.
Inquire Minimum ValueCommand: Inquire Minimum ValueEscape Sequence: Esc * s $LReturns: Esc * s $k # VNull Response: Esc * s $kNSCL Function: InquireNumber(param, type, variable)
Purpose: This command is identical to the Inquire Present Value command except that the minimum allowable value for the specified parameter is returned. If the parameter is a scale factor, the minimum allowable value is calculated based on the current settings of the associated SCL parameters.
Example: #include "scanner.h"
#include "host.h"
#include <stdio.h>
main()
{
INT16 LowXres;
INT16 HiXres;
INT16 NomXres;
INT16 Model;
InquireModel(&Model);
InquireNumber(SL_X_RESOLUTION, SL_LO, &LowXres);
InquireNumber(SL_X_RESOLUTION, SL_HI, &HiXres);
InquireNumber(SL_X_RESOLUTION, SL_NOM, &NomXres);
printf("\nFor the Scanner Model %d: ",Model);
printf("\n Lowest X Res: %d", LowXres);
printf("\n Highest X Res: %d", HiXres);
printf("\n Current X Res: %d", NomXres);
printf("\n");
exit(0);
}Inquire Maximum ValueCommand: Inquire Maximum ValueEscape Sequence: Esc * s $HReturn: Esc * s $g # VNull Response: Esc * s $g NSCL Function: InquireNumber(param, type, variable)
Purpose: This command is identical to the Inquire Present Value command except that the maximum allowable value for the specified parameter is returned. If the parameter is a scale factor, the maximum allowable value is calculated based on the current settings of the associated SCL parameters.
Example: See Inquire Minimum Value on page 67.
Inquire Device ParameterCommand: Inquire Device ParameterEscape Sequence: Esc * s $ EReturn: Esc * s $d # VNull Response: Esc * s $d NSCL Function:
Purpose: This command is used to determine characteristics of the scanner or of the current window. The value field defines the characteristic being inquired.
Inquire Pixels Per Scan LineCommand: Inquire Pixels Per Scan LineEscape Sequence: Esc * s 1024 EReturn: Esc * s 1024d # VSCL Function:
Purpose: This command can be used to determine the number of pixels per scan line that is returned if a scan is requested. The number of pixels per scan line is a function of the scan resolution, the X scale factor, and the portion of the X extent which lies within the scannable area. If the X scale factor is outside of the valid range, the minimum or maximum X scale value is used and a Scaling Error is generated.
Inquire Device Pixels Per InchINQUIRE Command: Inquire Device Pixels Per InchEscape Sequence: Esc * s 1028 EReturn: Esc * s 1028d 300VSCL Function:
Purpose: The HP ScanJet scanners always return a value of 300 in response to this escape sequence.
Example: #include "scanner.h"
#include "host.h"#include <stdio.h>
main(){
INT16 WidthPixels, Model;
WidthPixels = 0L;ResetScanner();InquireModel(&Model);InquireNumber(SL_PIXELS_PER_LINE, SL_NOM, &WidthPixels);
printf("\nFor the Scanner Model %d: ",Model);printf("\n Width in Pixels: %d”, WidthPixels);printf("\n");exit(0);
}
See Also: Dimensional Units on page 7
Inquire Native Optical ResolutionCommand: Inquire Native Optical ResolutionEscape Sequence: Esc * s 1029 EReturn: Esc * s 1029d #VSCL Function: INT16 Value;
InquireNumber(SL_OPTICAL_RES, SL_NOM, &Value);
Purpose: This command is used for descriptive purposes only, and the value returned does not relate to any other commands.
For the response values for each scanner, see Inquire Summary and Support starting on page 161.
Inquire Bytes Per Scan LineCommand: Inquire Bytes Per Scan LineEscape Sequence: Esc * s 1025 EReturn: Esc * s 1025d #VSCL Function: InquireNumber(SL_BYTES_PER_LINE, SL_NOM, WidthBytes);
Purpose: This command determines the number of bytes per scan line that is returned if a scan is requested. A scan line always ends on a byte boundary and, sometimes, on a three-byte boundary. Therefore, it is possible that the last byte (or last three bytes) includes some padding bits. The number of bytes per scan line is a function of the scan resolution, the X scale factor, the portion of the X-extent which lies within the scannable area, the number of bits per pixel, and the format of the data stream.
Errors: If the X scale factor is outside of the valid range, the minimum or maximum X scale value is used and a Scaling Error is generated.
Inquire Number of Scan LinesCommand: Inquire Number of Scan Lines Escape Sequence: Esc * s 1026 EReturn: Esc * s 1026d #VSCL Function: InquireNumber(SL_LINES_PER_SCAN, SL_NOM, Lines)
Purpose: This command determines the number of scan lines that is returned if a scan is requested. The number of scan lines is a function of the scan resolution, the Y scale factor, and the portion of the Y-extent which lies within the scannable area.
The total number of bytes transmitted for a scan can be determined by requesting the number of bytes per scan line and the number of scan lines and then multiplying the two numbers.
Errors: If the Y scale factor is outside of the valid range, the minimum or maximum Y scale value is used and a Scaling Error is generated.
Inquire Firmware Date CodeCommand: Inquire Firmware Date CodeEscape Sequence: Esc * s 4 EReturn: Esc * s 4d4w [data(4 chars)]SCL Function: InquireNumber(SL_DATE_CODE, SL_NOM,
Datecode)
Purpose: This escape sequence causes the scanner to return a 4-digit number which is the firmware date code. The HP convention for date codes is that the two left digits are the years since 1960 and the two right digits are the week of the year, starting with 01 for the first week of the year. For example, the week beginning with January 6, 1986 would be represented as 2602.
Inquire HP Model NumberAll scanners will respond to all model number inquires. The scanner either returns a model number, or it returns a NULL response. The following tables show both the model number and null responses for each command. For all of the inquires a scanner returns a model number to, see Inquire Summary and Support starting on page 161.
It is recommended that your future code rely less on inquiring model numbers and more on populating the ScanState structure with minimal, maximum and nominal parameter values. For now you will still need to check the model number to determine if the scanner is a Color or Black and White scanner, unless you inquire the data types available.
Inquire HP Model Number 1Command: Inquire HP Model Number 1Escape Sequence: Esc * s 3 EReturns: HP ScanJet - Esc * s 3 d 5 W 9 1 9 0 A
HP ScanJet + - Esc * s 3 d 5 W 9 1 9 5 ANull Response - Esc * s 1 0 d N
Inquire HP Model Number 2Command: Inquire HP Model Number 2Escape Sequence: Esc * s 10 EReturns: HP ScanJet IIc - Esc * s 1 0 d 5 W 1 7 5 0 A
Null Response - Esc * s 1 0 d N
Inquire HP Model Number 3Command: Inquire HP Model Number 3Escape Sequence: Esc * s 9 EReturns: HP ScanJet IIp - Esc * s 9 d W 1 7 9 0 A
Null Response - Esc * s 9 d N
Note: The HP ScanJet IIc scanner returns a model number to two model number commands, HP Model Number 1 and HP Model Number 2, meaning it has some support for the command set each model number represents. For HP Model Number 1, HP ScanJet IIc scanner returns 9195A. For HP Model Number 2, HP ScanJet IIc scanner returns 1750A.
The HP ScanJet IIp scanner returns a model number to two model number commands, HP Model Number 1 and HP Model Number 3, meaning it has some support for the command set each model number represents. For HP Model Number 1, HP ScanJet IIp scanner returns 9195A. For HP Model Number 3, HP ScanJet IIp scanner returns 1790A. For the response of other scanners, see Inquire Summary and Support starting on page 161.
Inquire HP Model Number 4Command: Inquire HP Model Number 4Escape Sequence: Esc * s 11 ERange: HP ScanJet IIcx - Esc * s 11 d W 2 5 0 0 A
Null Response - Esc * s 11 d N
Inquire HP Model Number 5Command: Inquire HP Model Number 5Escape Sequence: Esc * s 12 ERange: HP ScanJet 3c/4c/6100C - Esc * s 12 d W 2 5 2 0 A
Null Response - Esc * s 12 d N
The return escape sequence for all model 5 scanners (6100C, 4c, and 3c) is identical.
Inquire HP Model Number 6Command: Inquire HP Model Number 6Escape Sequence: Esc * s 14 ERange: HP ScanJet 3p - Esc * s 14 d W 2 5 7 0 A
Null Response - Esc * s 14 d N
Inquire HP Model Number 8Command: Inquire HP Model Number 8Escape Sequence: Esc * s 15 ERange: HP ScanJet 4p - Esc * s 15 d W 1 1 3 0 A
Null Response - Esc * s 15 d N
Inquire HP Model Number 9Command: Inquire HP Model Number 9Escape Sequence: Esc * s 16 ERange: HP ScanJet 5p - Esc * s 16 d W 5 1 1 0 A
HP ScanJet 5100C - Esc * s 16 d W 5 1 9 0 AHP ScanJet 4100C - Esc * s 16 d W 6 2 9 0 ANull Response - Esc * s 16 d N
Inquire HP Model Number 14Command: Inquire HP Model Number 14Escape Sequence: Esc * s 21 ERange: HP ScanJet 6200C - Esc * s 21 d W 6270 A
Null Response - Esc * s 21 d N
Inquire HP Model Number 16Command: Inquire HP Model Number 16Escape Sequence: Esc * s 31 ERange: HP ScanJet 5200C - Esc * s 31 d W 7190 A
Null Response - Esc * s 31 d N
Inquire Auto-FilteringCommand: Inquire Auto-FilteringEscape Sequence: Esc * s 1031 E
Inquire Auto Speed ModeCommand: Inquire Auto Speed ModeEscape Sequence: Esc*s1040E
This command will return a value corresponding to the speed mode selected. Depending on the scanner the possible return values are:
Value SCL Constant0 SL_AUTO_SPEED_MODE1 SL_SLOW_SPEED_MODE (Not supported by all scanners)2 SL_NORMAL_SPEED_MODE3 SL_FAST_SPEED_MODE4 SL_EXTRA_FAST_SPEED_MODE (Not supported by all scanners)
See Also: Inquire Summary and Support starting on page 161
Automatic Document Feeder SCL CommandsAlso refer to Automatic Document Feeder Capabilites starting on page 18, and Command Summary and Support starting on page 159.
SCL ResetSee SCL Reset starting on page 30.
Scan WindowSee Scan Window starting on page 32.
ADF Scan WindowCommand: ADF Scan Window Escape Sequence: Esc * u 0 S Scanners: See Command Summary and Support starting on page 159
Comment: Causes the device to scan the area defined by the Scan Window, with the assumption that the paper was placed on the platen by the ADF.
The value field must always be 0. It is assumed that the paper is placed on the platen in the ADF position that is offset from the "Document Set Mark" (2 mm in the X-direction and 2.4 mm in the Y-direction).
No load/unload operations are performed in response to this command. The ADF Scan Window Command is used solely in conjunction with the Change Document and Unload Document Commands.
The scan operation occurs in response to the ADF Scan Window Command, even if there is a Document Feeder Jam Error on the SCL error stack.
Errors: The ADF Scan Window Command never generates a Document Feeder Jam error, nor clears that error (unless a new error replaces the old one).
Very similar to the Scan Window Command (page 32), this command causes the device to scan the area defined by the scan window. A window position must be within the scannable area but may have an extent beyond the scannable area. However, when the window is scanned, data is returned only for the portion of the window that lies within the scannable area.
If the requested X scale or Y scale value is outside of the valid scaling range, the minimum or maximum valid scale factor is used and a Scaling Error is generated.
If the scanning carriage does not return to home position (Y = 0), the scan is aborted and a Home Position Missing Error is generated. If a downloadable Dither Pattern or Tone Map or Coefficient Matrix has been selected but not downloaded, a Dither ID Error or Tone Map ID Error or Matrix ID Error is generated, and the default Dither Pattern or Tone Map or Coefficient Matrix is used for the scan. A lamp calibration is done before each scan, and if the lamp intensity is incorrect during any portion of the scan, a Lamp Error is generated.
See Also: Scan Window on page 32.
Change DocumentCommand: Change Document Escape Sequence: Esc * u 0 X Scanners: See Command Summary and Support starting on page 159
Comment: If the document feeder is connected, a load/unload operation is performed: paper is loaded from the input tray onto the platen at the same time any paper already on the platen is unloaded into the output tray. The document feeder does not have to be ready (as defined by the Inquire Document Feeder Ready Command) to start this operation. Paper does not have to be in the input tray.
Errors: If the document feeder senses a paper jam before or during the load/unload operation, the operation is aborted and a Document Feeder Jam error is generated and put on the SCL error stack.
If there is no document feeder connected a Document Feeder Jam Error is generated and put on the SCL error stack.
If there is no paper present in the ADF input tray, or the ADF access hatch is not closed, or the lever is not down, the unload operation only occurs, and a Paper Not Loaded Error is generated and put on the SCL error stack. The scanner does not respond to commands while the unload is occurring. If just an unload is desired, use the Unload Document Command.
If the ADF access hatch is opened, or the lever is switched to the up position after the load/unload operation has started, the operation is aborted and a Document Feeder Jam Error is generated and put on the SCL error stack.
Unload DocumentCommand: Unload DocumentEscape Sequence: Esc * u 0 U Scanners: See Command Summary and Support starting on page 159
Comment: If the document feeder is connected and the ADF is ready to unload as determined by using the Inquire Ready to Unload Command (page 77), an unload operation is performed. No paper is loaded from the input tray, but any paper on the platen is unloaded into the output tray. If there is no document feeder connected, a Document Feeder Jam Error is generated and put on the SCL error stack.
The Unload will occur in the background and the application can go on to issue other SCL commands as soon as the Unload Document Command is issued. A Document Feeder Jam error is reported after the next Change Document Command if it is still detected.
Errors: If the document feeder is not ready to Unload, the unload operation is not started and a Document Feeder Jam Error is generated and put on the SCL error stack.
If the unload operation starts, a Document Feeder Jam Error is not put on the SCL error stack even if one occurs.
ADF Background ChangeCommand: ADF Background ChangeEscape Sequence Esc * u 0 Y
Purpose: This command will cause the ADF to start a Change Document action (unload a page and feed a page from the platen), but will not wait until the Change Process has completed before completing the command — thus, returning control to the application.
Comment: If a Scan Command is subsequently given, turning on the light for the scan will be delayed until the change process is completed. Other commands that will not return until the Change is complete are:
112Light Test113ADF Ready
Set parameter and other commands will be handled normally while the Change Process is operating in the background.
Errors: If a paper jam occurs during the Change Process, the Paper Jam error will not be put on the SCL error stack until the Change is completed. If the light has remained on at a low level after the previous FAST scan, the light will not go off upon receipt of this command.
Automatic Document Feeder InquiresAlso refer to Automatic Document Feeder Capabilites starting on page 18, and Inquire Summary and Support starting on page 161.
Inquire ADF ConnectedCommand: Inquire ADF Connected Escape Sequence: Esc * s 24 EReturns: 0 if no ADF attached to the scanner
1 if an ADF is attached.Scanners: See Inquire Summary and Support starting on page 161
Purpose: Determine if an ADF is attached to the scanner.
Comment: In this inquiry a 1 is returned if an Automatic Document Feeder is connected to the scanner; otherwise, a 0 is returned. A 0 may also be returned if the scanner firmware cannot talk reliably to the ADF firmware.
You should use this inquiry before using any other ADF inquiries or commands; if the ADF is not connected, this inquiry will respond the fastest. Other inquiries and commands will use longer timeouts when trying to talk to the ADF, because they assume the ADF is connected.
Inquire ADF ReadyCommand: Inquire Document Feeder ReadyEscape Sequence: Esc * s 1027 E Returns: 0 means ADF not ready to load paper
1 means ADF is readyScanners: See Inquire Summary and Support starting on page 161
Purpose: Determine if the ADF is ready to load paper.
Comment: Use this escape sequence to determine if the Automatic Document Feeder is ready to load paper. If a 0 is returned, the ADF is not ready to load paper. A 1 is returned only if all the following conditions are true:
114The ADF unit is connected.115Paper is present in the ADF input tray.116The ADF access hatch is closed. (Only flat-bed ADFs).117The ADF is in the down position. 118The ADF does not currently sense a paper jam.119The ADF lever is down (only flat-bed ADFs).
Inquire Paper in ADF BinCommand: Inquire Paper in ADF BinEscape Sequence: Esc * s 25 E Returns: 0 means NO paper has been detected
1 means paper has been detectedScanners: See Inquire Summary and Support starting on page 161
Purpose: Determine if the paper has been loaded in the ADF.
Comment: none
Inquire ADF Open Since Last Change/ScanCommand: Inquire ADF Open Since Last Change/ScanEscape Sequence: Esc * s 26 EReturns: 0 means ADF was detected in the DOWN position
1 means ADF was detected in the UP positionScanners: See Inquire Summary and Support starting on page 161
Purpose: Determine if the ADF has been lifted by the user.
Comment: This inquiry returns a 1 if the ADF was detected in the up position at any time since the last ADF Scan Window (page 73), Scan Window (page 32), or Change Document Command (page 74) completed, and a 0 otherwise.
Note: This command is valid even if the ADF is not used to load the paper.
See Also: The Transparency Adapter starting on page 21 and Transparency Adapter SCL Commands starting on page 78.
Inquire Ready to UnloadCommand: Inquire Ready to UnloadEscape Sequence: Esc * s 27 EReturns: 0 means ADF is not ready to unload paper
1 means ADF is ready to unload paperScanners: See Inquire Summary and Support starting on page 161
Purpose: Determine if the flat-bed ADF is ready to unload
Comment: Use this escape sequence to determine if the Automatic Document Feeder is ready to do an unload operation. If a 0 is returned, the ADF is not ready to unload the paper currently on the platen. A 1 is returned only if all the following conditions are true:
120The ADF unit is connected.121The ADF is in the down position.122The ADF does not currently sense a paper jam.
Transparency Adapter SCL CommandsAlso refer to The Transparency Adapter starting on page 21, and Command Summary and Support starting on page 159.
SCL ResetSee SCL Reset starting on page 30.
Scan WindowSee Scan Window starting on page 32.
Transparency Adapter Scan WindowCommand: Transparency Adapter Scan WindowEscape Sequence Esc * u 0 DInquiry: n/aRange: n/aDefaults: n/aMacro: n/aSendCommand: SendCommand(SL_XPA_SCAN, x);
Where x must be 0.
Purpose: Causes the scanner to scan the defined area using the Transparency Adapter as the light source.
Comment: This command causes the scanner to scan the area defined by the Scan Window with the assumption that the object to be scanned is transparent and the light used should come from above rather than from the scanner light. Calibration will take place according to the parameters set using the Set Calibration Y-Start (page 79) and Set Calibration Strip Parameters (page 80) Commands. If the Transparency Adapter is detected (not necessarily ready) and is not disabled by the Transparency Adapter Disable/Enable (page 80), the Transparency Adapter light is turned on (either before or after the calibration, depending if the calibration is done on the scan bed or the white strip). The scan is then performed with the scanner light off. The Transparency Adapter light is turned off at the end of the scan, or if an interruption to the scan occurred, or if 5 minutes of inactivity has been detected on the SCSI bus.
This command still assumes the original (0,0) reference point. The application developers are encouraged to set the a virtual (0,0) reference 1.75" (525 pixels) down from the original reference point.
If a FAST data mode is detected the Transparency Adapter will still scan, but will assume a data mode similar to the normal mode of the same data type.
Errors: Errors generated from this command are similar to those generated by the Scan Window Command (page 32). If the requested X scale or Y scale value is outside of the valid scaling range the minimum or maximum valid scale factor is used and a Scaling Error is generated. If the scan bar does not return to home position (y=0) the scan is aborted and a Home Position Missing Error is generated. If a downloadable Dither Pattern or Tone Map or Coefficient Matrix has been selected but not downloaded, a Dither ID Error or Tone Map ID Error or Matrix ID Error will be generated, and the Default Dither Pattern or Tone Map or Coefficient Matrix will be used for the scan.
A calibration scan will be done before the scan of the window and if the calibration area is blocked, a Gross Calibration Error will be generated.
Note: In the HP ScanJet 4p, 5p, 4100C, 5100C, 5200C and 6200C scanners, this command does not attempt to find or use an HP Transparency Adapter. However, it will permit scanning with the carriage lamp off. The associated command of setting the calibration y-position (Esc*u#A) also remains intact.
See Also: Scan Window on page 32
Light Source TestCommand: Light Source TestEscape Sequence Esc * f # LRange: 0 = Off
1 = OnDefaults: 0Macro: SetLamp(x)SendCommand:
Purpose: Some scanning operations may require the lamp to turn on and remain on for some extended period. This command facilitates such operations.
Comment: The Transparency Adapter Light is turned on when the Transparency Adapter as connected, ready, and enabled. Otherwise the scanner light will be turned on. A value of 0 will turn off whichever light is on. If the scanner has been on for 5 minutes and no activity has been detected on the bus, whichever light was on will be turned off.
Set Calibration Y-StartCommand: Set Calibration Y-StartEscape Sequence: Esc * u # AInquire ID: 10946Range: -1 (default) calibrate on white strip
>=0 calibrate starting # (300dpi) pixels into the scan areaDefaults: n/aMacro:SendCommand:
Purpose: Set the calibration area.
Comment: This command will set up the calibration area for future scans. The calibration area can be anywhere in the user scan area except the last 100 (300dpi) pixels.
Set Calibration Strip ParametersCommand: Set Calibration Strip ParametersEscape Sequence: Esc * u # CInquire ID:Range: -1 = Download Parameters
0 = Auto-Select (default)1 = Default for Normal Scan2 = Default for Transparency Scan
Defaults: 0Macro:SendCommand:
Purpose: Specify the actual color of the calibration area.
Comment: Selects the set of parameters to be used when building the calibration tables. The parameters are associated with the color of the expected calibration area.
The 256 gray (or RGB) values returned by the scanner vary between the offset ("dark current" value set at factory) and the reference value. The reference value is set via lamp calibration. Setting #=1, the white strip silkscreened to the glass is the reference using the scanner lamp. Setting #=2 uses the transparency lamp passing through the calibration area in the top 1.75" of the glass. If you set #=-1 you intend to use your own area on the glass for calibration.
Use the Download Binary Data Command (page 59) to send down a three-byte value, each byte representing the R, B, G channel value "desired". Use the Upload Binary Data Command (page 60) to check the values. Use the Set Calibration Y-Start Command (page 79) to set the calibration area.
Errors: If the unit cannot calibrate (calibration area blocked), a Gross Calibration Error will be generated. If the scanner cannot achieve calibration, i.e., the color of the calibration strip is too far out of range, the scan will be corrupted.
Transparency Adapter Disable/EnableCommand: Transparency Adapter Disable/EnableEscape Sequence: Esc * u # HInquire ID: 10953Range: 0 = Enable Transparency Adapter for normal functioning (if present)
1 = Disable Transparency Adapter from functioningDefaults: 0Macro:SendCommand:
Purpose: Enable/Disable the Transparency Adapter
Comment: This command will not change the result of the Inquire Transparency Adapter Connected Command (page 81), but WILL change the result of the Inquire Transparency Adapter Ready Command (page 81). If Disabled (1) is the current parameter, it will prevent the Transparency Adapter from being used during a Scan Window (page 32) or Transparency Scan Window Command because the Transparency Adapter will NOT be seen as READY. The default is Enabled (0) which will allow the Transparency Adapter to be used if it is in the READY state.
Transparency Adapter Inquiry CommandsAlso refer to The Transparency Adapter starting on page 21, and Inquire Summary and Support starting on page 161.
Inquire Transparency Adapter ConnectedCommand: Inquire Transparency Adapter ConnectedEscape Sequence: Esc * s 28 eReturns: Esc*s28d#V
# = 1 or yes# = 0 or no
Macro: InquireNumber(param, type, variable)
Purpose and Comment: A one is returned if a Transparency Adapter is connected to the scanner AND is powered ON, otherwise a zero is returned. A zero may also be returned if the scanner firmware cannot talk reliably to the Transparency Adapter firmware.
It is advantageous to use this inquiry before trying to use any other Transparency Adapter inquires or commands because if the Transparency Adapter is NOT connected, this inquiry will respond the fastest. Other inquires and commands will use longer time-outs when trying to talk to the Transparency Adapter because they assume that the it is connected.
Inquire Transparency Adapter ReadyCommand: Inquire Transparency Adapter ReadyEscape Sequence: Esc * s 30 eReturns: Esc*s30d#V
# = 1 or yes# = 0 or no
Macro: InquireNumber(param, type, variable)
Purpose and Comment: This escape sequence can be used to determine if the Transparency Adapter is ready for a scan. If a zero is returned, the Transparency Adapter is NOT ready. A one is only returned under the following conditions:
6A Transparency Adapter unit is connected to the scanner7The Transparency Adapter is powered ON (the LED is lit)8The Transparency Adapter firmware can talk reliably to the scanner firmware 9The Transparency Adapter is not DISABLED by the Transparency Adapter Enable/Disable Command10The Transparency Adapter is in the DOWN position.
Inquire ADF/Transparency Adapter Open Since Last Change/ScanCommand: Inquire ADF/Transparency Adapter Open Since Last Change/ScanEscape Sequence: Esc * s 26 eReturns: Esc*s26d#V
# = 1 or yes# = 0 or no
Macro: InquireNumber(param, type, variable)
Purpose and Comment: Returns a one if the ADF or Transparency Adapter has been detected to be in the UP position at any time since the last SCAN or CHANGE DOCUMENT Command was issued, otherwise a zero is returned.
Error ReportingWhen an error condition is detected by an SCL device, an integer error number is generated and pushed onto a last-in-first-out error stack which can be read by the host. HP scanners hold only the most recent error number in the error stack. Your application can read the most recent error and the oldest error since the last Reset or Clear errors command.
Error Stack InformationThe error stack information maintained by HP scanners include the following:
Error StackThe error number of the most recent error. The HP ScanJet scanners support only one position in the stack.
Oldest Error ReportThe error number of the earliest error to occur since the last time there was a reset or the errors were cleared. This number may also be recorded in the error stack, but can be read without affecting the Current Error Stack Depth. This item is cleared only with Reset or Clear Errors SCL commands, or a SCSI Reset.
Current Stack DepthThis is 1 if an error is recorded in the stack, or 0 if no error has occurred since the last Reset or Clear Errors commands, or a SCSI Reset.
The following steps are taken when an error is detected:0An error number is generated.1If the Current Stack Depth has a value of 0, the new error number is recorded as the Oldest Error Report.2The new error number is entered on the error stack, replacing any error which may be there, and the Current
Stack Depth is set to 1.
The following sections describe the commands for manipulating and reading the data items. For a summary of commands and responses, see Inquire Summary and Support starting on page 161.
Error InquiriesInquire Maximum Error Stack DepthCommand: Inquire Maximum Error Stack DepthEscape Sequence: Esc * s 256 E
Purpose: This command causes the scanner to return a value of 1.
Inquire Current Error Stack DepthCommand: Inquire Current Error Stack DepthEscape Sequence: Esc * s 257 E
Purpose: When the scanner receives this command, it returns a 1 if an error has occurred since the last Reset or Clear Errors command, or in the case of HP ScanJet IIc scanner, a SCSI Reset. Otherwise, a 0 is returned.
Read Current Error NumberCommand: Read Current Error NumberEscape Sequence: Esc * s 259 E
Purpose: This command causes the device to return the error number of the current error. Use of this command does not cause the error to be cleared. If the Current Stack Depth is 0 (i.e., there have been no errors since the last Reset or Clear Errors Command, or SCSI Reset), the null response is returned (Esc*s259dN). The Current Error Number can be cleared with Reset or Clear Errors Command, or a SCSI Reset.
Read Oldest ErrorCommand: Read Oldest ErrorEscape Sequence: Esc * s 261 E
Purpose: This command causes the device to return the Oldest Error Number. Use of this command does not cause the error to be cleared. The Oldest Error Number is cleared with Reset or Clear Errors Commands, or a SCSI Reset.
If there has been no error since the last time errors were cleared, the device returns a null response (Esc*s261dN).
Clear ErrorsCommand: Clear ErrorsEscape Sequence: Esc * o E
Purpose: This command causes the following actions:
123Clears the error stack.124Resets Current Stack Depth to zero.125Clears Oldest Error Number.
Error NumbersThe following errors can be reported.
Error Number MeaningCommand Format Error 0 Escape sequence has illegal format.Unrecognized Command 1 Escape sequence has proper format, but function not
supported.Parameter Error 2 Parameter value out of legal bounds.Illegal Window 3 Window and scannable area do not intersect.Scaling Error 4 Scale factor out of bounds.Dither ID Error 5 A Downloadable Dither Pattern was selected but not
downloaded before requesting a dithered scan. Tone Map ID Error 6 A Downloadable Tone Map was selected but not
downloaded before requesting a scan.Lamp Error 7 The lamp did not achieve the required intensity for
proper scanning.Matrix ID Error 8 A Downloadable Coefficient Matrix was selected
but not downloaded before requesting a scan.Cal Strip Param Error 9 Set of Downloadable Calibration Strip parameters
were selected, but was not downloaded before the scan.
Gross Calibration Error 10 The scanner could not calibrate a substantial number of pixels.
Document Feeder Jam 1024 Paper jam in the document feeder (see also Automatic Document Feeder starting on page 18).
Home Position Missing 1025 Scanner element failed to return to home position.Paper Not Loaded 1026 Change document was executed, but no paper was
in the ADF input bin.
Chapter 4: The SCL C Library
IntroductionThis part of the reference section provides more details on the Scanner Control Language (SCL) Library. The library services all HP flatbed scanners. Source code is provided for those developing on operating systems that cannot use a Windows DLL.
Scanner Control Language Library FilesThe Scanner Library is divided into three main source code files:
SCANNER.C Contains high level scanner functions. SCL.C Contains the SCL interpreter which provides
the building blocks for the functions in the SCANNER.C file.
WINSCAN.C Contains very low level I/O procedures for reading from and writing data to the scanner.
Figure Lib-1a. The Scanner Library, 16-bit Windows
Figure Lib-1b. The Scanner Library, 32-bit Windows
The following is a list of the files included in the Scanner Library with additional information about their contents.
WINSCAN.C
This source code is a custom I/O Windows module.
HOST.H
This include file contains the system independent typedefs.
Note: This file needs to be modified to reflect the development environment before compiling the Scanner Library. Or, you can add the appropriate define to the preprocessor section.
SCANNER.C
This module contains procedures that perform high-level scanner operations useful for creating scanning applications. Many of the calls perform error checking and seamlessly support the HP ScanJet scanners.
SCANNER.H
This is the include file for the Scanner Library. This file contains command and error definitions, scanner data structure typedefs, procedure definitions, scanner command macros, and other useful scanner defines.
SCL.C
This module is the SCL command interpreter. These procedures are designed to allow a programmer to build command or inquire strings, send commands, parse scanner responses, and inquire model, error, or parameter values from the scanner. These procedures are the basic building blocks for the procedures found in the SCANNER.C module. Usually, there is no need to call these procedures directly from an application program.
Scanner.h and scl.c are used in HP's internal software development and scanner testing as well as in this toolkit. Certain commands are built into the SCL library but are diagnostic in nature and available only within HP. It is for this reason that you will find a command table
static SCL_TABLE SCL[] =
and references to
pTablepDiagnosticTableSCL
Diagnostic commands are not available outside of the Greeley Hardcopy Division.
How to Use the Scanner LibraryThe Scanner Library provides the raw tools to communicate with a Hewlett-Packard scanner, but the application must still provide the frame-work within which those tools are used. Figure Lib-2 and the following text supplies the application programmer with a sequence of steps to use for correct and efficient communication with the scanner. Issues such as how to initialize the scanner, and error handling and recovery are addressed by this section. Figure Lib-2 also provides some good scanner programming examples and techniques.
The material presented in this section relies heavily on information contained in the rest of this document. It may be advantageous to read through this section quickly for general understanding and return later to gain more insight after reading the rest of the document.
Scanning ProcessResetScanner should be the first call made to the Scanner Library. This procedure will check the I/O channel to ensure that it is properly installed and reset the scanner's parameter values back to their original power-on state.
GetScanState may be called next so that the default values can be recorded into the SCANSTATE structure. If the application interacts directly with the user, SL_LO and SL_HI values for all the scanner parameters should also be inquired so that these ranges may be presented to the user. Parameterized operation of the scanner is preferred since it will allow the application to work with future scanner products.
A typical sequence for configuring the scanner would begin with a call to InquireOldestError. This procedure determines if the scanner is communicating properly and clears out any errors which are currently logged by the scanner. If this call returns either a SL_BADACCESS, SL_BADRESPONSE, or SL_NULLRESPONSE, something is wrong with the communication link and/or the scanner and continuing with the configuration is probably useless. Other errors reported should be ignored since they were left by previous scanner transactions.
Now that the scanner is in a known good state, the scanner can be configured. The configuration process may be composed of a single transaction when a predefined scan is to be done, or multiple transactions when an interactive user interface has been implemented. A transaction is composed of individual or compound commands to set the scan parameters and inquires to check the results. If any value sent exceeds a scan parameter's valid range, the scanner will log an error and limit the value stored to the appropriate boundary value or keep the currently stored parameter value depending on the type of scan parameter being set. Populating the SCANSTATE Structure and calling SetScanState function is a quick way to download the scanner settings.
At the end of any configuration transaction, a call should be made to InquireOldestError. This will determine the scanner error state and clean up the error stack if necessary. Scanner status checks between each command and/or inquire are unnecessary.
Figure Lib-2. The Scanning Process
Once the configuration is complete the scanning process can begin. GetScanInfo should be called at this point to determine the amount and format of the scanned data, the scanner model number, and Automatic Document Feeder (ADF) capability. The ADF capability is ON if the ADF is installed and ready, paper is loaded, and no SL_ADFJAM errors are currently logged by the scanner. If the ADF capability is ON, the scanning process will automatically feed the next sheet and scan it; otherwise, the scan will be taken from the scanner bed.
Note: Never attempt to determine the size of the data to be returned. The scanner upon inquiry will tell you the number of scan lines, bytes per line, and size of scan. The values are determined from the data type, bit depth, sampling (resolution and scaling) and window size. Since certain configurations result in split bytes, the scanner will elect to pad data. And because certain scanners use integer arithmetic, the scanner’s results may be different than a calculation you make externally.
The Scan call starts the scan process. The scanned data is read into memory through this call. The scanning process may be done in a single read or in multiple reads, depending on the amount of memory allocated by the application.
Note: You should attempt to read in as large a data chunk as possible. Small reads (say, as small as the bytes/line value, will incur a lot of overhead, and thus degrade performance significantly.
If an ADF is being used to perform the scanning task, the status needs to be checked immediately after the scan to determine if an SL_ADFJAM has been recorded.
Library ErrorsThe error numbers reported by the Scanner Library are defined in the scanner.h include file. These errors may be customized if desired to fit into the error reporting scheme used by any application. The process for doing this is quite simple and is described below.
The scanner library errors can be divided into two categories: Communication Errors and Scanner Errors. Communication errors are generated by the library's SCL interpreter code to report problems in generating commands, transferring data, or parsing responses. Scanner errors report the contents of the Scanner Error Stack, which is determined by inquiring the information directly from the scanner.
status = ScannerCommand(arg, arg)
If the operation was successful, status will return OKAY.
SL_NOACCESS I/O channel not installed properly.SL_BADACCESS Data transfer terminated in error.SL_BADCOMMAND String was sent to the InquireNumber procedure, or a value
inquire was sent to the InquireString procedure.SL_BADRESPONSE Inquire response not properly formatted by the scanner.SL_NULLRESPONSE An inquire for nonsupported parameter was received by the
scanner.SL_BUSY Another application has exclusive access to the scanner.
Table Lib-1: Communication Errors
SL_ADFEMPTY No paper is loaded in the ADF.SL_ADFJAM Paper jam in the document feeder.SL_BADCMDFORMAT Escape sequence has illegal format.SL_DITHERERROR A downloadable Dither Pattern was selected but not downloaded
before requesting a dithered scan.SL_GROSSCALIB The scanner could not calibrate a substantial number of pixels.SL_HOMEMISSING Scanner element failed to return to the home position.SL_ILLEGALCMD Escape sequence has proper format but the function is not
supported. SL_ILLEGALWND Scan window specified and the scannable area do not intersect.SL_LAMPERROR The lamp did not reach the required intensity for proper scanning.SL_MATRIXERROR Matrix coefficients were selected but not downloaded before
scanning.SL_PARAMERROR Parameter value out of bounds.SL_SCALEERROR Scale factor out of bounds.SL_SCANERROR Unrecognized error reported by the scanner.SL_TONEMAPERROR A downloadable Tone Map was selected but not downloaded before
scanning.
Table Lib-2. Scanner Errors
When the Scanner Library reports an error, it maps the error into a corresponding reporting number as defined in the SCANNER.H file. Therefore, errors may be redefined to fit into any error reporting scheme, they may be ignored by changing the error reporting number to OKAY, or they may be grouped together by using the same reporting number for several errors.
Library TypedefsThe Scanner Library was designed using system independent typedefs in place of the standard C types. This was done to facilitate code portability to the various development environments supported. Below is a list of the typedefs used and their meanings.
INT8 a signed 8-bit integerUINT8 an unsigned 8-bit integerINT16 a signed 16-bit integer
UINT16 an unsigned 16-bit integerINT32 a signed 32-bit integer
UINT32 an unsigned 32-bit integerPINT8 a pointer to a signed 8-bit integer
PUINT8 a pointer to an unsigned 8-bit integerPINT16 a pointer to a signed 16-bit integer
PUINT16 a pointer to an unsigned 16-bit integerPINT32 a pointer to a signed 32-bit integer
PUINT32 a pointer to an unsigned 32-bit integer
Table Lib-3. Library Typedefs
Compound CommandsA compound command is a list of several commands placed into the same buffer and sent to the scanner as a single transaction. This technique reduces the system overhead by eliminating open and close operations for each separate command. You may create a compound command by using the BuildCommand call found in the SCL.C source code file. Once the compound command has been constructed, the command sequence may be sent to the scanner via the SendToScanner call found in the WINSCAN.C source code file. Obviously this technique does not work when you are inquiring value or string information from the scanner. For an example of the BuildCommand call, see the Upload function in SCANNER.C or the SendCommand function in SCL.C.
SCANNER.C Entry PointsThe procedures in this code module provide a general programming interface for any scanning application. The entry points into SCANNER.C have been divided up into three separate groups. The first group is made up of those entry points that interact with the library-defined data structures. The second group is made up of those that set a single or group of scanner parameter values. Many of these calls are implemented as macro defines in the SCANNER.H file to ease software integration. The third group of entry points contains miscellaneous utility procedures.
Data Structure CallsThree data structures are defined by the Scanner Library for general use. These structures provide a convenient way of organizing the scan parameters. The SCANWINDOW structure stores the type and physical boundaries of the scan window. The SL_PIXEL window measures distances in 300 dpi device pixels. If the type is SL_DECIPOINT, the unit of measure is 1/720 of an inch. The SCANINFO structure contains information which specifies the amount of scanned data that can be expected to be received as well as the model number and ADF capability. The SCANSTATE structure contains, in addition to the two other structures, the values of all the scan parameters. This last data structure contains all the scanner information needed by an application program.
typedef struct{ INT16 Units; // Units of scan window. SL_PIXEL or SL_DECIPOINT.
INT16 X: // X coordinate. Upper lefthand corner of the scan window.INT16 Y; // Y coordinate. Upper lefthand corner of the scan window.INT16 Xextent; // Width of the scan window.INT16 Yextent; // Height of the scan
} SCANWINDOW;
typedef struct{
INT16 Model: // Scanner model.INT16 ADF; // Determines if the ADF is ready, OFF / ON.INT16 WidthPixels; // Width of the scan data in pixels.INT16 WidthBytes; // Width of the scan data in bytes.INT16 Lines; // Height of the scan data in pixels.INT32 Size; // Total size of the scan data in bytes.
} SCANINFO;
// SCANSTATE represents all key information on the state of // the scannertypedef struct{
INT16 DataType; // Data type of the scanned data.INT16 DitherPattern; // Pattern to be used for dithering.INT16 Intensity; // Intensity value -darker, +lighter.INT16 Contrast; // Contrast value, -softer, +sharper.INT16 Negative; // Negative mode, OFF/ONINT16 Mirror; // Mirror mode, OFF/ONINT16 AutoBack; // Autobackground mode, OFF/ONINT16 Xresolution; // dpi in the horizontal direction.INT16 Yresolution; // dpi in the vertical direction.INT16 Xscale; // Percent scaling in horizontal directionINT16 Yscale; // Percent scaling in vertical directionINT16 PixelBits; // Bits per pixel.SCANINFO Info; // SCANINFO data structure defined aboveSCANWINDOW Window; // SCANWINDOW data structure defined aboveINT16 ColorDitherPattern; // Dithering color patternINT16 MatrixCoef; // Matrix Coefficients used during scanINT16 ToneMap; // Tone map to be used during scanINT16 Filter; // Color filter to be used during scanINT16 NumViews; // One or two viewsINT16 CurrentView; // Current view selectedINT16 Compression; // Type of compressionINT16 Reserved[4]; // Reserved for future use
} SCANSTATE;
The following procedures use the data structures defined above. The "p" designation indicates that a pointer to the structure is passed to the procedure. These procedures have been implemented with a very complete error-checking scheme. They will clear the scanner error stack and return the oldest error detected on exit. They are also written to identify the different scanner models and correctly set the scan parameters. Because of these two features, the following procedures are highly recommended for use in any application.
GetScanInfoINT16 FP GetScanInfo(PSCANINFO pScanInfo);
Fills the SCANINFO structure provided with values which specify the dimensions of the scan data, the model number, and ADF capability. The ADF capability depends on an ADF being connected and ready, with paper in the tray, and no SL_ADFJAM errors logged by the scanner.
GetScanStateINT16 FP GetScanState(PSCANSTATE pScanState, UINT16 Kind, UINT16 Units);
Fills the SCANSTATE structure provided with all the current scan parameter values. The Kind parameter determines whether the SL_LO, SL_NOM, or SL_HI scanner parameter values are to be returned. The Units parameter selects the scan window's unit of measurement and can be either SL_PIXEL or SL_DECIPOINT. This parameter overrides the Units field found in the SCANWINDOW data structure.
SetScanStateINT16 FP SetScanState(PSCANSTATE pScanState, UINT16 Units);
Sets all the scan parameters to the values specified in the SCANSTATE structure. The Units parameter selects the scan window's unit of measurement and can be either SL_PIXEL or SL_DECIPOINT. This parameter overrides the Units field of the SCANWINDOW data structure.
SetScanWindowINT16 FP SetScanWindow(PSCANWINDOW pScanWindow, UINT16 Units);
This procedure sets the scan area to the dimensions specified by the SCANWINDOW structure. The measurement unit is specified by the Units parameter and can be either SL_PIXEL or SL_DECIPOINT. This parameter overrides the Units field of the SCANWINDOW data structure.
Utility Calls (SCANNER.C)The calls in this group perform various utility functions. These calls are not supported by all scanners. The majority of the calls listed below do not inquire status directly from the scanner; only communication errors are returned. Scanner errors generated by those procedures will remain logged in the scanner until explicitly cleared. The procedure descriptions listed below will indicate which procedures provide additional error checking capability.
ColorINT16 FP Color(INT16 Bits);
Parameters:
Bits - The number of color bits-per-pixel.
Sets the scanner DataType to SL_COLOR and sets the bits-per-pixel. For a list of the number of bits-per-pixel (data widths) supported on a particular scanner, see Command Summary and Support starting on page 159.
ColorDitherINT16 FP ColorDither(INT16 Pat);
Parameters:
Pat - The Color Dither Pattern to use.SL_USER_DEFINED - User downloaded pattern.SL_DEF_COLOR - User color default pattern.
11 Sets the scanner DataType to SL_COLOR_DITHER and sets the Dither Pattern to the one specified. For a list of the scanners that support color dithering, see Command Summary and Support starting on page 159.
ColorThresholdINT16 FP ColorThreshold(void);
Sets the scanner DataType to SL_COLOR_THRESHOLD. For a list of the scanners that support color thresholding, see Command Summary and Support starting on page 159.
CommandInquireINT16 FP CommandInquire(UINT16 Command, INT16 Value, PINT16 pInquire);
Parameters:
Command - The command ID specifying the command to be created.Value - The value to be sent to the scanner.pInquire - Pointer to the value returned by the scanner.
Performs an entire Command, Inquire, Status sequence for one scanner parameter value. The pInquire parameter is a pointer to the location to receive the value which the scanner has returned. This number may not equal the value originally sent if it lies outside the legal value range of the scan command. When this happens, the scanner stores a value which is either the minimum or maximum, if this is a range parameter, or retains the current value, if this is a value parameter. The scanner error stack will be cleared and the oldest error will be returned by the procedure on exit.
DitherINT16 FP Dither(INT16 Pat);
Parameters:
Pat - The Dither Pattern to be used.
Sets the scanner DataType to SL_DITHER and the Dither Pattern to the one specified. Supported Dither Patterns are SL_USER_DEFINED, SL_COARSE_FATTING, SL_FINE_FATTING, SL_BAYER, and SL_VERTICAL_LINE. The SL_USER_DEFINED Dither Pattern is not supported by the HP ScanJet (HP 9190A) scanner. Specifying this Dither Pattern with the HP ScanJet (HP 9190A) will generate an SL_PARAMERROR in the scanner.
DownloadINT16 FP Download(INT16 Kind, PUINT8 pBuffer);
Parameters:
Kind - The type of download to be performed.pBuffer Pointer to the buffer containing the download data.
Sets the user-defined Tone Map, Matrix Coefficients, or B/W or Color Dither Pattern to the one contained in the buffer. pBuffer is a pointer to the data to be downloaded. This feature is not supported by the HP ScanJet (HP 9190A). For a list of the download types supported on the remaining HP scanners, see Download Binary in Command Summary and Support starting on page 159.
GrayScaleINT16 FP GrayScale(INT16 Bits);
Parameters:
Bits - The number of grayscale bits-per-pixel.
Sets the scanner DataType to SL_GRAYSCALE and sets the bits-per-pixel. For the HP ScanJet 5100C if the bits are not set to 4 then a SL_PARAMERROR will be generated. To find out which scanners support each data width, see Set Data Width in Command Summary and Support starting on page 159.
ResetScannerINT16 FP ResetScanner(void);
This procedure performs three functions. First, it determines if the I/O channel is properly installed. If not, it returns an SL_NOACCESS error. When finished, if an SL_BADACCESS error is returned, it means that the transfer terminated in an error state. It then resets all the scan parameter values back to their default power-on values. Finally, it clears the scanner error stack.
ScanINT16 FP Scan(INT16 Phase, PUINT8 pBuffer, INT32 Length, PINT32 pReceived);
Parameters:
Phase - Flag indicating if this is the first transfer in a sequence or a following additional buffer transfer.
pBuffer - Pointer to the buffer to receive the data.Length - Number of bytes requested from the scanner.pReceived - Pointer to the actual number of bytes received from the scanner.
This procedure initializes a scan process and transfers data from the scanner. The first call of any scan must have the Phase set to SL_SCAN, SL_FIRST or SL_ADF_SCAN so that the error stack may be cleared and the scan process initialized. Each subsequent call of a scan must have the Phase set to SL_NEXT. This skips the initialization step and continues the data transmission process.
Note: Theoretically you could request the whole buffer size (pBuffer) from Scan(), but the scanner can scan at faster rates then the SCSI bus can transfer. To accommodate this it would be best to request blocks of scan data (Length) 64K or less at one time using the SL_FIRST and SL_NEXT Phase in a Scan() function loop. (Refer to Appendix C: Frequently Asked Questions starting on page 167 for a code example.)
DualScanSome HP ScanJet scanners allow acquisition of two views of data simultaneously. While the region of the scan is the same, the data types and resolutions of the two views can vary. The limits on the variables set on the two views are described with the SetViewType macro.
INT16 DualScan(INT16 Phase, PUINT8 pBufferView0, INT32 LengthView0, PINT32 pReceivedView0, PUINT8 pBufferView1, INT32 LengthView1, PINT32 pReceivedView1);
Parameters:
Phase - Flag indicating if this is the first transfer in a sequence. Must be one of the following values:SL_FIRST or SL_SCAN - The first buffer in the transfer.SL_ADF_SCAN - The first buffer in an ADF transfer. (For supported
scanners.) SL_NEXT - Each additional buffer transfer.
pBufferView0 - Pointer to view 0 data buffer to receive the data.LengthView0 - Size of the view 0 data buffer in bytes.pReceivedView0 - Pointer to the actual number of bytes received from the scanner for view 0.pBufferView1 - Pointer to view 1 data buffer to receive the data.LengthView1 - Size of the view 1 data buffer in bytes.pReceivedView1 - Pointer to the actual number of bytes received from the scanner for view 1.
This function is nearly identical to the Scan() function, except that it supports the dual view mode of the scanner.
Defaults: Some of the default settings for the two views of a scan are:
View 1 View 2
Black and White Threshold Color1 bit/pixel 24 bits/pixel300 dpi X and Y resolution 100 dpi X and Y ResolutionX Extent 2550 pixels X Extent 2550 pixelsY Extent 3508 pixels Y Extent 3508 pixelsdo a full page scan do a full page scan
See SCL Reset starting on page 30 for a complete list of defaults.
Example: See the dualdata.exe sample program located in the TK10\SAMPLE\32BIT\MFC\DUALDATA directory for an example.
See Also: Set Number Of Views on page 63 and Set View on page 65.
ThresholdINT16 FP Threshold(void);
Sets the scanner DataType to SL_THRESHOLD.
UploadINT16 FP Upload(INT16 Kind, PUINT8 pBuffer, INT16 Length, PINT16 pReceived);
Parameters:
Kind - The type of upload to be performed.pBuffer - Pointer to the data buffer to receive the data.Length - Size of the data buffer in bytes.pReceived - Pointer to the actual number of bytes received from the scanner.
Gets the currently selected Tone Map, matrix coefficients, B/W or Color Dither Pattern and loads it into the buffer provided. The pReceived parameter is a pointer to the location where the procedure places the number of bytes actually received. The Length limits the number of bytes which will be received from the scanner. This feature is not supported by the HP ScanJet (HP 9190A). The HP ScanJet + and HP ScanJet IIp (HP 9195A and HP 1790) only support a user-defined Tone Map and B/W Dither Pattern.
SetDecipointWindowINT16 FP SetDecipointWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent);
Parameters:
X - The X coordinate of the upper left hand corner.Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in decipoints.Yextent - The height of the window in decipoints.
This function sets the current scan window position and dimensions in decipoint units.
Note: scanners after the HP ScanJet 4p will not support decipoints.
SetPixelWindowINT16 FP SetPixelWindow(INT16 X, INT16 Y, INT16 Xextent, INT16 Yextent);
Parameters:
X - The X coordinate of the upper left hand corner.Y - The Y coordinate of the upper left hand corner.Xextent - The width of the window in device pixels.Yextent - The height of the window in device pixels.
This function sets the current scan window position and dimensions in device pixels.
SetResolutionINT16 FP SetResolution(INT16 Xresolution, INT16 Yresolution);
Parameters:
Xresolution - The new resolution in dots-per-inch in the x direction.Yresolution - The new resolution in dots-per-inch in the y direction.
This function sets the scanning resolution for the scan window.
SetScaleINT16 FP SetScale(INT16 Xscale, INT16 Yscale);
Parameters:
Xscale - The percent of scaling in the x-dimension.Yscale - The percent of scaling in the y-dimension.
This function sets the percent scaling in the x and y dimensions for the scan window.
SCL.C Entry PointsThe following procedures comprise the SCL interpreter. These are more advanced library calls and require working knowledge of the scanner and Scanner Command Language protocol to use properly. These procedures provide enhanced performance capabilities which may be needed if an interactive scanner user interface is being implemented. All the procedures in this module return some type of status information. The Build procedures return the length of the string created. The rest of the procedures return communication errors except for InquireOldestError which returns both communication and scanner errors.
BuildCommandINT16 FP BuildCommand(PUINT8 pCmdString, UINT16 Command, INT16 Value);
Parameters:
pCmdString - Pointer to the buffer where the command is built.Command - The command ID specifying the command to be created.Value - The value to be sent in the command.
Creates an SCL command that is ready to send to the scanner and copies it into the location pointed to by pCmdString. The Value parameter is inserted at the '#' place holder in the raw scanner command string. This procedure returns the length of the command string created, excluding the terminating NULL character. If an invalid command number is specified, a value of -1 is returned.
BuildInquireINT16 FP BuildInquire(PUINT8 pInqString, UINT16 Inquire, UINT16 Kind);
Parameters:
pInqString - Pointer to the buffer where the inquire is built.Inquire - The inquire ID specifying the inquire to be created.Kind - The kind of inquire to be done.
Creates an SCL inquire that is ready to send to the scanner and copies it into the location pointed to by pInqString. The Kind parameter determines whether the SL_LO, SL_NOM, or SL_HI value of the scanner parameter is to be requested. This allows parameterized operation of the scanner. This procedure returns the length of the inquire string created, excluding the terminating NULL character. If an invalid inquire number is specified, a value of -1 is returned.
InquireModelINT16 FP InquireModel(PINT16 pModel);
Parameters:
pModel - Pointer to the location where the model number should be placed. Determines the scanner model the library is interacting with. The model number, as defined in the SCANNER.H file, is placed at the location pointed to by pModel. Refer to SCANNER.H for supported model numbers.
InquireNumberINT16 FP InquireNumber(UINT16 Inquire, UINT16 Kind, PINT16 pValue);
Parameters:
Inquire - The inquire which is to be sent to the scanner.Kind - The kind of inquire to be done.pValue - Pointer to where the value should be placed.
Retrieves a parameter value from the scanner. The Kind parameter determines whether the minimum value (SL_LO), current value (SL_NOM), or maximum value (SL_HI) value of the scanner parameter is returned. The value is placed at the location pointed to by pValue. Inquire command numbers that are not valid or are string inquires will be flagged with an SL_BADCOMMAND error. If no errors occur, the return value will be OKAY. In the event of an error, the return value will be SL_BADCOMMAND, SL_BADACCESS, SL_BADRESPONSE, or SL_NULLRESPONSE.
InquireOldestErrorINT16 FP InquireOldestError(void);
Checks the scanner error stack to determine if an error state exists. If it does, the oldest error is retrieved and the error stack is cleared. Scanner errors are mapped into the error-reporting numbers defined in the SCANNER.H file.
InquireStringINT16 FP InquireString(UINT16 Inquire, PUINT8 pString, INT16 Length, PINT16 pReceived);
Parameters:
Inquire - The inquire which is to be sent to the scanner.pString - Pointer to where the string should be placed.Length - The maximum length of the string.pReceived - Pointer to the actual number of bytes received from the scanner.
Retrieves a string from the scanner. The string is placed at the location pointed to by pString. The Length must include enough room for a NULL character at the end. Inquire command numbers which are not valid or are value inquires will be flagged with an SL_BADCOMMAND error. A NULL string is returned in the event of an error.
ReceiveResponseINT16 FP ReceiveResponse(PUINT8 pInqString, PINT16 pValue, INT16 TermChar);
Parameters:
pInqString - Pointer to the inquire command.pValue - Pointer to where the value should be placed.TermChar - The terminating character expected.
This procedure validates and parses a response from the scanner. The pInqString contains the original inquire string which is used for scanner response validation. The value or string character count is placed at the location pointed to by pValue. The TermChar is used to parse the response and may be either SL_VALUECHAR or SL_STRINGCHAR depending on the inquire performed.
SendCommandINT16 FP SendCommand(UINT16 Command, INT16 Value);
Parameters:
Command - The command ID specifying the command to be created.Value - The value to be sent in the command.
This procedure sends a command with the specified Value to the scanner. Command numbers which are not valid will be flagged with an SL_BADCOMMAND error.
WINSCAN.C Entry PointsThe following procedures are WINSCAN.C entry points. There is no reason why the CheckIO, RecFromScanner, and SendToScanner I/O interface procedures should ever need to be called directly from an application program.
CheckIOINT16 FP CheckIO(void);
This procedure determines if the I/O channel is properly installed.
RecFromScannerINT32 FP RecFromScanner(PUINT8 pBuffer, INT32 Length, INT16 TermChar);
Parameters:
pBuffer - Pointer to the buffer containing the data.Length - Number of bytes to send to the scanner.TermChar - Termination character:
SL_VALUECHAR - Terminate on any upper case charSL_STRINGCHAR - Terminate on any upper case charSL_ALLCHAR - Termination is not based on contents
This procedure receives data from the scanner. The procedure will continue to receive data until the Length is satisfied or the TermChar is found. Special termination characters SL_VALUECHAR, SL_STRINGCHAR, and SL_ALLCHAR are defined in the SCANNER.H file. SL_ALLCHAR causes the procedure to disable termination character matching. The return value is the number of bytes received. A return value of -1 indicates that a communication error occurred between the host and the scanner.
SendToScannerINT32 FP SendToScanner(PUINT8 pBuffer, INT32 Length);
Parameters:
pBuffer - Pointer to the buffer containing the data.Length - Number of bytes to send to the scanner.
This procedure transmits data to the scanner. The procedure will continue to transmit data until the Length is satisfied. The return value is the number of bytes transmitted. A return value of -1 indicates that a communication error occurred between the host and the scanner.
ScannerLockINT16 FP ScannerLock(INT16 hWnd, INT16 bLock);
This command gives exclusive access to the scanner.
Parameters:Hwnd -- handle to the window requesting the lock/unlock (exclusive use of scanner)bLock -- locking operation:
0 = UNLOCK Release the scanner for other applications to use. 1 = LOCK Exclusive use of scanner .
This function will obtain exclusive use of the scanner by locking the library (i.e., hpscnmgr.dll or hpsm32s.dll). When the library is locked, all other attempts to lock the library will fail unless the current window has been destroyed. When the scanner is no longer needed, the library should be unlocked.
ScannerLockButtonINT32 FP ScannerLockButton(HWND hWnd, INT16 bLock);
Parameters:hWnd -- Handle to the window requesting the lock/unlock (exclusive use of scanner)bLock -- Locking operation:
0 = UNLOCK Release the scanner for other applications to use.1 = LOCK Exclusive use of scanner. 2 = CLAIM If CLAIM is specified the routine will try to get the scanner on which a
button was pressed.
This is a new function that was added with the release of the HP ScanJet 5p. It is still backwards compatible to older scanners because you can still use a 0 or 1 to unlock and lock the library (i.e., hpscnmgr.dll). Using 2 as a parameter helps to lock the library for the exclusive use of the scanner that has had its button pressed.
This function will obtain exclusive use of the scanner by locking the library. When the library is locked, all other attempts to lock the library will fail unless the current window has been destroyed. When the scanner is no longer needed, the library should be unlocked.
ButtonPollINT32 FP ButtonPoll(void);
This routine checks to see if the green Scan button on the front of certain scanners (like the HP ScanJet 5p scanner) has been pressed. The scanner manager is loaded if necessary (i.e., hpscnmgr.dll). If ButtonPoll returns with a positive number the button has been pressed. Otherwise the button has not been pressed.
ClearButtonINT32 FP ClearButton(void);
This routine clears the button state on scanners with the Green Scan Button on the front of the scanner. The scanner manager is loaded if necessary (i.e. hpscnmgr.dll).
32-bit Library and SCL for Windows 9x and Windows NTSee Chapter 7: 32-bit Libraries and Drivers starting on page 111 for more details.
Library Portability The Scanner Control Library has been designed for system independence and portability. To that end, the code has been written with system-independent typedefs and no reliance on any runtime or dynamic link libraries. The port to another computer system or environment may require modification of the system-independent typedefs found in the HOST.H file and a rewrite of the scanner I/O module. The scanner I/O module has five entry points that need to be supported, CheckIO, SendToScanner, ButtonPoll, ClearButton, and RecFromScanner. A description of the procedure specifications and the parameters passed to them may be found in the WINSCAN.C source code file.
Scanner Control Library CommandsFor a complete list of scanner commands and definitions, see SCANNER.H. The Scanner Library, through its procedures and macros, should provide the programmer with all the necessary functionality required to create a full-function scanning application. The SCL interpreter procedures found in the SCL.C file may be used to create any unique command sequences required.
Chapter 5: Hardware and Software Sharpening
IntroductionTwo methods of sharpening are provided in this toolkit. Hardware Sharpening, which is supported by some scanners, is provided through a .DLL, .LIB, and a .H file. Software Sharpening source code is provided for use on other scanners and for operating systems that cannot use a Windows DLL.
Hardware Sharpening is supported on:
Applies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C X ScanJet 5200C
X ScanJet 4p X ScanJet 5p X ScanJet 4100C/5100C X ScanJet 6200C
The code for hardware or software sharpening is located in TK10\SHARPEN\HARDWARE or TK10\SHARPEN\SOFTWARE directories on the toolkit. There is also a COMMON directory that contains a common .H file (shrptran.h) to the hardware and software source code.
Software Sharpening DLL: hpswtran.dllHardware Sharpening DLL: hphwtran.dllCommon .H file: shrptran.h
To use the hardware or software sharpening in your program, you must:
126Include the shrptran.h in the source files127Link the appropriate .lib (hpswtran.lib or hphwtran.lib) into your project, or use LoadLibrary to load the DLL.
As you will see below, there are several different levels of sharpening: none, slight, medium, strong, and extra strong.
See Also: SHARPSDK.EXE starting on page 155. The sample code is located in TK10\SAMPLE\32BIT\SDK\SHARPSDK.
Note: SCL provides only 32-bit DLLs for software and hardware sharpening. 16-Bit DLLs for sharpening are not provided.
Sharpening Routines
SetSharpeningvoid SetSharpening(INT32 NewSharpenLevel);
Set the level of sharpening that the Sharpen call will use.
Parameters:NewSharpenLevel New level of sharpening. Must be one of:
SL_SHARPEN_NONESL_SHARPEN_SLIGHTSL_SHARPEN_MEDIUMSL_SHARPEN_STRONGSL_SHARPEN_EXSTRONG
Returns:N/A
InitSharpenTransformINT16 InitSharpenTransform(PSCANSTATE pScanState);
Initialize sharpening transforms with the scanner parameters in pScanState. Before you scan the image, call this function to initialize the transforms. If you wish to scan and sharpen another image, you must call this function again to initialize the transforms before you scan and sharpen the new image.
Parameters:pScanState -- scanner state when image is scanned. Can be obtained with GetScanState.
Returns:OKAY if no errors.
ERROR if incoming data type is incorrect, or if insufficient memory.
Sharpenvoid Sharpen(INT32 View,
PUINT8 pBuffer,INT32 Length,INT16 Phase,INT32 MoreDataInBuffer);
Sharpen the data in pBuffer at the level defined by SetSharpening.
Parameters:View Which scan view did the data come frompBuffer Data to be sharpenedLength Length of data to be sharpened.Phase Same as defined in Scan function. On the first buffer in image specify SL_FIRST,
follow with SL_NEXT on subsequent buffers.MoreDataInBuffer If the buffer has more image data than just Length worth, specify the remaining
amount of data here. If no more data is available in the buffer, this value should be 0.
Returns:N/A
Chapter 6: HP ScanJet Button Manager
IntroductionThe HP ScanJet Button Manager is a tool that allows application developers to “link” their application to the SCAN button on the front of the scanner. So, when a user presses the SCAN button, one of two actions happens automatically:
12Your application is started.13A Button Manager window pop ups, letting the user choose the default application. Once set, this application will be started each time the user presses the SCAN button.
Installation
Button Manager FilesThe following files are needed for the HP ScanJet Button Manager to function properly:
32-bit Applications 16-bit Applicationsreg32.dll reg16.dllreg32.lib reg16.libregdll.h regdll.hhpsjbmgr.exe
Note: 32-bit applications can be run on a 32-bit operating system, or on a 16-bit operating system with Win32s installed. 16-bit applications that are running on a 16-bit operating system must have Win32s installed.
The .dll files must be loaded by the application and the .exe files must be running on the system. So, both .dll and .exe files must be installed on the user’s system. To use the HP ScanJet Button Manager in your application:
128Include the appropriate .h file in your source code.129Link the .lib file into your project.
Note: The rest of the SCL libraries must also be loaded in order for the HP ScanJet Button Manager to function properly.
Sample CodeSee LAMPSDK.EXE starting on page 154 for sample HP ScanJet Button Manager code. The sample code is located in SAMPLE\32BIT\SDK\LAMPSDK.
Index 105
Overview
For Application DevelopersTo use the Button Manager with your application, follow these steps:
130To be done once, when your application is installed on a system:131Use InstallLaunchApp to register your application with the Button Manager’s registration database.132If you wish, you can add a Button Manager icon to your program group. This will allow the user to bring
up the Button Manager application selection window anytime.133To be done each time the Button Manager calls your application:
134Use RegisterLaunchApp to register the correct pathname, executable, etc. with Button Manager’s database.
135When the user presses the SCAN button, Button Manager will start your application. Or, if more than one application is registered and no default application is set, the Button Manager will bring up the Button Manager window, allowing the user to set a default application.
136If you wish, you can check the status of the Button Manager using PushLaunchPending (page 109), IsAppAlone (page 109), or CheckPollingState (page 109).
137If you wish, you can remove your application from the registration database using UnregisterLaunchApp (page 108). Or, you can turn off the polling of the Button Manager while keeping your application running by using SetPollingState (page 109).
If a user presses the SCAN button when the default application is running, the Button Manager will send a message to the default application. You must decide how your application will handle this situation (i.e., what happens when a message is received); most applications will probably start another scan.
When the user presses the SCAN button, the default application could already be running or the application will need to be launched. The HP ScanJet Button Manager sends out a "ScannerButton" message when the SCAN button is pressed. At that time, the Button Manager does not know if the default application is running. If the application is running, it will get one "ScannerButton" message from the Button Manager.
If the default application is launched and it registers with the Button Manager database, the Button Manager sends out another "ScannerButton" message. In this situation, the application will end up with two "ScannerButton" messages to deal with.
You must decide how your application will handle the receiving of the messages. One approach would be to ignore the first "ScannerButton" message if your application is in the situation of being launched.
For Button Manager UsersWhen a user presses the SCAN button on the front of the scanner, one of two things will happen: an application will start or the Button Manager window will pop up.
If only one application is registered with the Button Manager, or if a default application has been set, that application will be launched when a user presses the SCAN button.
If more than one application is registered with the Button Manager, and no default application has been set, a window like the following one will pop up. This window is called the Button Manager application selection window:
Use your mouse to choose an application to launch, then click OK. This application will be set as the default application for future scans. To start the application, press the SCAN button on your scanner.
The first check box enables and disables polling of the Scan button. When this box is unchecked the Scan button is ignored.
The second check box toggles the ability to bring up the Button Manager window each time a new application is registered with the registration database, and the SCAN button is pressed by the user.
If the second check box of the Button Manager application selection window is checked, the following dialog box will pop up when a new application is registered with the database and you press the SCAN button:
When you click okay, the Button Manager application selection window will pop up, with the newly registered application(s) in bold.
To bring up the Button Manager application selection window anytime: double-click hpsjbmgr.exe in the File Manager.
Index 107
ReferenceThis section describes the functions and parameters of the HP ScanJet Button Manager that are available for developer use.
Note: Any other functions declared in regdll.h that are not discussed in the following text are for internal HP use only.
InstallLaunchAppUINT FAR PASCAL InstallLaunchApp(LPSTR AppName, LPSTR AppPath);
An application developer should use this function in their installation program to register their application with the third-party registration database.
Parameters:AppName: Name of the application.
AppPath: Path of the application. This path should be a valid, full executable path. If this application is not running and the HP ScanJet Button Manager attempts to notify the application of a button press, the Button Manager will use this path to launch the application.
Returns:Zero (0) if call failed, otherwise non-zero.
RegisterLaunchAppUINT FAR PASCAL RegisterLaunchApp(HWND hWnd, LPSTR AppName, LPSTR AppPath, UINT *Res);
This function is used for when the developer is registering their application with the database at start-up (run) time.
Parameters:hWnd: Window handle to which button notifications will be posted. The HP ScanJet Button Manager will also compare this handle to the handle of the window with focus when the button is pressed and if equal, notification will be sent.AppName: Name of the application. AppPath: Path of application. This path should be a valid, fully executable path. If this application is not running and the Button Manager attempts to notify it of a button press, the Button Manager will use this path to launch the application.Res: Reserved, always NULL
Returns:Zero (0) if call failed. Otherwise, the window’s message ID will be sent when the scanner button is pressed.
UnregisterLaunchAppBOOL FAR PASCAL UnregisterLaunchApp(LPSTR AppName);
Use this function if you want to uninstall registry entries from the database. This function would be used in the application’s uninstall program.
Parameters:AppName: Name of ISV’s application. Should be the same name that the application initially registered with the Button Manager.
Returns: Zero (0) if call failed, or non-zero for success.
PushLaunchPendingBOOL FAR PASCAL PushLaunchPending(LPSTR AppPathName);
Use this function to see if the button has been pressed and the application that you pass it matches the application that was most recently launched.
Parameters:
AppPathName: Path and name of the application executable
Returns:
TRUE (1) if a button press is pending in the system and the application matches the application that was most recently launched, or FALSE (0) if not.
SetPollingStateBOOL FAR PASCAL SetPollingState(BOOL State);
Use this function to disable the polling of the Button Manager, i.e., to turn the ability to launch an application off and on.
Parameters:State:
TRUE - to enable the polling of the Button Manager.FALSE - to disable the polling of the Button Manager.
Returns:Always returns TRUE.
IsAppAloneBOOL IsAppAlone(LPSTR AppPathName);
Use this function to determine if your application is the only application in the registration database.
Parameters:AppPathName: Path and name of Application
Returns:TRUE if AppPathName is the only application in the Button Manager database;FALSE otherwise.
CheckPollingStateBOOL CheckPollingState(void);
Use this function to check if the Button Manager is currently polling. For example, use this function if the Button Manager is polling, and you need to turn the polling off for some reason. You should save off the fact that the Button Manager was polling, disable the Button Manager, perform your tasks, then turn the Button Manager back on.
Parameters:N/A
Returns:TRUE if the Button Manager is actively polling the scanner;FALSE otherwise.
Index 109
Chapter 7: 32-bit Libraries and Drivers
General
Applies ScanJet X ScanJet + X ScanJet IIp X ScanJet 3pto: X ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C X ScanJet 5200C
X ScanJet 4p X ScanJet 5p X ScanJet 5100C/4100C X ScanJet 6200C
Control of the HP ScanJet family is still performed via SCL. However, the path taken by SCL varies according to the operating system environment: Windows 95, Windows NT, or 16/32-bit co-existence. The scanner manager is a technology embedded in a DLL, which provides a uniform interface to the scanner for all supported PC operating systems. For Windows NT, Windows 95 and Windows 98 the scanner manager also includes a control panel applet.
The purpose of the scanner manager is to:
138Provide the appropriate interface layer between the scanning software and the I/O interface services provided by the OS (or HP supplied drivers).
139To keep track of all scanners on the PC, and allow each to be accessed by one and only one application.
The scanner manager has additional responsibilities under Windows 95:
140To provide a list of scanners connected to the PC and set default and current scanners.141To perform scanner tests.142Provide a list of SCSI host adapters and free SCSI addresses for each host adapter.
The scanner manager has additional responsibilities under Windows NT and Windows 98:
143To provide a list of scanners connected to the PC and set default and current scanners.144Perform scanner tests.
Hardware IssuesThe scanner manager’s hardware configuration requirements are the same as those specified by Microsoft for the operating systems supported.
For Win3.1 and WFW3.11:145An ASPI or CAM compliant SCSI host adapter and an HP ScanJet IIc, IIp, IIcx, 3p, 3c/4c/6100C, 4p, or 5p.
The CAM or ASPI driver associated with the host adapter and sjiix.sys are required.146The original HP SCSI card (C1752 or C1753) and an HP ScanJet IIc or IIp. The sjii.sys driver is required.147The HP ScanJet + and interface card (C992090) and sjdriver.sys driver.
For Windows 95:148A SCSI card with a Windows 95 miniport driver and an HP ScanJet IIc, IIp, IIcx, 3p, 3c/4c/6100C, 4p, or 5p.149The microchannel HP SCSI card with no switches (C2503) and an HP ScanJet IIc, IIp , IIcx, 3c, 3p. The
mini400a.sys and sjiix.sys drivers are required.
The original HP SCSI card (C1752 or C1753) and an HP ScanJet IIc or IIp. The sjii.sys driver is required.
For Windows NT 4.0150A SCSI card with a Windows NT miniport driver and an HP ScanJet IIc, IIp, IIcx, 3p, 3c/4c/6100C, 4p, or 5p
is required.151WNASPI32.DLL, ASPI32.SYS, and other files (licensed from Adaptec). See Installing ASPI on Windows 95
or Windows NT 4.0 on page 112 for more details.
HP ScanJet+ scanners and HP SCSI cards other than the C2502 card are supported on Windows NT
ASPI for WIN32ASPI for WIN32 DLLs and other files are needed to run the HP ScanJet scanners properly on Windows 95 and Windows NT. Manual installation of the ASPI for WIN32 drivers is not easy to do. The best way to make sure that ASPI is set up correctly is to install the scanning software that came with the HP ScanJet scanner.
Note: The ASPI for WIN32 drivers are for your development use only. If you wish to distribute the drivers with your completed application, you must contact ADAPTEC for licensing information. See Licensing ASPI on page 3 for more information.
Installing ASPI on Windows 95 or Windows NT 4.06. Use the following steps to manually install the ASPI for WIN32 on Windows 95:7.8. Go to where you have installed the SCL toolkit on your system.9. In the TK10\Drivers\Win9x directory, double click on aspiinst.exe file.10. You will receive a message saying “This utility upgrades ASPI for Windows 95/Windows NT. Do you wish to
continue?” Click “Yes”.11. Click on the “Upgrade” button to begin installing version 4.56 (1001) of ASPI onto your system.12.13. Your ASPI layer should now be up to date.14.
Note: Adaptec also has an executable called ASPICHK.exe that you can use to determine the current version of the ASPI layer that is installed on your system. At the time of this document revision, this executable was available from www.Adaptec.com under Software Upgrades.
Windows 98 and Windows NT 5.0HP scanning software will no longer need to install ASPI for WIN32 files for future versions of the operating systems.
Windows 95
Note: Installation instructions follow this technical discussion.
The scanner manager relies on the scanning software installation program. For Windows 95, SCANJET.INF is provided to be used by the Hardware Installation Wizard and scanning software installation programs. The steps taken by SCANJET.INF for each type of scanner/driver are shown in the table below:
Scanner Interface Files Copied Other Operations
WINDOWS 95 SCSI card (e.g., C2502, C2522)
hpscnmgr.dllhpscnmgr.hlphpscntst.dllhpsjclas.dllhpsj32.dllhpsj1695.dllhpsjrfsh.vxdvhpscand.vxdreg32.dll
Add ScanJet class to registry
Remove sjiix.sys entry from config.sys
Add ScanJet entry to control.ini
Remove win400i.sys and hpscanr.386 entries from system.ini
C2503 hpscnmgr.dllhpscntst.dllhpsjclas.dllhpsj32.dllhpsj1695.dllmini400i.sysreg32.dllsjiix.sys
Add mini400i.sys and sjiix.sys to config.sys
Remove win400i.386 and hpscanr.386 entries from system.ini
C1752/C1753 hpscnmgr.dllhpscntst.dllhpsjclas.dllhpsj32.dllhpsj1695.dllreg32.dllsjii.sys
14Add sjii.sys entry to config.sys
15HP ScanJet + hpscnmgr.dllhpscntst.dllhpsjclas.dllhpsj32.dllhpsj1695.dllreg32.dllsjdriver.sys
16Add sjdriver.sys entry to config.sys
HP C2522 Card (Plug and Play)15. Copy the HPSJCLAS.DLL to the Windows 95 System directory and SCANJET.INF to the WINDOWS 95 INF
directory.16. Use “Add New Hardware” in the Control Panel to add a SCSI controller.
17Set “no” when the Windows 95 asks if you want it to search for new hardware.18Set “SCSI controller” as the hardware type.19Click the “Have Disk…” button when asked to identify the manufacture and model for your new hardware.20Set “Symbios Logic 53416 (HP Version) SCSI Adapter as the model for your new hardware.21Windows 95 will display which resources it plans to use for your new hardware.
17. Turn off the computer. If the card is not already physically in the computer, insert it now. Connect the scanner to the card’s connector. Make sure the scanner is terminated.
18. Turn on the computer. You will be asked for the disk with the drivers on it.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Control Panel, choose the Test tab, and click the desired test button.
HP C2502 Card (ISA without switches)19. Copy HPSJCLAS.DLL to the Windows 95 System directory and SCANJET.INF to the WINDOWS 95 INF
directory.20. Use “Add New Hardware” in the Control Panel to add a SCSI controller.
152Select “no” when Windows 95 asks if you want it to search for new hardware.153Select “SCSI controllers” as the hardware type.154Push the “Have Disk...” button when asked to identify the manufacture and model for your new hardware.155Select “Symbios Logic 53C400A (HP Version) SCSI Adapterä“ as the model for your new hardware.156Windows 95 will display which resources it plans to use for your new hardware.
21. Turn off the computer. If the card is not already physically in the computer, insert it now. Connect the scanner to the card’s connector. Make sure the scanner is terminated.
22. Turn on the computer. You will be asked for the disk with the drivers on it.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
Third-Party SCSI Cards23. Copy HPSJCLAS.DLL to the Windows 95 System directory and SCANJET.INF to the WINDOWS 95 INF
directory.24. Use the “Device Manager” tab in “System” in the Control Panel to verify that a SCSI controller has already been
installed. If not, use “Add New Hardware” in the Control Panel to add the SCSI controller you own. If the SCSI controller you own is not listed as a choice in “Add New Hardware,” you must contact the SCSI controller’s manufacturer to obtain a Windows 95 driver.
25. Turn off the computer. If the card is not already physically in the computer, insert it now. Connect the scanner to the card’s connector. Make sure the scanner is terminated (with the SCSI terminator).
26. Turn on the computer. You will be asked for the disk with the drivers on it.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
HP C2503 Card (MicroChannel without switches)Identify what Input/Output (I/O) region your interface card is using. Consult the documentation that came with your computer to find out how to do this.
27. Copy HPSJCLAS.DLL to the Windows 95 System directory and SCANJET.INF to the Windows 95 INF directory.28. Use “Add New Hardware” in the Control Panel to add a SCSI controller.
157Set “no” when Windows 95 asks if you want it to search for new hardware.158Set “SCSI controllers” as the hardware type.159Push the “Have Disk...” button when asked to identify the manufacture and model for your new hardware.160Set “HP ScanJet on C2503” as the model for your new hardware.161Windows 95 will display which resources it plans to use for you new hardware. If those do not match the
resources your card is set to, do not allow your computer to be shut down. Instead, go to the “Device Manager” tab in “System” in the control panel and modify the resources allocated for the HP ScanJet IIc/IIp on C1752/C1753 to match the card’s settings.
29. Turn off the computer. If the card is not already physically in the computer, insert it now. Connect the scanner to the card’s connector. Turn on the computer.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
HP C1752/C1753 Card (ISA or MicroChannel with switches)30. Identify what memory region the switches on your interface card are set to. Consult the documentation that came
with your scanner to find out how to do this.31. Copy HPSJCLAS.DLL to the Windows 95 System directory and the SCANJET.INF file to the Windows 95 INF
directory.32. Use “Add New Hardware” in the Control Panel to add your scanner and interface card.
162Set “no” when Windows 95 asks if you want it to search for new hardware.163Set “other devices” as the hardware type.164Push the “have disk...” button when asked to identify the manufacturer and model for your new hardware.165Set “HP ScanJet IIc/IIp on C1752/C1753” as the model for your new hardware.166Windows 95 will display which resources it plans to use for you new hardware. If those do not match the
resources your card is set to, do not allow your computer to be shut down. Instead, go to the “Device Manager” tab in “System” in the Control Panel and modify the resources allocated for the HP ScanJet IIc/IIp on C1752/C1753 to match the card’s settings.
33. Turn off the computer. If the card is not already physically in the computer, insert it now. Connect the scanner to the card’s connector. Turn on the computer.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
HP ScanJet + Scanner and Interface Card34. Identify what memory region and interrupt the switches and jumpers on your interface card are set to. Consult the
documentation that came with your scanner to find out how to do this.35. Copy HPSJCLAS.DLL to the Windows 95 System directory and SCANJET.INF to the WINDOWS 95 INF
directory.36. Use “Add New Hardware” in the Control Panel to add your scanner and interface card.37. Set “No” when Windows 95 asks if you want it to search for new hardware.38. Set “Other devices” as the hardware type.39. Push the “Have Disk...” button when asked to identify the manufacturer and model for your new hardware.40. Set ”HP ScanJet-Plus” as the model for your new hardware.
Windows 95 will display which resources it plans to use for your new hardware. If those do not match the resources your card is set to, do not allow your computer to be shut down. Instead, go to the “Device Manager” tab in “System” in the control panel and modify the rescues allocated for the “HP ScanJet +” to match the card’s settings.
41. Turn off the computer. If the card is not already physically in the computer, insert it now. Connect the scanner to the card’s connector. Turn on the computer.
42.Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
HP ScanJet 5100C/5200C Scanners – Parallel ScannersThe following table shows the names of the .inf file and the parallel driver along with the location of the files when installed by the HP Scanning Software installation program.
Windows 95 File LocationEpstw9x.mpd Win95\system\IosubsysEpstw9x.inf Win95\Inf
The scanjet.inf file provided to be used by the Hardware Installation Wizard and scanning software installation programs is also still needed. Please see the table above at the beginning of the Windows 95 section.
To manually install the parallel drivers:
43. Plug in scanner.44. From <drive_letter>:<your_path>\TK10\Drivers\Win9x\copy hpsjclas.dll to the \Win95\System directory and
scanjet.inf to the Win95\Inf directory.45. From <drive_letter>:<your_path>\TK10\Drivers\Win9x\Parallel copy Epstw9x.mpd to the \Win95\system\
Iosubsys directory and Epstw9x.inf to the \Win95\Inf directory.46. From the Windows Control Panel, double click on Add New Hardware.47. Click Next to begin installing your hardware.48. Set “No” when asked if you want it to search for new hardware. Click Next.49. Double click on SCSI Controllers. Select Shuttle Tech under manufacturer then click Next. Then click Finish.50. The system should then find the new scanner.51. When it asks to insert HP Scanning Software CD overwrite the path with the location you have installed the SCL
Toolkit to \TK10\Drivers\Win9x for the location of hpscnmgr.dll and click OK. 52. Your drivers are now installed. From the Windows Control Panel, double click “System” then select the “Device
Manager” tab. Under SCSI Controllers you should see the “HP EPST Parallel SCSI Adapter”. 53. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and
click the desired test button.Note: Communication errors may occur with certain HP DeskJet Printers. (Refer to HP ScanJet 5100C Notes on page 181 for more information.)
HP ScanJet 6200C Scanner – SCSI I/OThe HP ScanJet 6200C is a dual I/O scanner: SCSI and USB. To install the scanner on a Windows 95 system you must have a SCSI card already operational. The following table shows the names of the .inf and driver files, and the location of the files when installed by the HP Scanning Software installation program.
NOTE: Due to operating system restrictions for USB, the toolkit does not provide USB support for Windows 95.
Windows 95 File Locationscanjet.inf Win95\Infhpscnmgr.dll rest of files in Win95\Systemhpsjclas.dllhpscnmgr.hlphpscntst.dllhpsmui.dllhpsj32.dllhpsj1695.dllreg32.dllhpsjrfsh.vxdvhpscand.vxd
In order to install the scanner you must have a functional SCSI card already installed.
To install scanner drivers, copy the above files from the TK10\Drivers\Win9x directory.
54. Copy scanjet.inf to the Windows\Inf directory.55. Copy hpsjclas.dll and hpsmui.dll to the Windows\system directory. 56. Plug in the scanner and reboot.57. New hardware should be found. Point to the SCL toolkit path, Drivers\Win9x when asked to insert HP Scanning
Software CD.The scanner should now be operational
HP ScanJet 4100C/5200C/6200C USB ScannersThe following table shows the names of the .inf and driver files, and the location of the files when installed by the HP Scanning Software installation program.
Windows 95 File Locationscanjet.inf Windows\Infhpsjclas.dll rest of files in Windows\
systemhpscnmgr.dllhpscnmgr.hlphpsjusb.syshpscntst.dllhpsj32.dllhpsj1695.dllreg32.dll
In order to install the USB drivers on your system, USB must be enabled on your system. Your Win95 version needs to be 1214, if not you cannot install USB on this system.
To install USB drivers:
58. Copy TK10\Drivers\Win9x\scanjet.inf to \Windows\Inf directory. Copy TK10\Drivers\Win9x\hpsjclas.dll to \Windows\System directory.
59. Plug in your scanner and reboot.60. When the system asks to insert "HP Scanning Software CD" click OK. Browse to TK10\Drivers\Win9x and click
OK.The scanner should now be operational.
Windows 98
HP ScanJet USB ScannersThe following table shows the names of the .inf and driver files, and the location of the files when installed by the HP Scanning Software installation program.
Windows 98 File Locationhpscan.inf Windows\Infhpsjusd.dll rest of files in Windows\
systemhpscnmgr.dllhpscnmgr.hlphpsmui.dllhpsj32.dllhpsj1695.dllreg32.dllhpsjrreg.exe From Win98 CD
In order to install the USB drivers on your system, USB must be enabled on your system. If this condition is not met, setup.exe will update these for you.
To install USB drivers:
61. Copy TK10\Drivers\Win9x\hpscan.inf to your \Windows\Inf directory (Replace current file if the system asks.).62. Plug in scanner and reboot.63. When system asks for hpscnmgr.dll point it to \TK10\Drivers\Win9x directoryThe scanner should now be operational.
HP ScanJet Parallel ScannersThe following table shows the names of the .inf file and the parallel driver along with the location of the files when installed by the HP Scanning Software installation program.
Windows 98 File LocationEpstw9x.mpd Win98\system\IosubsysEpstw9x.inf Win98\Inf
The scanjet.inf file provided to be used by the Hardware Installation Wizard, and scanning software installation programs, are also still needed. Please see the table above at the beginning of the Windows 95 section.
To manually install the parallel drivers:
64. Plug in scanner.65. From <drive_letter>:<your_path>\TK10\Drivers\Win9x copy hpscan.inf to the Win95\Inf directory.66. From <drive_letter>:<your_path>\TK10\Drivers\Win9x\Parallel copy Epstw9x.mpd to the \Win98\system\
Iosubsys directory and Epstw9x.inf to the \Win98\Inf directory.67. From the Windows Control Panel, double click on Add New Hardware.68. Click Next to begin installing your hardware.69. Set “No” when asked if you want it to search for new hardware. Click Next.70. Double click on SCSI Controllers. Select Shuttle Tech under manufacturer then click Next. Then click Finish.71. The system should then find the new scanner.72. When it asks to insert HP Scanning Software CD overwrite the path with the location you have installed the SCL
Toolkit to <your drive location> \TK10\Drivers\Win9x for the location of hpscnmgr.dll and click OK.
73. Your drivers are now installed. From the Windows Control Panel, double click “System” then select the “Device Manager” tab. Under SCSI Controllers you should see the “HP EPST Parallel SCSI Adapter”.
74. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
Note: Communication errors may occur with certain HP DeskJet Printers. (Refer to HP ScanJet 5100C Notes on page 181 for more information.)
HP ScanJet SCSI ScannerThe following table shows the names of the .inf and driver files, and the location of the files when installed by the HP Scanning Software installation program.
Windows 98 File Locationhpscan.inf Windows\Infhpscnmgr.dll rest of files in Windows\
systemhpscnmgr.hlphpsmui.dllhpsj32.dllreg32.dllhpsjrfsh.vxdhpsjvxd.exehpsjvxd.vxdhpsjrreg.exe
In order to install the scanner you must have a functional SCSI card already installed.
To install scanner drivers copy the above files from the TK10\Drivers\Win9x directory.
75. Copy hpscan.inf to the Windows\Inf directory.76. Reboot.77. Plug in scanner. New hardware should be found. 78. When it asks to insert HP Scanning Software CD overwrite the path with the location you have installed the SCL
Toolkit to <your drive location> \TK10\Drivers\Win9x for the location of hpscnmgr.dll and click OK.
The scanner should now be operational.
Windows NT 4.0
Note: The HP ScanJet and HP ScanJet + scanners will not work under NT. To use other HP ScanJet scanners with Windows NT, the following files must be manually installed:
Scanner Interface Files Copied
Windows NT SCSI Card hpscnmgr.dllhpscnmgr.hlphpscntst.dllhpsj32.dll
The HP ScanJet SCSI interface cards C2502-66500 and C2503-66500 also work.
HP C2522 CardTo manually install the drivers for the HP C2522 card on Windows NT 4.0:
79. Find an available interrupt (run Win NT Diagnostics in the Administrative tools group). The valid choices are 4, 5, 7, 10, 12, or 15. If none are available try to reassign the interrupt for one of the conflicting devices. If you cannot, then you must use another SCSI card.
80. Set the IRQ number for the C2522 card to the number identified from step 1.81. From the Control Panel, run SCSI Adapters and select the Drivers tab.82. Click the Add button.83. In the Install Driver dialog box, click the Have disk… button.
The Install from disk dialog box appears.84. Make sure that the toolkit is installed on your drive and overwrite the path with <driveletter>:\TK10\Drivers\
Winnt\C2522\ and click OK.The Install Driver dialog box appears.
85. Select the Symbios Logic 53C416 (HP Version) SCSI Host Adapter and click OK.The WINDOWS NT SETUP dialog box appears, asking for the full path to the OEM SCSI adapter files.
86. Make sure the path is correct and click Continue.The SYSTEM SETTINGS CHANGE dialog box appears.
87. Click Yes to restart your computer. If you have not yet physically added the card to your computer, do so now.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
To disable the drivers:
88. From the Windows Control Panel, run SCSI Adapters and select the Drivers tab.89. Select the Symbios Logic 53C416 (HP Version) SCSI Host Adapter.90. Click the Remove button.91. Click OK in the Remove Driver dialog box.92. Click OK to close the SCSI Adapter dialog box.
HP C2502 Card (ISA without switches)To manually install the drivers for the HPC2502 card on Windows NT 4.0:
93. Find an available interrupt (run Win NT Diagnostics in the Administrative tools group). The valid choices are 3, 4, 5, 7, or 9 . If none are available try to reassign the interrupt for one of the conflicting devices. If you cannot, then you must use another SCSI card.
94. Set the IRQ number for the C2502 card to the number identified from step 1.95. From the Control Panel, run SCSI Adapters and select the Drivers tab.96. Click the Add button.97. In the Install Driver dialog box, push the Have disk… button.
The Install from disk dialog box appears.98. Overwrite the path with <drive letter>:\TK10\Drivers\Winnt\C2502\ and click OK.
The Install driver dialog box appears.99. Select the Symbios Logic 400a (HP Version) SCSI Host Adapter and click OK.
The WINDOWS NT SETUP dialog box appears, asking for the full path to the OEM SCSI adapter files. Make sure the path is correct and click Continue.The SYSTEM SETTINGS CHANGE dialog box appears.
100.Click Yes to restart your computer. If you have not yet physically added the card to your computer, do so now.
Your drivers are now installed. To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
To disable the drivers:
101.From the Windows Control Panel, run SCSI Adapters and select the Drivers tab.102.Select the Symbios Logic 53C416 (HP Version) SCSI Host Adapter. 103.Click the Remove button.104.Click OK in the Remove Driver dialog box.105.Click OK to close the SCSI Adapter dialog box.
Third-Party SCSI CardsHP scanners work with most third party SCSI cards under NT. See File Placements starting on page 125 to check if the DLLs and other files are located in the correct places.
HP ScanJet 5100C/5200C Scanner – A Parallel ScannerThe following table shows the names of the parallel driver files and the location they need to reside in order to install them onto your system.
Windows NTEpstwnt.mpd \<windowsNT>\system32\driversSharshtl.sys \<windowsNT>\system32\driversSharshtw.exe \<windowsNT>\system32\drivers
To manually install the parallel drivers:
106.Copy Epstwnt.mpd, Sharshtl.sys, and Sharshtw.exe into your \<windowsNT>\system32\drivers directory.107.From a DOS prompt, cd to the \<windowsNT>\system32\drivers directory and execute the following:
Sharshtw –install Epstwnt108.This will install the driver by creating the registry entries.109.If you want to obtain HP ScanJet Scanner Control Panel you will need to make a registry addition and have the
ASPI layer current (Refer to ASPI for WIN32 on page 112 for information on ASPI update). 110.Copy HP files to correct location as designated in File Placements on page 125.111.From Start Menu do Run and type in regedit. Traverse to HKEY_CURRENT_USER/Control Panel/MMCPL.
From pulldown menu Edit/New/String Value. Type in “ScanJet” and enter. Select ScanJet and right mouse click and select modify. Enter into Value Data the location of hpscnmgr.dll. (i.e. C:\WINNT\System32\hpscnmgr.dll).
112.Upon reboot HP ScanJet Scanners should show up in Control Panel.
Your drivers are now installed. From Control Panel, double click on “SCSI Adapters”. You should see “epstwnt” listed as one of the Devices. Click on the “+” by “epstwnt” and you should see “HP C5190A” or “HP C7190A”.
To test the installation, double-click HP ScanJet Scanners in the Windows Control Panel, choose the Test tab, and click the desired test button.
To remove the Epstwnt driver, from a DOS prompt switch to the \<windowsNT>\system32\drivers directory and execute the following:
Sharshtw –remove EpstwntThis will uninstall the driver by removing registry entries.
Note: Communication errors may occur with certain HP DeskJet Printers. (Refer to HP ScanJet 5100C Notes on page 181 for more information.)
Windows 3.11If you are writing a 16-bit application, you need the following files on your system:
hpscaner.dllhpwnscsi.dll
If you are writing a 32-bit application, you need the following files on your system:
hpscntst.dllhpsj16.dllhpsj32.dllhpsm32s.dll
In addition to the above files, you need the following files for the specific interface card:
Scanner Interface Files Copied
C2522 aspi416.syssjiix.sys
C2502 mini400i.syssjiix.sys
C2503 mini400i.syssjiix.sys
C1752/C1753 sjii.sysHP ScanJet + sjdriver.sys
HP C2522 CardThe following lines must be added to your CONFIG.SYS:
DEVICE=C:\<HP SCANJET>\ASPI416.SYSDEVICE=C:\<HP SCANJET>\SJIIX.SYS
Your drivers are now installed. To test the installation, double-click Scanner Test in the HP Scanning Software program group and then click the desired test button.
HP C2502 Card (ISA without switches) Or HP C2503 Card (MicroChannel without switches)The following lines must be added to your CONFIG.SYS:
DEVICE=C:\<HP SCANJET>\MINI400I.SYSDEVICE=C:\<HP SCANJET>\SJIIX.SYS
Your drivers are now installed. To test the installation, double-click Scanner Test in the HP Scanning Software program group and then click the desired test button.
HP C1752/C1753 Card (ISA or MicroChannel with switches)The following lines must be added to your CONFIG.SYS:
DEVICE=C:\<HP SCANJET>\SJII.SYS
Your drivers are now installed. To test the installation, double-click Scanner Test in the HP Scanning Software program group and then click the desired test button.
HP ScanJet + Scanner and Interface CardThe following lines must be added to your CONFIG.SYS:
DEVICE=C:\<HP SCANJET>\SJDRIVER.SYS
Your drivers are now installed. To test the installation, double-click Scanner Test in the HP Scanning Software program group and then click the desired test button.
Third-Party SCSI CardsThe following lines must be added to your CONFIG.SYS:
DEVICE=C:\<HP SCANJET>\SJIIX.SYS
Your drivers are now installed. To test the installation, double-click Scanner Test in the HP Scanning Software program group and then click the desired test button.
File PlacementsThe following table lists DLLs and other files that are installed with the HP Scanning Software:
Operating System File Name Location of File
Windows 3.1 or WFW 3.11 hpscaner.dllhpscntst.dllhpsj16.dllhpsj32.dllhpsm32s.dllhpwnscsi.dll
All of these files go in [windows]\system
Windows 95 apix.vxdaspienum.vxdscanjet.inf
hpscnmgr.dllhpscnmgr.hlphpscntst.dllhpsjclas.dllhpsjrfsh.vxd
hpsj32.dllhpsj1695.dll
reg32.dllwinaspi.dllwnaspi32.dll
\<windows95>\system\iosubsys\<windows95>\system\iosubsys\<windows95>\inf
The rest of these files go in \<windows95>\system
Windows NT
ASPI Layer
hpscnmgr.dllhpscnmgr.hlphpscntst.dllhpsj32.dllhpscan32.dllreg32.dll
aspi32.syswnaspi32.dllwinaspi.dllwowpost.exe
\<windowsNT>\system32\<windowsNT>\system32\<windowsNT>\system32\<windowsNT>\system32\<windowsNT>\system32\<windowsNT>\system32
\<windowsNT>\system32\drivers\<windowsNT>\system32\<windowsNT>\system\<windowsNT>\system
Windows 98 hpscan.inf
hpscnmgr.dllhpscnmgr.hlp
hpsmui.dllhpscntst.dllhpsj32.dll
hpsjusd.dll
reg32.dll
usbsoft.exe
hpsjrreg.exe
\<windows98>\inf
The rest of these files go in \<windows98>\system
(from Windows 98 CD)
File Definitions
File Definitionaspi32.sys NT drivers for Win ASPI 32. Used by hpscnmgr.dllEpst9x.inf Windows 95 setup information for parallel scanner.Epst9x.mpd Windows 95 parallel scanner driverEpstwnt.mpd Windows NT 4.0 parallel scanner driverhp400a.inf Windows 95 setup information for HP C2502 cardhp400a.mpd Windows 95 driver for HP C2502 cardhpscan32.dll WinNT driver file for 16-bit access.hpscan.inf Windows 98 setup information for supported HP ScanJetshpscnmgr.dll Lowest level interface to scanner for use by 32-bit applications. For Windows 95 and
NT. Also contains “HP ScanJet Scanners” control panel applet.hpscnmgr.hlp Help file for “HP ScanJet Scanners” control panel applet.hpscntst.dll Provides scanner test functionality to “HP ScanJet Scanners” control panel applet and
“HP Scanner Test” applications. Used in Win32s, Windows 95, NT.hpsj16.dll Used by hpsm32s.dll to interface to drivers in Win32shpsj1695.dll Used by hpscnmgr.dll to interface to real mode (listed in config.sys) scanner
drivers in Windows 95 (HP ScanJet+, C1752/C1753, C2503).hpsj32.dll SCL library for 32-bit applications. Uses hpscnmgr.dll or hpsm32s.dll to
communicate with the scanner.hpsj32.lib Used to statically link to hpsj32.dll.hpsjclas.dll Win95 PnP class provider. Needed for device manager.hpsjrfsh.vxd Used on Windows 95 systems only.hpsjusd.dll Windows 98 USB Driver.hpsjvxd.exe Win98 driver file for 16-bit access.hpsjvxd.vxd Win98 driver file for 16-bit access.hpsm32s.dll Lowest level interface to scanner for use by 32-bit applications. For Win32s.hpsmui.dll UI file used by hpscnmgr.dll.mini400i.sys CAM driver for HP C2502/C2503 cards. Used in Win3.1 for both cards. Only needed
in Windows 95 for C2503 card.ScanJet.inf Windows 95 setup information for all HP ScanJets.sharshtl.exe Run this executable on Windows NT 4.0 to install the parallel scanner driver(s) by
setting up the proper registry information.sharsht.sys Windows NT 4.0 system file for parallel scanners.sjii.sys Driver for C1725/C1753 cards and connected scanners. Needed in both Win 3.1 and
Windows 95.sjiix.sys Scanner driver with both CAM and ASPI interfaces. Used in Win31 for all cards. Only
needed in Windows 95 for card with real mode (listed in config.sys) drivers (C2503).
usbsoft.exe Executable to enable USB on Windows 98 systems if not enabled in BIOS.vhpscand.vxd Allows 16-bit scanning apps written to interface with the 16-bit SCL library or directly
to the real mode drivers to work in Windows 95 for scanners connected to SCSI cards with Windows 95 drivers.
wnaspi32.dll NT drivers for Win ASPI 32. Used by hpscnmgr.dll.
Programming Notes
Figure 3. The Scanner Library, 32-bit Windows
The easiest way to control the scanner is via the SCL library which, for 32-bit, has been recompiled as the hpscl32.dll file (see figure above). You should review the SCL-C library chapter for details of calls to the hpscl32.dll. Some of these calls are repeated below.
Communication with the scanner is via a SCANSTATE structure and two calls, GetScanState() and SetScanState(). To populate the structure with the required values, call GetScanState() to set up the scanner and then call SetScanState() to return the values as interpreted by the scanner. Part of the SCANSTATE structure will be populated with necessary ScanInfo data: bytes/scan, pixels/scan, lines/scan, scan size. You will need these values to roll an image file.
Note: Never attempt to determine the size of the data to be returned. Upon inquiry, the scanner will tell you the number of scan lines, bytes per line, and size of scan. The values are determined from the data type, bit depth, sampling (resolution and scaling) and window size. Since certain configurations result in split bytes, the scanner will elect to pad data. And because certain scanners use integer arithmetic, the scanner’s results may be different than a calculation you make externally.
Data Structure Three data structures are defined by the Scanner Control Library for general use. These structures provide a convenient way of organizing the scan parameters. The SCANWINDOW structure stores the type and physical boundaries of the scan window. The SL_PIXEL window measures distances in 300 dpi device pixels. If the type is SL_DECIPOINT, the unit of measure is 1/720 of an inch. The SCANINFO structure contains information which specifies the amount of scanned data that can be expected to be received as well as the model number and ADF capability. The SCANSTATE structure contains, in addition to the two other structures, the values of all the scan parameters. This last data structure contains all the scanner information needed by an application program.
See Chapter 4: The SCL C Library starting on page 85 for more information on these structures.
Chapter 8: Input/Output Protocols
SCSI-1 Interface Protocol
Applies ScanJet ScanJet + X ScanJet IIp ScanJet 3pto: X ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C ScanJet 5200C
ScanJet 4p ScanJet 5p ScanJet 5100C/4100C ScanJet 6200C
The SCSI interface released with the HP ScanJet IIp and the HP ScanJet IIc use a SCSI interface between the device and the PC. A summary of the calls for that interface are detailed below. Familiarity with the SCSI architecture and bus phases is assumed.
Note: Hewlett-Packard offers these notes for the developer, but does not intend to support the development, nor make available any source code.
HP88390A so will, as minimum, give the level of SCSI-1 support and commands which the HP-88390A understands. These scanners are expected to be connected to Macintosh, DOS and OS/2 hosts primarily, and the minimum level of support to operate effectively as a peripheral in those environments is provided.
The ANSI SCSI-1 specifications are a superset of what each SCSI device is defined to support. The HP ScanJet IIp and HP ScanJet IIc scanners will adhere to specifications for a SCSI processor device with the feature set as defined in this document. Most of the SCSI-2 requirements are adhered to -- the exception is that these scanners do not respond to messages from the host except during selection. These scanners are therefore considered a SCSI-1, but not SCSI-2 device. The subset of SCSI which is implemented is largely determined by the needs of Macintosh SCSI. The DOS and OS/2 SCSI drivers will be provided to users as part of the scanner interface kit, so those drivers can be customized to also implement "Mac SCSI". These scanners do NOT support the ANSI SCSI-2 implementation of scanner device protocol. By not implementing SCSI-2, theses scanners are also not implementing HP Common SCSI.
Note: See ANSI document X3.131-1986 for SCSI-1 and ANSI working draft proposal X3T9.2 (08/08/88) for SCSI-2.
SCSI-1 Physical CharacteristicsPhysically, the HP ScanJet IIp and HP ScanJet IIc scanners use the single-ended SCSI driver/receiver alternative, implemented using an NCR 53C80 interface chip. Two shielded connectors (one 25-pin and one 50-pin) are provided with termination power provided by the HP ScanJet IIc controller board. The SCSI protocol operates as asynchronous only with a burst data rate of > 1.5 MB/sec. The stub length between the connector with a terminator and the other connector on HP ScanJet IIc scanner is very close to the maximum specification of 3.9 inches.
SCSI-1 General OperationThe HP ScanJet IIp and HP ScanJet IIc scanners have implemented SCSI as for a processor device which is always a target, with embedded SCL. All the mandatory SCSI-2 commands for a processor device are supported plus the optional Receive command and the optional Read Buffer and Write Buffer commands as explained below. Scanner escape sequences (SCL) are passed to the HP ScanJet IIc scanner via the SCSI Send command. Scanner data and the response to an SCL inquire are returned to the SCSI host during a Receive command.
The SCSI host software can determine that the SCL command contained in the DATA OUT phase of a SEND command was successfully delivered to HP ScanJet IIc scanner and executed without any SCSI interruptions or preconditions by checking for a SCSI status of GOOD. The Message "Command Complete" indicates that command execution is complete and that HP ScanJet IIc scanner is going to the BUS FREE phase, where it will wait to be selected to start another sequence of command, data, status and message.
If CHECK CONDITION status is returned, a Request Sense command (page 132) should be issued to determine the cause of the CHECK CONDITION. The CHECK CONDITION may be due to an existing unit attention condition, or due to a problem in sending a valid SCSI command. An interruption in performing a command due to unexpected activity on the SCSI bus will cause the scanner to put the bus directly into the BUS FREE condition. The host is expected to detect that an interruption occurred and send a RequestSense command. If the next command after the interruption is a Request Sense, the sense key returned will be ABORTED COMMAND, unless the interruption was a SCSI RESET in which case it would be UNIT ATTENTION. If the next command after the interruption is not Request Sense, the error condition is lost and will not be reported.
A SCSI RESET is the most likely "unexpected activity on the SCSI bus" to cause an interruption, but hardware conditions (ESD, etc.) which would cause the 5380 to generate an interrupt will also cause HP ScanJet IIc scanner to go immediately to BUS FREE and set the sense key to ABORTED COMMAND. (To minimize unexpected interruptions, HP ScanJet IIc scanner will disable selection while processing a command by writing 0 to the select enable register.) Another condition which could cause an ABORTED COMMAND error is when the scanner "times out" waiting for an expected RECEIVE for scan data. If the scanner light stays on for more than five minutes during a scan without transferring data, it is expected that the host has stopped asking for scan data and the HP ScanJet IIc scanner will abort the scan, turn off the light, go home, and return the bus to the BUS FREE state. If the next command is Request Sense, the sense key ABORTED COMMAND will be returned, otherwise the error condition will be lost.
Any SCL type errors will NOT be reported as a CHECK CONDITION, but will be put on the SCL error stack as defined in the Scanner Control Language documentation. Use the SCL commands for error reporting (Read Current Error Number, Clear Errors, etc.) to check for such an error, again via a SCSI Send command. This is followed by a SCSI Receive command enabling the HP ScanJet IIc scanner to return its inquire response. In summary, SCSI protocol will report SCSI errors and SCL protocol will report SCL errors. The SCL protocol is entirely embedded within the SCSI Send and Receive command protocol.
The SCSI protocol for a particular SCL command or SCL inquire will consist of a Send command (page 132) followed by zero or more Receive commands (page 132). The HP ScanJet IIc scanner keeps track of which Send command is associated with each Receive command. The SCSI commands Request Sense, Test Unit Ready, and Inquiry can be given at any time and will not interrupt the flow of the SEND/RECEIVE combinations. Any other command, including another SEND, which is sent to the scanner will clear any scans currently in progress, or any SCL inquires which were partially completed.
SCSI-1 Phases and SupportThe SCSI RESET condition will cause a "Hard" RESET in the HP ScanJet IIc scanner. If a reset appears on the bus, it will immediately drop all lines and put the bus in the BUS FREE phase. the HP ScanJet IIc scanner will regularly be monitoring for the reset interrupt. When reset is detected, the HP ScanJet IIc scanner will abort any command in progress, reset all SCSI parameters and device parameters (and SCL parameters) and return to idle state. Part of the re-initialization is to re-read the SCSI ID switch. The reset should take less than 250 msec (in reality, more like 50 msec) in order to respond to subsequent resets or selections - it will not respond before the reset process is complete. HP ScanJet IIc scanner will NOT do a reference scan to locate the reference mark as it does at power-up, but will "remember" that the reset has occurred so that the next time a scan command is received the reference mark is relocated. A partial selftest is performed for a SCSI reset. To perform the full self-test use the Send Diagnostic command or the equivalent SCL diagnostic command. A unit attention condition will be in effect after a SCSI RESET.
The HP ScanJet IIc scanner will not respond to selection if more than two device IDs (including the HP ScanJet IIc scanner's ID) are active during selection. The HP ScanJet IIc scanner will respond to selection if the host's ID is not active on the bus (only the HP ScanJet IIc scanner's ID is active).
The HP ScanJet IIc scanner only supports a single initiator, and will have only one logical unit number, 0. A command for a logical unit number other than 0 will cause a CHECK CONDITION with a sense key of ILLEGAL REQUEST - except for the Inquiry command where no error will be generated (see below).
The HP ScanJet IIc scanner will generate parity on outgoing data but will not check parity on incoming bytes. (This is another SCSI-2 violation.)
The HP ScanJet IIc scanner does not implement asynchronous event notification (AEN).
When first powered up, the HP ScanJet IIc scanner will go through a lengthy sequence of initialization and self-test. HP ScanJet IIc scanner will not respond to any activity on the bus until this is complete.
SCSI-1 CommandsSix SCSI commands are supported (The HP ScanJet IIc scanner does not support linked commands). The following status conditions can be returned by these commands:
GOOD: <0H> indicated successful completion of the last command.CHECK CONDITION: <2H> will be sent if some problem occurs. When this status is
returned, a Request Sense command may be given to get a better idea of the problem.
If a CHECK CONDITION status is returned by a command and the next command is not a Request Sense, the sense key information is lost.
Test Unit Ready: <00H, 00H, 00H, 00H, 00H, 00H>If the HP ScanJet IIc scanner is on-line (i.e. selected) and past its power-on self-test, a status of GOOD will be returned. If a unit attention condition exists, CHECK CONDITION status is returned. The appropriate sense key is returned in response if the next command is a Request Sense. No data phase is performed for this command. The host can check for HP ScanJet IIc scanner being ready by giving this command. No response means HP ScanJet IIc scanner's not up for it yet. During the HP ScanJet IIc scanner's power-up self-test or SCSI RESET, the HP ScanJet IIc scanner will be unresponsive to the SCSI bus.
Request Sense: <03H, 00H, 00H, 00H, allocation length, 00H>Returns a status for the HP ScanJet IIc scanner. Allocation length is a parameter one byte long.
The HP ScanJet IIc scanner will return up to eight bytes of status during the Data In phase. If allocation length is less than eight, only allocation length number of bytes is passed. An allocation length of 0 indicates no bytes will be transferred and is not an error.
The data bytes are < F0H, 00H, sense key, 00H, 00H, 00H, 00H, 00H >. The sense key field is one byte long.
One of the following sense keys will be returned in the Request Sense data:
"No Sense" 0H Returned when there is no error to report."Not Ready" 2H This was returned by HP88390A, but will not be returned by the
HP ScanJet IIc scanner. If the HP ScanJet IIc scanner is not ready, it will simply not respond.)
"Hardware Error" 4H indicates a failure in the Send Diagnostic self-test which was the previous command. Once reported, this error condition goes away. The SCL command to get the self-test status bytes can be executed using the SCSI Send and Receive commands with the proper SCL escape codes embedded ).
"Illegal Request" 5H Indicates an illegal parameter in the command descriptor block last passed, or an illegal logical unit number in the IDENTIFY message during selection (except for an INQUIRY command). This may be set for an unsupported opcode or for HP ScanJet IIc scanner receiving a byte other than 0H where 0H is expected. See SCSI-1 Commands starting on page 131 for the command templates.
"Unit Attention" 6H Set when the HP ScanJet IIc scanner is accessed for the first time after a reset or successful power up. See SCSI-1 Messages starting on page 134 for more details on the unit attention condition.
"Aborted Command" BH Indicates the previous command has been aborted due to unexpected activity on the SCSI bus, or an ABORT message during selection, or an illegal identify message during selection, or the scanner has "timed out" waiting for an expected RECEIVE. This will usually be reported in response to a REQUEST SENSE given after the host has detected an unexpected BUS FREE condition.
Receive: <08H, 00H, allocation_length, 00H>Use this command to pass through data from HP ScanJet IIc scanner to the SCSI host. The allocation length is three bytes that specify the number of bytes of data to be transferred during the Data In phase. An allocation length of 0 indicates no data to be transferred and is not an error. If the number of bytes available from HP ScanJet IIc scanner is less than that asked for via the allocation length, only that number of bytes will be passed to the host; an error will not be set. For scan data, the "number of bytes available from HP ScanJet IIc scanner" is the number of bytes in the scan which have not yet been passed to the host.
Send: <0AH, 00H, transfer_length, 00H>Use this command to pass data to HP ScanJet IIc scanner. The transfer length is three bytes that specifies the number of bytes of data to be sent during the Data Out phase. A transfer length of 0 indicates that no data is to be transferred and is not an error.
Inquiry: < 12H, 00H, 00H, 00H, allocation_length, 00H>Data identifying the HP ScanJet IIc scanner will be returned to the host. The single-byte allocation length specifies the number of bytes that the initiator has allocated for the returned Inquiry data. An allocation length of zero indicates that no Inquiry data shall be transferred, and is not an error. The HP ScanJet IIc scanner will terminate the Data In phase when allocation length bytes have been transferred or when all 36 bytes of the Inquiry data have been transferred.
The Inquiry data is <03H, 00H, 01H, 02H, lFH, 00H, 00H, 00H, "HP", 20H, 20H, 20H, 20H, 20H, 20H, "C1750A", 20H, 20H, 20H, 20H, 20H, 20H, 20H, 20H, 20H, 20H,rev code > .
Rev code is four bytes of data indicating the revision number of the HP ScanJet IIc scanner firmware.
If an Inquiry command is given for a logical unit number other than zero, no error shall be reported and the first byte of the inquiry data will be <7FH> instead of <03H> .
Write Buffer: <3BH, 02H, 00H, 00H, 00H, 00H, transfer_length, 00H>Use this command with the Read Buffer command to test the HP ScanJet IIc scanner buffer memory and the SCSI bus integrity. The transfer length field is three bytes and specifies the maximum number of bytes that shall be transferred during the DATA OUT phase to be stored in the buffer beginning at location 0. If the transfer length field specifies a transfer that would exceed the buffer capacity, the HP ScanJet IIc scanner will immediately return CHECK CONDITION status and will set the sense key to ILLEGAL REQUEST. (The capacity of the buffer can be determined by the buffer capacity field in the READ BUFFER descriptor.) A transfer length of 0 indicates that no data transfer will take place and is not an error.
Read Buffer: <3CH, 02H, 00H, 00H, 00H, 00H, alloc length)l, 00H> for data mode<3CH, 03H, 00H, 00H, 00H, 00H, 00H, 00H, alloc_length, 00H> for descriptor mode
Use this command with the Write Buffer command to test the HP ScanJet IIc scanner's buffer memory and the SCSI bus integrity. In the data mode version of this command, the DATA IN phase contains buffer data from HP ScanJet IIc scanner's buffer starting at location 0 for alloc length bytes. Alloc length is a three byte field. If the alloc length field specifies a transfer that would exceed the buffer capacity, the data sent in the DATA IN phase will start at location 0 and continue in a "wrap-around" fashion from the beginning of the HP ScanJet IIc scanner's buffer until alloc length bytes are transferred. The size of the HP ScanJet IIc scanner's buffer can be determined by sending the READBUFFER command in descriptor mode. A transfer length of 0 indicates that no data transfer will take place and is not an error.
In the descriptor mode version of this command, a maximum of four bytes of READBUFFER descriptor information are returned. Alloc length is a parameter one byte long. If alloc length is less than four, only alloc length number of bytes is passed. The data bytes in the DATA IN phase will be <00H, buffer capacity> where buffer capacity is a three byte field which is the size of the HP ScanJet IIc scanner's buffer.
Send Diagnostic: < lDH, 04H, 00H, 00H, 00H, 00H>The HP ScanJet IIc scanner will perform its power-on self-test. If the self test successfully passes, the command will be terminated with GOOD status; otherwise, the command will be terminated with CHECK CONDITION status and the sense key will be set to HARDWARE ERROR. If a CHECK CONDITION status is returned by a command and the next command is not a Request Sense, the sense key information is lost.
SCSI-1 MessagesAt the end of a command - > data - > status phase sequence, the HP ScanJet IIc scanner will pass the COMMAND COMPLETE message (00H) to the host during a MESSAGE IN phase prior to going to BUS FREE.
The HP ScanJet IIc scanner will only respond to the SCSI Attention condition to handle messages from the host between the selection and command phases. If ATN is asserted following selection, one and only one message byte will be transferred during a MESSAGE OUT phase:
22If the byte is an ABORT message (06H), the HP ScanJet IIc scanner will cancel a scan in progress and clear any indication that a scan was in progress and go to BUS FREE. If a REQUEST SENSE is the next command, an ABORTED COMMAND sense key will be given. 23If the byte is a BUS DEVICE RESET message (0CH), the HP ScanJet IIc scanner will perform a hard reset - same as if the RST line was asserted - and go to BUS FREE with a unit attention condition pending. (This may hold the bus < 200 msec) 24If the byte is an IDENTIFY message (bit 7 is 1), HP ScanJet IIc scanner will decode the identify as follows:
- bit 6 (DiscPriv) will be ignored; - bits 5,4,3 must be 0 or a MESSAGE REJECT (07H) will be sent during a MESSAGE IN phase and then go immediately to BUS FREE (a subsequent REQUEST SENSE will show ABORTED COMMAND); - bits 2,1,0 will describe the logical unit number to be used in executing the command. If the logical unit number in the identify is illegal (not 0), all commands except the INQUIRY command will terminate with CHECK CONDITION and ILLEGAL REQUEST sense key. For an INQUIRY command, if the line in the identify is illegal the first byte in the returned inquiry data will be 7FH (instead of 03H).
25If any other byte is received as the only byte during MESSAGE OUT phase, a MESSAGE REJECT will be sent (MESSAGE IN phase), and the command will continue normally. The scan will not be canceled or interrupted.
SCSI-2 Interface Protocol
Applies ScanJet ScanJet + ScanJet IIp X ScanJet 3pto: X ScanJet IIc X ScanJet IIcx X ScanJet 3c/4c/6100C ScanJet 5200C
X ScanJet 4p X ScanJet 5p ScanJet 5100C/4100C X ScanJet 6200C
IntroductionSCSI-2 replaced SCSI-1 for the HP ScanJet IIc. All scanners checked above use the SCSI-2 protocol. This chapter defines the SCSI support level and commands accepted by the enhanced SCSI HP ScanJet IIc scanner. Familiarity with SCSI architecture and bus phases is assumed.
The "enhanced" SCSI HP ScanJet IIc is an updated firmware revision of the HP ScanJet IIc which includes SCSI-2. The enhanced SCSI HP ScanJet IIc appears in units with datecode 3226 or later; in units with serial # prefix 3265A or later.
For brevity, the rest of this section will refer to the enhanced SCSI HP ScanJet IIc as merely “the HP ScanJet IIc scanner” or “the scanner”.
The scanner will appear to operate differently for the SCSI-2 supportable hosts as opposed to the SCSI-1 supportable hosts. If the host sends an identify message at selection and the identify indicates the host can handle disconnection, the scanner will disconnect (get off the SCSI bus) while filling its data buffer with scan data. See SCSI-2 Disconnects starting on page 141.
The ANSI SCSI specifications are a superset of what each SCSI device is defined to support. The scanner will adhere to specifications for a SCSI-2 processor device with the feature set as defined in this tech note. The scanner does NOT support the ANSI SCSI-2 implementation of scanner device protocol.
The supported scanners conform to the requirements of an HP Common SCSI class 2 device.
The HP ScanJet 6200C conforms to requirements of a SCSI Plug and Play device.
Physical CharacteristicsPhysically, the scanners use the single-ended SCSI driver/receiver alternative, implemented using an NCR 53C80 interface chip. Two shielded connectors (one 25-pin and one 50-pin) are provided with termination power provided by the scanner’s controller board. The SCSI protocol operates as asynchronous only with a burst data rate of > 1.5MB/sec. The stub length between the connector with a terminator and the other connector on the scanner is very close to the maximum specification of 3.9".
General OperationThe scanners have implemented SCSI as for a processor device which is always a target, with embedded SCL. All the mandatory SCSI-2 commands for a processor device are supported, plus the optional Receive command and the optional Read Buffer and Write Buffer commands, as explained below. Scanner escape sequences (SCL) are passed to the scanner via the SCSI Send command. Scanned data and the response to an SCL Inquire is returned to the SCSI host during a SCSI Receive command.
The SCSI host software can determine that the SCL command contained in the DATA OUT phase of a SEND command was successfully delivered to the scanner and executed without any SCSI interruptions or preconditions by checking for a SCSI status of GOOD. The Message "Command Complete" indicates that command execution is complete and that the scanner is going to the BUS FREE phase, where it will wait to be selected to start another sequence of command, data, status and message.
If CHECK CONDITION status is returned, a Request Sense command (page 142) should be issued to determine the cause of the CHECK CONDITION. The CHECK CONDITION may be due to an existing unit attention condition, or due to a problem in sending a valid SCSI command, or due to some message received from the host during a MSG OUT phase. An interruption in performing a command due to an unexpected activity on the SCSI bus (other than ATN) will cause the scanner to put the bus directly into the BUS Free condition. The host is expected to detect that an interruption occurred and send a Request Sense command. If the next command after the interruption is a Request Sense, the sense key returned will be ABORTED COMMAND, unless the interruption was a SCSI RESET in which case it would be UNIT ATTENTION. If the next command after the interruption is not Request Sense, the error condition is lost and will not be reported.
A SCSI RESET is most likely "unexpected activity on the SCSI bus" to cause an interruption, but hardware conditions (ESD, etc.) which would cause the 5380 to generate an interrupt will also cause the scanner to go immediately to BUS FREE, and set the sense key to ABORTED COMMAND. (To minimize unexpected interruptions, the scanner will disable selection while processing a command by writing 0 to the select enable register.) Another condition which could cause an ABORTED COMMAND error is when the scanner "times out" waiting for an expected RECEIVE for scan data. If the scanner light stays on for more than five minutes during a scan without transferring data, it is expected that the host has stopped asking for scan data and the scanner will abort the scan, turn off the light, go home, and return the bus to the BUS FREE state. If the next command is REQUEST SENSE, the sense key, ABORTED COMMAND, will be returned, otherwise the error condition will be lost.
Any SCL type errors will NOT be reported as a CHECK CONDITION, but will be put on the SCL error stack. Use the SCL commands for error reporting (Read Current Error Number, Clear Errors, etc.) to check for such an error, again via a SCSI Sent command. This is followed by a SCSI Receive command enabling the scanner to return its inquire response.
In a nutshell, SCSI protocol will report SCSI errors and SCL protocol will report SCL errors. The SCL protocol is entirely embedded within the SCSI Send and Receive command protocol.
The SCSI protocol for a particular SCL command or SCL inquire will consist of a Send command (page 142) followed by zero or more Receive commands (page 142). The scanner keeps track of which Send command is associated with each Receive command. The SCSI commands Request Sense, Test Unit Ready, and Inquiry can be given at any time and will not interrupt the flow of the Send/Receive combinations. Any other command, including another Send, which is sent to the scanner will clear any scans currently in progress, or any SCL inquires which were partially completed.
SCSI-2 Phases and SupportThe scanners support all the phases specified in the SCSI standard. The scanners will generate parity on outgoing data but will not check parity on incoming bytes. (This is a slight SCSI-2 violation.) The following paragraphs describe each phase.
Arbitration PhaseAll devices that want to use the bus will arbitrate to determine which device has highest priority, thereby winning arbitration and getting use of the bus. The host must initiate arbitration before selection phase (the scanner will participate) and the scanner must initiate arbitration before reselection phase (the host will participate).
Selection PhaseThe scanner detects that it is selected when SEL and its SCSI ID bit are true and BSY and I/O are false for at least a bus settle delay. The scanner examines the DATA BUS in order to determine the SCSI ID of the selecting initiator so that address can be used for reselection. The scanner will not respond to selection if more than two device IDs (including the scanner's ID) are active during selection. If no SCSI ID is detected for the initiator (only the scanner's ID is active), the scanner treats this selection as an unknown initiator and will respond to selection, but will never attempt to disconnect. The scanner does not support multiple initiators. Reserve and Release are not implemented and separate copies of sense information or any parameters are NOT kept.
Reselection PhaseWhen the scanner tries to reconnect to an initiator for the purpose of continuing command operation, it will participate in arbitration phase until it wins. After winning arbitration, it reselects the initiator. If the initiator does not respond to the RESELECTION within the Selection Timeout Delay (250 msec), the Target releases the DATA BUS signals and continues to wait for a response for the Selection Abort Delay of 200 msec. The scanner always generates parity during RESELECTION.
Information Transfer PhasesWhen information is transferred from the scanner to the initiator, the scanner always generates parity. When information is transferred from an initiator to the scanner, the scanner never checks parity.
Data PhasesThe scanner supports asynchronous data transfer only. Synchronous data transfer is not supported.
Command PhaseSee SCSI-2 Commands starting on page 141 for a detailed description of the commands supported by the scanner.
Message PhasesSee SCSI-2 Messages starting on page 139 for a detailed description of the messages supported by the scanner.
Status PhaseA status byte is sent from the scanner to the initiator during the STATUS phase at the termination of each command unless the command is cleared by an aborted command condition. ( See ABORT 06H on page 139) See Request Sense on page 142 for a detailed description of the status codes supported by the scanner.
SCSI-2 ConditionsPowerup ConditionWhen first powered up, the scanner will go through a lengthy sequence of initialization and self-test. The scanner will NOT respond to any activity on the bus until this is complete. If the scanner fails self-test, no hardware fail condition will be raised. The Host is expected to use SCL type commands to determine if the scanner is okay to use.
Attention ConditionThe ATTENTION condition allows an initiator to inform the scanner that the initiator has a message ready. The scanner checks for ATN at its convenience, at least before changing to a new phase and during command phase. If ATN is set, the scanner will get and process the message bytes by performing a MESSAGE OUT phase. Because the scanner detects the assertion of the ATN signal after a block of information bytes is transferred, the initiator has to send or receive (dummy) information until the scanner performs a MESSAGE OUT phase.
The scanner will not go to MESSAGE OUT phase "during scanning" of data (while the scanner is filling the buffer). After scanning is completed, or before disconnection, if ATN is asserted by the host the scanner will go to MESSAGE OUT phase.
Reset ConditionThe scanner is reset when power is initially applied, the RST signal is asserted, or BUS DEVICE RESET message is received.
The SCSI RESET condition will cause a "hard" RESET in the scanner. If a reset appears on the bus, it will immediately drop all lines and put the bus in the BUS FREE phase. The scanner will regularly be monitoring for the reset interrupt. When reset is detected, the scanner will abort any command in progress, reset all SCSI parameters and device parameters (and SCL parameters) and return to the idle state. Part of the re-initialization is to re-read the SCSIID switch. The reset should take less than 250 milliseconds in order to respond to subsequent resets or selections; it will not respond before the reset process is complete. The scanner will NOT do a reference scan to locate the reference mark as it does at power-up, but will "remember" that the reset has occurred so that the next time a scan command is received the reference mark is relocated. A partial self-test is performed for a SCSI RESET. To perform the full self-test use the Send Diagnostic command or the equivalent SCL diagnostic command. A unit attention condition will be in effect after a SCSI RESET.
Unit Attention ConditionThe scanner will enter a unit attention condition upon any reset condition (SCSI RESET, BUS DEVICE RESET message, or power-on) but not an SCL Reset. If the first command after entering the unit attention condition is not Request Sense or Inquiry, the command will not be performed, but will fail immediately with a CHECK CONDITION status. If the following (second) command is a Request Status, the sense key of "Unit Attention" is given and the unit attention condition is cleared. If any other command is given after the first CHECK CONDITION status the "Unit Attention" sense key is lost and the condition cleared. If the first command after entering the unit attention condition (whether or not the CHECK CONDITION status has been given) is a Request Sense, the "Unit Attention" sense key is returned and the unit attention condition is cleared.
If an Inquiry command is received by the scanner after entering the unit attention condition, the Inquiry is executed and the unit attention condition remains.
SCSI-2 MessagesThe scanner will respond to the SCSI Attention condition to handle messages. ATN will be checked at least before every phase change and during all of COMMAND_PHASE.
Message will be handshaked and parsed (and executed) one byte at a time since the scanner does not accept any extended messages.
The scanner supports the following messages (IN means scanner to initiator; OUT means initiator to scanner):
Code Direction Description00H IN COMMAND COMPLETE02H IN SAVE DATA POINTER03H IN RESTORE POINTERS04H IN DISCONNECT05H OUT INITIATOR DETECTED ERROR06H OUT ABORT07H IN/OUT MESSAGE REJECT08H OUT NO OPERATION09H OUT MESSAGE PARITY ERROR0CH OUT BUS DEVICE RESET80H-FFH IN/OUT IDENTIFY
COMMAND COMPLETE 00H: At the end of a command --> data --> status phase sequence, the scanner will pass the COMMAND COMPLETE message (00H) to the host during a MESSAGE IN phase prior to going to BUS FREE.
SAVE DATA POINTER 02H: This message is sent from the scanner to direct the initiator to save a copy of the present active data pointer. The scanner issues this message when it disconnects the SCSI Bus during data transfer.
RESTORE POINTERS 03H: This message could be sent from the scanner to direct the initiator to restore the most recently saved pointers to active state. The scanner could send this message when a bus error has occurred during the DATA IN or STATUS phase. In this current implementation, however, the scanner will abort a command or a scan if a bus error is detected instead of setting up for a retry. Therefore, in the current implementation of the scanner RESTORE_POINTERS is never used. The scanner does NOT send this message during reconnection because the reconnection sequence (arbitration - reselection - identify msg_in) implies restore pointers and specifically sending the message will mess up some hosts.
DISCONNECT 04H: This message is sent from the scanner to inform the initiator that the present physical path is going to be broken, but that a later reconnect will be required in order to complete current operation. See SCSI-2 Disconnects starting on page 141 for a list of commands which may support disconnection.
INITIATOR DETECTED ERROR 05H: When the scanner receives this message during DATA IN or STATUS phase, it will abort the command.
ABORT 06H: This message is sent from the initiator to the scanner to clear the present operation. All pending data and status which was made by the current command is cleared. If received during a DATA_IN or DATA_OUT phase, a STATUS of CHECK_CONDITION will be reported, otherwise the scanner will go directly to the BUS FREE phase. If a scan or SCL inquire was in progress the scan or inquire will be terminated, any indication that a scan was in progress will be cleared, and an ABORTED COMMAND sense is set.
MESSAGE REJECT 07H: This message is sent from either the initiator or the scanner to indicate that the last message was inappropriate or has not been implemented.
IF ATN remains asserted after the MESSAGE REJECT has been sent to the host, the scanner will return to MESSAGE OUT phase and read in the next byte, ignoring it if it is a NO OPERATION message and rejecting it otherwise (by sending MESSAGE REJECT in MESSAGE IN phase).
When the scanner receives a MESSAGE REJECT message from the initiator, it takes the following action based on which message was rejected:
COMMAND COMPLETE: The scanner will not check for messages following COMMAND_COMPLETE, so it will go directly to BUS FREE phase and will not see the MESSAGE_REJECT.
DISCONNECT: The scanner will not check for messages following sending the DISCONNECT message, so it will go directly to BUS FREE phase and will not see the MESSAGE_REJECT.
IDENTIFY: The scanner goes to the BUS FREE phase and aborts the command. Sense Key is set to ABORTED_COMMAND.
MESSAGE REJECT: The scanner will not check for messages after sending a MESSAGE_REJECT message to the host, but will continue as indicated elsewhere in this documentation.
RESTORE POINTERS: The scanner currently does not send this message.
SAVE DATA POINTERS: The scanner will not check for messages after sending the SAVE_DATA_POINTERS message. It will send the DISCONNECT message and will not see the MESSAGE_REJECT.
NO OPERATION 08H: This message is ignored by the scanner.
MESSAGE PARITY ERROR 09H: When the scanner receives this message after the reselection IDENTIFY is sent to the host, the IDENTIFY is resent once. If ATN is set after the retry, the operation is aborted and the scanner will go to bus free sense ABORTED_COMMAND. Any other messages sent to the host will not check ATN after they are sent (see MESSAGE_REJECT). If the MESSAGE_PARITY_ERROR is received when no message had been sent to the host, the message may be rejected and the scanner will go to the BUS FREE phase and abort the current SCSI command, setting the Sense Key to ABORTED_COMMAND.
BUS DEVICE RESET 0CH: This command is sent form an initiator to reset the scanner. A hard reset will be performed - same as if the RST line was asserted - and the scanner will go to BUS FREE with a unit attention condition pending. See SCSI-2 Conditions starting on page 138 for more about the reset condition.
IDENTIFY 80H-FFH: These messages are sent by either the initiator or the scanner to establish the physical path connection between initiator and the scanner for a particular logical unit. It is recommended in SCSI-2 that the host use the LUN in the Identify message during selection rather than the LUN in the first byte of the CDB. If an Identify is sent during selection, the LUN in the first byte of the CDB is ignored. If more than one Identify message is received during selection, the scanner will abort the command and go to BUS FREE with ABORTED COMMAND sense key set.
The IDENTIFY message is decoded as follows: bit 7 is 1, bit 6 (DiscPriv) will be set to 1 by the initiator to indicate the initiator has an ability to accommodate the disconnection and reconnection, and 0 otherwise; bits 5, 4, 3 must be 0 or else a MESSAGE REJECT (07H) will be sent during a MESSAGE IN phase and then go immediately to BUS FREE (a subsequent REQUEST SENSE will show ABORTED COMMAND); bits 2, 1, 0 will describe the logical unit number to be used in executing the command. The scanner will have one logical unit number, 0. A command for a logical unit number other than 0 will cause CHECK CONDITION with a sense key of ILLEGAL REQUEST, except for the INQUIRY command where no error will be generated and the first byte in the returned inquiry data will be 7FH (See SCSI-2 Commands starting on page 141).
Identify is also sent by the scanner to the host during reselection. On reselection, LUN will be 0 and RESTORE POINTERS is implied.
SCSI-2 DisconnectsThe scanner will attempt to disconnect from the bus whenever it expects to be "off-line" (i.e., busy with no data to transfer) for an extended period of time AND the host has indicated via an Identify message that it supports disconnects. The scanner will not hold the bus for more than 100 msecs at a time. This may mean that scanned data will be "chopped up" into small segments during the DATA IN phase with disconnects/reconnects in between.
In addition to disconnecting during transfer of scan data, the scanner will attempt to disconnect at the end of DATA OUT phase for some processor SEND commands and at the end of COMMAND PHASE for SELF_DIAGNOSTIC command and reconnect when ready to go to STATUS phase.
The disconnect for a SEND command is only necessary for those SCL commands which take more than 100 msecs. For a processor RECEIVE command that has been set up to return scanned data, the scanner will disconnect at the end of command phase and perform the scan, reconnecting and bursting out scanned data to the host a quarter of the scanner's internal buffer at a time, disconnecting in between. The scan will continue while these bursts are taking place, stopping when the scanner's buffer is full and restarting (repositioning) after enough of the buffer has been emptied. If there is one quarter of the buffer's worth of data when the RECEIVE is received, the disconnect after command phase will not take place and data will be burst out immediately.
The disconnect from the bus, the scanner will first send a SAVE DATA POINTER message followed by a DISCONNECT message. The scanner will not handle any messages sent by the host in response to these messages.
To reconnect to the bus, the scanner will arbitrate for control until either it gains control of the bus or it detects a reset or selection on the bus. If the scanner loses arbitration it will retry indefinitely. Once the scanner gains control of the bus, it goes into reselection phase and checks for assertion of the BSY line by the host. If a timeout occurs (see Reselection Phase on page 137) waiting for the host to respond, the scanner will go to BUS FREE. No sense key will be set.
Once reselection is successful the scanner will send an Identify message.
If the scanner detects a selection by an initiator while it is disconnected. It aborts the current command, sets the sense key to ABORTED COMMAND, cancels the scan or other command in progress, and then parses the command as usual.
SCSI-2 CommandsEight SCSI commands are supported (the scanner does not support linked commands). If a field which is supposed to be 0 is not, a CHECK CONDITION status with ILLEGAL REQUEST sensekey is generated. The following status conditions can be returned by these commands:
GOOD: <0H> indicated successful completion of the last command.CHECK CONDITION: <2H> will be sent if some problem occurs. When this status is
returned, a Request Sense command may be given to get a better idea of the problem.
If a CHECK CONDITION status is returned by a command and the next command is not a Request Sense, the sense key information is lost.
Test Unit Ready: <00H, 00H, 00H, 00H, 00H, 00H>If the scanner is on-line (i.e. selected) and past its power-on self-test, a status of GOOD will be returned. If a unit attention condition exists, CHECK CONDITION status is returned. The appropriate sense key is returned in response if the next command is a Request Sense. No data phase is performed for this command. the host can check for the scanner being ready by giving this command. No response means the scanner is not up for it yet. During the scanner's power-up self-test or SCSI RESET, the scanner will be unresponsive to the SCSI bus.
Request Sense: <03H, 00H, 00H, 00H, allocation_length, 00H>Returns a status for the scanner. Allocation_length is a parameter one byte long. The scanner will return up to eight bytes of status during the Data In phase. If allocation_length is less than eight, only allocation_length number of bytes is passed. An allocation_length of 0 indicates no bytes will be transferred and is not an error. The data bytes are <F0H, 00H, sense_key, 00H, 00H, 00H, 00H, 00H>. The sense_key field is one byte long. The possible sense_key values are detailed in the "Status Codes and Sense Keys" section of this documentation.
If an illegal logical unit number (LUN) is sent with a Request Sense command an ILLEGAL_REQUEST is returned as the sense.
One of the following sense keys will be returned in the Request Sense data:
"No Sense": <0H> Returned when there is no error to report."Not Ready": <2H> (This was returned by HP88390A, but will not be returned by
the scanner. If the scanner is not ready, it will simply not respond.)
"Hardware Error": <4H> Indicates a failure in the Send Diagnostic self-test which was the previous command. Once reported, this error condition goes away. The SCL command to get the self-test status bytes can be executed using the SCSI Send and Receive commands with the proper SCL escape codes embedded
"Illegal Request": <5H> Indicates an illegal parameter in the command descriptor block last passed, or an illegal logical unit number in the IDENTIFY message during selection (except for an INQUIRY command). This may be set for an unsupported opcode or for the scanner receiving a byte other than 0H where 0H is expected. See SCSI-2 Commands starting on page 141 for the command templates.
"Unit Attention": <6H> Set when the scanner is accessed for the first time after a reset or successful power_up. See SCSI-2 Conditions starting on page 138 for more details on the unit attention condition.
"Aborted Command": <BH> Indicates the previous command had been aborted due to unexpected activity on the SCSI bus, or an ABORT or other unexpected message, or an inability to reselect, or an illegal identify message during selection, or the scanner has "timed out" waiting for an expected RECEIVE. This will usually be reported in response to a REQUEST SENSE given after the host has detected an unexpected BUS FREE condition.
Receive: <08H, 00H, allocation_length, 00H>Use this command to pass through data from the scanner to the SCSI host. The allocation_length is three bytes that specify the number of bytes of data to be transferred during the Data In phase. An allocation_length of 0 indicates no data to be transferred and is not an error. If the number of bytes available from the scanner (to complete the scan) is less than that asked for via the allocation_length, only that number of bytes will passed to the host; an error will not be set.
For scan data, the "number of bytes available from the scanner" is the number of bytes in the scan which have not yet been passed to the host. If the host has indicated it can handle disconnects, the scanner may disconnect/reconnect a number of times until the allocation_length is satisfied before going to STATUS phase.
Send: <0AH, 00H, transfer_length, 00H>Use this command to pass data to the scanner. The transfer_length is three bytes that specifies the number of bytes of data to be sent during the Data Out phase. A transfer_length of 0 indicates that no data is to be transferred and is not an error.
Inquiry: <12H, 00H, 00H, 00H, allocation_length, 00H>Data identifying the scanner will be returned to the host. The single-byte allocation_length specifies the number of bytes that the initiator has allocated for the returned Inquiry data. An allocation_length of zero indicates that no Inquiry data shall be transferred, and is not an error. The scanner will terminate the Data In phase when allocation_length bytes have been transferred or when all 36 bytes of the Inquiry data have been transferred.
The Inquiry data is <03H, 00H, 02H, 02H, 1FH, 00H, 00H, 00H, "HP", 20H, 20H, 20H, 20H, 20H, 20H, "C2500A", 20H, 20H, 20H, 20H, 20H, 20H, 20H, 20H, 20H, 20H, rev_code>. Rev_code is four bytes of data indicating the revision number of the scanner firmware.
If an Inquiry command is given for a logical unit number other than zero, no error shall be reported and the first byte of the inquiry data will be <7F> instead of <03>.
Write Buffer: <3BH,02H,00H,00H,00H,00H,transfer_length,00H>Use this command with the Read Buffer command to test the scanner buffer memory and the SCSI bus integrity. The transfer_length field is three bytes and specifies the maximum number of bytes that shall be transferred during the DATA OUT phase to be stored in the buffer beginning at location 0. If the transfer_length field specifies a transfer that would exceed the buffer capacity, the scanner will immediately return CHECK CONDITION status and will set the sense key to ILLEGAL REQUEST. (The capacity of the buffer can be determined by the buffer capacity field in the READ BUFFER descriptor.) A transfer_length of 0 indicates that no data transfer will take place and is not an error.
Note: The scanner will NOT disconnect during this command. Be careful how much data is written because the bus will be utilized that whole time.
Read Buffer: <3CH,02H,00H,00H,00H,00H,alloc_length,00H> for data mode<3CH,03H,00H,00H,00H,00H,00H,00H,alloc_length,00H> for descriptor modeUse this command with the Write Buffer command to test the scanner's buffer memory and the SCSI bus integrity. In the data mode version of this command, the DATA IN phase contains buffer data from the scanner's buffer starting at location 0 for alloc_length bytes. Alloc_length is a three byte field. If the alloc_length field specifies a transfer that would exceed the buffer capacity, the data sent in the DATA IN phase will start at location 0 and continue in a "wrap-around" fashion from the beginning of the scanner's buffer until alloc_length bytes are transferred. The size of the scanner's buffer can be determined by sending the Read Buffer command in descriptor mode. A transfer_length of 0 indicates that no data transfer will take place and is not an error.
Note: the scanner will NOT disconnect during this command. Be careful how much data is asked for because the bus will be utilized that whole time.
In the descriptor mode version of this command, a maximum of four bytes of Read Buffer descriptor information are returned. “alloc_length” is a parameter one byte long. If alloc_length is less than four, only alloc_length number of bytes is passed. The data bytes in the DATA IN phase will be <00H,buffer_capacity >, where buffer_capacity is a three-byte field which is the size of the scanner's buffer.
Send Diagnostic: <1DH, 04H, 00H, 00H, 00H, 00H>The scanner will perform its power-on self-test. If the self-test successfully passes, the command shall be terminated with GOOD status; otherwise, the command shall be terminated with CHECK CONDITION status and the sense key shall be set to HARDWARE ERROR. If a CHECK CONDITION status is returned by a command and the next command is not a Request Sense, the sense key information is lost. The scanner will disconnect prior to doing the self-test and reconnect just prior to STATUS phase.
SCSI-2 Hints for UseUse Selection to determine if there is a SCSI device on-line and then use the Inquiry command to determine if that device is indeed the scanner. If the scanner is still going through its self-test, it will not go into command phase. Give the Request Sense command to clear out any pending Unit Attention conditions. When talking to the scanner, use the "Inquire Number of Scan Lines" and "Inquire Bytes Per Scan Line" SCL commands to determine how many bytes of data will be received after the Scan Window command (page 32) is given. The number of bytes in the scan should be asked for in the Receive command following the Send command that passed the Scan Window command. Once the scanner has transferred all the data for the scan, any subsequent Receives commands will receive 0 bytes.
If a long transfer of data needs to be broken up into parts (after giving a Scan Window escape code for instance), multiple Receive commands can be given to the scanner. It will be the host's responsibility to remember to complete all transfers of data so that the total number of bytes received is the number expected from that particular scan.
If a parity error is detected by the host while receiving scan data, the host may send a ABORT or INITIATOR DETECTED ERROR. These will cause the scan to be aborted completely - no retry is possible for parts of scans. Some drivers may, after sending an ABORT message resend the RECEIVE but the scanner will return 0 bytes (with a CHECK_CONDITION unless that had been cleared by the driver) indicating that the scan cannot be continued. Applications must be cognizant of this condition and redo this entire scan.
Parallel Interface Protocol
Applies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C X ScanJet 5200C
ScanJet 4p ScanJet 5p X ScanJet 5100C ScanJet 4100C/6200C
The HP ScanJet 5100C and HP ScanJet 5200C use an EPST driver/chip to interface a host PC to SCSI Bus device via the host’s parallel port. This driver/chip converts all the control and logic functions necessary to implement the parallel-to-SCSI interface and vice versa. The EPST device conforms to the “IEEE Std 1284-1994 Standard Signaling Method for a Bi-Directional Parallel Peripheral Interface for Personal Computers,” and also works with non-compliant 1284 devices that allow port sharing.
The parallel interface is a SCSI interface with a parallel wrapper. SCL commands are passed through the same SCSI interface as other scanners but then the signals are passed on to a parallel converter that then sends the commands to the parallel port arbitrator. The arbitrator controls the parallel bus. If the parallel bus is busy, other commands have to wait until the bus is free before they are sent on to the hardware and out to the scanner. If a printer is daisy chained to the scanner, data is passed through to the printer until a scanner specific code is received and then the scanner will block further data from passing through to the printer until the scanner command has completed. Data passed for the scanner is decoded by the parallel EPST chip on board the scanner and converted back to SCSI. Thus no additional commands are needed for parallel operations.
The HP ScanJet Button Manager is still functional over the parallel interface and is handled by the EPST driver located on the host PC. If the parallel bus is busy and the Button Manager polls the scanner to see if the button has been pressed, the EPST driver reports that the button hasn’t been pressed. Once the button is pressed on the scanner, its state is stored in the scanner until it is read. When the parallel bus is free, the Button Manager is then allowed to read the scanner to see if the button has been pressed.
If you are employing SCSI timeouts within your application, your timeouts might need to be extended 5% or more to handle the extra time associated with converting to and from parallel. In most test cases, little or no delay was observed. Test your application to see what, if any, delay is incurred.
USB Interface
Applies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C X ScanJet 5200C
ScanJet 4p ScanJet 5p ScanJet 5100C X ScanJet 4100C/6200C
The Universal Serial Bus is a new interface being supplied on virtually all PCs, beginning sometime in 1997. It has benefits in the areas of cost and Plug and Play-ability. The peripheral device cost for USB connectors, cabling and silicon are designed to be inexpensive enough for mice and keyboards. The USB cable carries four signals: Power, Ground, and a differential signal pair. Some low power devices can derive power directly from the bus if connected to a powered device upstream. USB devices are automatically detected on connection and disconnection.
USB can accommodate over 100 devices on a single PC. Most PCs currently ship with two connectors. To connect more than two devices, a hub is required. A hub can either be a stand-alone device or part of another USB peripheral. It contains one upstream connector and multiple downstream connectors (usually four).
The bus is designed to handle an aggregate data rate of 12 Mbits/second, and can connect over 100 devices to a single PC. Peripherals such as mice and keyboards run at a slow speed. Cameras and scanners run at high speed. High speed devices can be classified as either Isonchronous or Bulk mode. Isonchronous devices include video cameras or speakers that require a specific bandwidth. HP flatbed scanners are Bulk mode devices, and can use as much of the bandwidth as is left after the Isonchronous mode devices' bandwidth is allocated.
USB drivers make use of the Windows Driver Model (WDM) that was introduced in an OEM release of Windows 95, and also available in Win98 and in NT5. HP scanners actually require OEM Service Release 2 (OSR2) build 1214 for the bug fixes in performance and reliability for bulk mode devices.
Some drivers may, after sending an ABORT message, resend the RECEIVE, but the C6270A will return 0 bytes (with a CHECK_CONDITION unless that had been cleared by the driver) indicating that the scan cannot be continued. Applications must be cognizant of this condition and redo this entire scan!
Universal Serial Bus (USB)This section defines the USB interface. Familiarity with the USB architecture, bus structure, etc. is assumed.
The scanner will be compliant with the USB Specification rev. 1.0. The scanner will implement four endpoints and will behave as a high-speed peripheral. The scanner will not implement USB hub functionality. The scanner will support Remote Wakeup capability to resume a suspended bus if the scan button is pressed. The scanner is a self-powered USB peripheral.
If the scanner has two interfaces (i.e. SCSI and USB) a switching function must be built into the scanner. That is to say, if a USB cable is connected and active and, in addition, the SCSI interface is connected, the scanner must disable one or the other interface. SCSI will prevail in these cases.
Physical CharacteristicsA single B-type USB connector (similar to AMP PN #787780-1) will accept a matching USB plug. The product senses when the cable is attached via the voltage supplied by the USB host (or upstream hub), per USB Specification. Termination is not required on USB devices. USB devices cannot be daisy-chained.
General OperationUSB InterfaceIt is important to first note that the SCSI protocol is not being implemented over the USB interface. With that in mind, the USB interface can be thought of simply as a different message passing mechanism. SCL commands are passed from the host to the scanner. The commands are parsed and status/error information is passed back to the scanner, as is scan data. The USB Specification describes an interrupt type packet. This packet type is used to tell the host about asynchronous scanner events (i.e. someone pressing the scan button). As with the SCSI interface, USB errors are reported by the USB hardware/protocol, and SCL errors are reported via SCL protocols. The scanner supports the Microsoft Still Image class but not the USB Imaging Device Class.
SCSI and USB ArbitrationIf a user attaches the scanner to both SCSI and USB interfaces, SCSI will prevail. There are two times when this event could occur. The first is when the user turns off the scanner and connects the interfaces then turns the scanner back on. At this time, the firmware will sense which interface is connected (starting with SCSI) and pick SCSI if it is connected. The second case is when one or the other interface is connected while the scanner is on. During idle periods, the scanner firmware will sense changes in interface topology and select SCSI if SCSI is connected. In either case, when SCSI is selected, the D+ pull-up resistor is programmatically disconnected causing the host to think the scanner has been disconnected from the USB interface. This disconnection also prohibits the host from realizing that the scanner is connected in the first case mentioned above.
It is important to disconnect one of the interfaces when both are present because the host computer has no way of knowing that the same scanner is connected to two interfaces. Thus the host will present the user with two scanners.
USB EndpointsThe scanner implements a function with four endpoints.
Endpoint 0Endpoint 0 is the mandatory Control endpoint. It is bi-directional, and receives the SETUP packets from the host controller to handle the device class messages. It is implemented with an 8-byte maximum packet size.
Endpoint 1Endpoint 1 is the bulk data IN (to the host) endpoint. It carries the image data from the scanner to the computer. It also carries SCL (Scanner Command Language) command responses to the host. This endpoint is designed to run autonomously, without micro-controller intervention for each packet. It is also designed for maximum throughput (up to 1.5MB/s), using a 64-byte maximum packet size.
Endpoint 2Endpoint 2 is the bulk data OUT (to the scanner) endpoint. It carries scanner command and setup information from the computer to the scanner. USB-specific information is sent over Endpoint 0; this information is the SCL command stream. This pipe does not have to be as fast as Endpoint 1. The micro-controller reads the data from the scanner after each packet is received, assembles and decodes the SCL commands, and performs the required actions.
Endpoint 3Endpoint 3 is an Interrupt endpoint. It is designed to inform the computer of asynchronous events. This endpoint returns zero or one byte of information to the computer.
Chapter 9: How to Build the SCL Library
IntroductionThis chapter describes how to build the SCL library. The 16-bit and 32-bit versions of the SCL library are included with the toolkit. The information in this chapter is necessary for application developers that need to re-build the SCL library for some reason.
The Scanning Software shipped with the HP ScanJet scanner uses the name hpsj32.dll for the SCL library. In the SCL toolkit, a different name for the SCL library (hpscl32.dll) is used. Both of these DLLs have the same functions and the same ordinals for those functions. Therefore, you can use either of these DLLs for SCL library use. However, if you are not modifying the SCL library for your own purposes, and you do not want two copies of the SCL library on the system, you could go ahead and load the hpsj32.dll that is shipped with the HP Scanning Software. Many pieces of the scanning software such as the HP ScanJet Button Manager, link in the hpsj32.lib to their projects, so they need the hpsj32.dll.
If you choose to use the hpscl32.dll provided in the SCL toolkit because you are modifying the source code (or for some other reason), your installation program should install hpscl32.dll. The main point of the different naming, is that if you are modifying the SCL library for your own purposes, you should use a different name other than hpsj32.dll.
Directory StructureThere are 16-bit and 32-bit versions of the SCL library. You can find the files you need for both versions in the following toolkit directory structure:
TK10SCL
COMMON
32BITDLLLIBMSDEVSOURCE
16BIT DLLLIBMSVCSOURCE
The COMMON directory contains the source code for the SCL library that is common to both the 16-bit and 32-bit versions. The make files for the libraries are contained in the MSDEV and MSVC directories. The rest of the source is contained in the SOURCE directory.
If you use the SCL library for Windows 3.x, Windows 9x, or Windows NT, and you need the Microsoft Visual C++ version of the library, use the hpscaner.dll and hpscaner.lib (16-bit SCL library), or hpscl32.dll and hpscl32.lib (32-bit SCL library), located in the appropriate DLL and LIB directories. The Microsoft Visual C++ and Developer Studio versions used are version 1.52 for hpscaner.dll and version 5.0 for hpscl32.dll.
You can also modify the SCL library and rebuild, if necessary.
Building the SCL LibraryIf, for example, you look at the files included in the hpscl32.mpd workspace project on Microsoft Developer Studio version 5.0, you will see the following structure:
The hpscaner.mak project has similar files, except that it needs the hpwnscsi.lib and winscsi.h files too.
As mentioned above, the files needed for building the SCL library are located in several different directories. If you have kept the directory structure of the toolkit the same, you should not have any problems building. Make sure that the entries under Additional Include Directories in the Preprocessor section are pointing to the correct directories on your system.
If you wish to make a new directory and build the SCL library, you must copy all the previously-described files from the various directories to that new directory. Here are the steps to follow:
113.Choose which SCL library you will be building (16-bit or 32-bit).114.Create the new destination directory.115.Copy the appropriate make file and other files from either the MSDEV or MSVC directory. 116.Copy the source files from the TK10\SCL\COMMON directory to your new directory.117.Copy the remaining source files from the TK10\SCL\16BIT\SOURCE or the TK10\SCL\32BIT\SOURCE
directory, depending on which library you are building. For 16-bit library, remember to copy hpwnscsi.lib from TK10\SCL\16BIT\LIB into new directory.
118.Open the SCL library project in your compiler, remove all the files in the project, and then add them back into the project so they are pointing to the files in your new directory. Remove the additional include directories in the preprocessor section that are no longer necessary.
If you are using the 16-bit library, you must include __MSW__ in the preprocessor section of your compiler. If you are using the 32-bit library, you must include __MSW32__ (or you can uncomment the __MSW32__ define in host.h).
119.Uncomment the __VISUALC__ define in host.h, if there, or add this define in your Preprocessor section.120.Build the project.
Chapter 10: SCL Sample Code
IntroductionThis chapter describes the sample code provided with the SCL toolkit.
One of the samples is a 16-bit application, the rest are 32-bit. All the 32-bit sample code is compiled with Microsoft Developer Studio version 5.0. The 16-bit sample code is compiled with Microsoft 16-bit Visual C++ version 1.52. The 32-bit projects are set up in such a way that the “Additional include directories” under the ProjectàSettingsàC/C++àPreprocessor section points to the appropriate directory to find the .h or other files needed. Therefore, you need to have the same directory structure as on the toolkit. If you need to compile the sample programs, you must change the drive letter under the Preprocessor section so that the sample code will compile. Here is the sample code part of the directory structure of the toolkit:
SAMPLE\32BIT
\CONSOLE\LAMPCON\SETSCAN\SCANNING
\MFC\DUALDATA
\SDK\LAMPSDK\SHARPSDK
\16BIT\SCAN
Sample Code
LAMPCON.EXEThis sample program is a console application that shows how to turn the scanner lamp on and off. This program shows how you can use your own functions to obtain sole access to a scanner, and use escape sequences that are sent as commands to the scanner. Therefore, this sample code is not using the SCL library.
Note that there are easier ways for an application to perform the same functions as lampcon.exe (you can use the SCL library). For example, Windows developers could use a ResetScanner function instead of sending the escape codes themselves. Or, you could use ScannerLock or ScannerLockButton to check a scanner in and out instead of writing your own check out and check in functions.
When opening the Lampcon.mdp workspace project, the following files are listed:
167SAMPLE\32BIT\CONSOLE\LAMPCON\lampcon.c168SCL\COMMON\scanner.h169SCL\32BIT\SOURCE\scanerr.h170SCL\32BIT\SOURCE\host.h171SCL\32BIT\SOURCE\platform.h
Because this program is a console application, it will not run on Windows 3.11. It is supported on Windows 95 and Windows NT. The sample needs the hpscl32.dll and hpscnmgr.dll to run on Windows 95 or Windows NT. These files are located in SCL\32BIT\DLL.
Copy the DLLs located in TK10\SCL\32BIT\DLL into your sample code release directory, or to the \<windows95>\system or \<windowsNT>\system32 directory (depending on what operating system you are using). Note that if you have installed the HP Scanning Software that came with your scanner, you will already have the hpscnmgr.dll installed on your system, as well as any drivers and other DLLs required for your scanner to run properly (with the exception of NT). For more information on the scanning drivers and DLLs needed on NT or that HP Scanning Software installs on your system, see File Placements starting on page 125
SETSCAN.EXE This program uses the functions from the SCL library to check out the scanner, reset the scanner, and set the resolution and scaling. This sample demonstrates how to perform these settings, as well as error checking. If an error occurs while sending one of the above commands to the scanner, the return value is the error number. Various errors are checked for, and if an error is detected, a message is printed out to the screen.
This program is also a console application and contains the following files in the project:
172SAMPLE\32BIT\CONSOLE\SETSCAN\Setscan.c173SCL\32BIT\LIB\hpscl32.lib174SCL\COMMON\scanner.h175SCL\32BIT\SOURCE\host.h176SCL\32BIT\SOURCE\platform.h
Because this program is a console application, it will not run on Windows 3.11. It is supported on Windows 95 and Windows NT. The sample needs the hpscl32.dll and hpscnmgr.dll to run on Windows 95 or Windows NT. These files are located in SCL\32BIT\DLL.
Copy the DLLs located in TK10\SCL\32BIT\DLL into your sample code release directory, or to the \<windows95>\system or \<windowsNT>\system32 directory (depending on what operating system you are using). Note that if you have installed the HP Scanning Software that came with your scanner, you will already have the hpscnmgr.dll installed on your system, as well as any drivers and other DLLs required for your scanner to run properly (with the exception of NT). For more information on the scanning drivers and DLLs needed on NT or that HP Scanning Software installs on your system, see File Placements starting on page 125.
SCANNING.EXEFor this console application, various commands are sent to the scanner to set the scan settings, a scan is performed, and the raw data is saved to a file called scan.dat. Scan setting information is saved to a file called scan.hdr. If these files previously existed, they will be overwritten with the new information. So, you must make sure that if the scan.dat and scan.hdr files do exist, they are not read-only files.
The Scanning.mdp project contains the following files:
177SAMPLE\32BIT\CONSOLE\SCANNING\Scanning.c178SCL\32BIT\LIB\hpscl32.lib179SCL\COMMON\scanner.h180SCL\32BIT\SOURCE\host.h181SCL\32BIT\SOURCE\platform.h
Because this program is a console application, it will not run on Windows 3.11. It is supported on Windows 95 and Windows NT. The sample needs the hpscl32.dll and hpscnmgr.dll to run on Windows 95 or Windows NT. These files are located in SCL\32BIT\DLL.
Copy the DLLs located in TK10\SCL\32BIT\DLL into your sample code release directory, or to the \<windows95>\system or \<windowsNT>\system32 directory (depending on what operating system you are using). Note that if you have installed the HP Scanning Software that came with your scanner, you will already have the hpscnmgr.dll installed on your system, as well as any drivers and other DLLs required for your scanner to run properly (with the exception of NT). For more information on the scanning drivers and DLLs needed on NT or that HP Scanning Software installs on your system, see File Placements starting on page 125.
DUALDATA.EXEApplies ScanJet ScanJet + ScanJet IIp ScanJet 3pto: ScanJet IIc ScanJet IIcx ScanJet 3c/4c/6100C X ScanJet 5200C
ScanJet 4p X ScanJet 5p X ScanJet 5100C/4100C X ScanJet 6200C
This MFC application shows the dual scanning capabilities for supported scanners. This is where the scanner will do one scan, but have the scanned data saved off into two different buffers for two different types of scans.
For example, some of the default settings for the two views of a scan are:
View 1 View 2Black and White Threshold Color1 bit/pixel 24 bits/pixel300 dpi X and Y resolution 100 dpi X and Y ResolutionX Extent 2550 pixels X Extent 2550 pixelsY Extent 3508 pixels Y Extent 3508 pixelsdo a full page scan do a full page scan
See SCL Reset starting on page 30 for information about the default settings for the two views when you reset the scanner.
For this particular sample program, the following settings are used:
View 1 View 2Black and White Threshold Color1 bit/pixel 24 bits/pixel100 dpi X and Y resolution 100 dpi X and Y ResolutionX Extent 900 pixels X Extent 900 pixelsY Extent 900 pixels Y Extent 900 pixelsdo not invert image do not invert imagescan a 3x3 inch window scan a 3x3 inch window
These values are set in the scanner by using the different SCL functions or macros available. Note that when using two views like DUALDATA.EXE, the two views need to have the same size scanning window. Incorrect results occur otherwise.
The files that are contained in the dualdata.mdp project are:
182SAMPLE\32BIT\MFC\DUALDATA\dualdata.cpp183SAMPLE\32BIT\MFC\DUALDATA\dualdata.rc184SAMPLE\32BIT\MFC\DUALDATA\dualDlg.cpp185SCL\32BIT\LIB\hpscl32.lib186SAMPLE\32BIT\MFC\DUALDATA\Readme.txt (not used)187SAMPLE\32BIT\MFC\DUALDATA\StdAfx.cpp188SAMPLE\32BIT\MFC\DUALDATA\dualdata.h189SAMPLE\32BIT\MFC\DUALDATA\Res\dualdata.ico190SAMPLE\32BIT\MFC\DUALDATA\dualdata.pch191SAMPLE\32BIT\MFC\DUALDATA\Res\dualdata.rc2192SAMPLE\32BIT\MFC\DUALDATA\dualDlg.h193SCL\32BIT\SOURCE\host.h194SCL\32BIT\SOURCE\scanner.h195SAMPLE\32BIT\MFC\DUALDATA\StdAfx.h196SCL\32BIT\SOURCE\platform.h
This MFC program will not run on Windows 3.11 because of difficulties of running a 32-bit MFC Application on Windows 3.11. This program is supported on Windows 95 and Windows NT, and needs the hpscl32.dll and hpscnmgr.dll to run properly. These files are located in SCL\32BIT\DLL.
Copy the DLLs located in TK10\SCL\32BIT\DLL into your sample code release directory, or to the \<windows95>\system or \<windowsNT>\system32 directory (depending on what operating system you are using). Note that if you have installed the HP Scanning Software that came with your scanner, you will already have the hpscnmgr.dll installed on your system, as well as any drivers and other DLLs required for your scanner to run properly (with the exception of NT). For more information on the scanning drivers and DLLs needed on NT or that HP Scanning Software installs on your system, see File Placements starting on page 125.
LAMPSDK.EXEThis program is written in the Windows SDK method. The main purpose of this application is to show how to register the application with the HP ScanJet Button Manager database, so that if a user presses the button on the scanner, it will launch the lampsdk.exe application. Once the program is running, it allows the user to turn the scanner lamp on or off by clicking on the appropriate radio button.
The files contained in the lampsdk.mdp project are:
197SCL\32BIT\LIB\hpscl32.lib198SAMPLE\32BIT\SDK\lampsdk.c199SAMPLE\32BIT\SDK\lampsdk.rc200BTTNMGR\32BIT\reg32.lib201SCL\32BIT\SOURCE \host.h202SAMPLE\32BIT\SDK\ico_main.ico203SAMPLE\32BIT\SDK\lampsdk.h204BTTNMGR\COMMON\regdll.h205SCL\COMMON\scanner.h206SCL\32BIT\SOURCE \platform.h
You need hpscl32.dll, reg32.dll, and hpscnmgr.dll to run this application on Windows 95 or Windows NT. To run the program on Windows 3.11, you need hpscl32.dll, reg32.dll, and hpsm32s.dll. Copy these DLLs located in the TK10\SCL\32BIT\DLL and TK10\BTTNMGR\32BIT directories to your sample code release directory, or to the <Window95s>\system or <WindowsNT>\system32 directory (depending on your operating system).
Note: If you have installed the HP Scanning Software that came with your scanner, you will already have the hpscnmgr.dll or hpsm32s.dll installed on your system, as well as any drivers and other DLLs that are required for your scanner to run properly (with the exception of NT). For more information on the scanning drivers and DLLs needed for NT or that the HP Scanning Software program installs on your system, see File Placements starting on page 125.
Since this sample program does not have an install program that will handle the initial registration requirements with the Button Manager database, you will need to run the program once by double-clicking on lampsdk.exe in the File Manager. Then you can bring up the HP ScanJet Button Manager dialog box and see that the sample application will be listed as a choice of default software to launch. Select “Lamp Test” as your default application, close the Button Manager window, and then press the Scan button on the front of the scanner. See Chapter 6: HP ScanJet Button Manager on page 105 for more information about the Button Manager tool.
To run this sample program on a scanner without a front button, double-click on lampsdk.exe in the File Manager.
SHARPSDK.EXEThis program is written in the standard C Windows SDK method. The program shows how to do various levels of sharpening on scanned images in software. The software sharpening DLLs were created for developers to use because scanners previous to the HP ScanJet 5p do not support hardware sharpening. The HP ScanJet 5p, 4100C, 5100C, 5200C and 6200C have hardware sharpening capabilities.
In order to perform the sharpening in hardware, this program would use a different DLL and .lib. These files are SHARPEN\HARDWARE\hphwtran.dll and SHARPEN\HARDWARE\hphwtran.lib.
This program lets the user click on a button that represents how much sharpening is to be done. The user has a choice of none, slight, medium, strong, and extra strong. When the user clicks a button, a scan is performed, and that amount of sharpening is applied to the scanned data. For information on SCL’s sharpening routines, see Chapter 5: Hardware and Software Sharpening on page 103.
The files contained in the sharpsdk.mdp project are:
207SCL\32BIT\LIB\hpscl32.lib208SHARPEN\SOFTWARE\LIB\hpswtran.lib209SAMPLE\SDK\SHARPSDK\resource.h210SAMPLE\SDK\SHARPSDK\sharpsdk.c211SAMPLE\SDK\SHARPSDK\sharpsdk.rc212SCL\32BIT\SOURCE\host.h213SAMPLE\SDK\SHARPSDK\ico_main.ico214SCL\COMMON\scanner.h215SAMPLE\SDK\SHARPSDK\sharpsdk.h216SHARPEN\COMMON\shrptran.h217SCL\32BIT\SOURCE\platform.h
You need hpscl32.dll, hpscnmgr.dll, and hpswtran.dll to run this program on Windows 95 and Windows NT. This program will also run on Windows 3.11, but will need hpsm32s.dll instead of hpscnmgr.dll. Also, you must have Win32s running on your system for any of these 32-bit sample applications.
Copy the DLLs located in TK10\SCL\32BIT\DLL into your sample code release directory, or to the \<windows95>\system or <windowsNT>\system32 directory (depending on what operating system you are using). Note that if you have installed the HP Scanning Software that came with your scanner, you will already have the hpscnmgr.dll installed on your system, as well as any drivers and other DLLs required for your scanner to run properly (with the exception of NT). For more information on the scanning drivers and DLLs needed on NT or that HP Scanning Software installs on your system, see File Placements starting on page 125.
SCAN.EXEThis sample is a 16-bit QuickWin application. This program uses an .INI file to setup the scanner. A scan is performed and the start time, stop time, and time to scan are displayed. The files contained in the scan.mak project are:
218SCL\16BIT\SOURCE \host.h219SCL\16BIT\LIB\hpscaner.lib220SAMPLE\16BIT\SCAN\scan.mak221SAMPLE\16BIT\SCAN\scan.c222SAMPLE\16BIT\SCAN\utils.c223SAMPLE\16BIT\SCAN\readini.c224SCL\COMMON\scanner.h225SAMPLE\16BIT\SCAN\scanvars.h
The files Scanner.ini and Test.ini are also needed. (See .ini file description on next page)
The INI FilesThe INI files specify the settings of the scanner parameters. Each time a new INI is read, variables take on what the latest setting is specified to be. Thus, if there are two INI files called NEG_ON.INI and NEG_OFF.INI where:
NEG_ON.INI -- contains the one line: Negative = 1NEG_OFF.INI -- contains the one line: Negative = 0
the command line:
scan /i=NEG_ON.INI /i=NEG_OFF.INI
sets the value of Negative to OFF. The default initialization (INI) settings are in the scanner.ini file, which is always read at startup.
Note: This program is not meant to be complete or inclusive of all error checking and scanner settings that can be made.
The READINI.C ProgramThe program opens the INI file and parses each line. If a line is blank, or starts with a "*" or ";", it is skipped. Otherwise the line is broken into a TOKENWORD and a VALUE. The TOKENWORD is compared to a list of defaults, and if found, the scanner parameter associated with that token is set to the VALUE. Note that the value is always checked. Note too that the allowable values are hard-0wired. It would be better to inquire of the scanner what the min and max of the values are, and compare the requested values to the Inquire'd returns. This would make the program upwards compatible with new scanner devices.
The UTILS.C ProgramThis program contains a number of string and report utilities used by the READINI and SCAN programs. Browse the program to see the calls used.
The SCAN.C ProgramThis program obtains exclusive use of the scanner, reads the scanner.ini file, and parses the command line. The program then sets up the scanner according to the .ini files, and the Scan function is called. The raw scan data is saved in scan.dat, and a scan.hdr file is created to show the scanner settings.
The following figure shows a sample usage of SCAN.EXE (without any command line options):
This sample will need the 16-bit SCL library (hpscaner.dll) and hpwnscsi.dll to run.
Note: If you have installed the HP Scanning Software that came with your scanner, you will already have the hpscaner.dll and hpwnscsi.dll installed on your system, as well as any drivers and other DLLs that are required for your scanner to run properly (look in the \<windows>\system directory on Windows 3.11 or Windows 95). Also, the hpscaner.dll will most likely be loaded because the HP ScanJet Button Manager is always running. Therefore, if you have modified the source of the hpscaner.dll for some reason, and you want to run an application with the modified version of hpscaner.dll, you must replace the copy of hpscaner.dll in the \<windows>\system directory.
Building the 32-bit Sample ProgramsTo build the 32-bit sample applications, you need a 32-bit compiler. Microsoft Developer Studio version 5.0 was used to create all of these samples. The executables are on the toolkit if you just want to run the samples. Of course, you will need the appropriate DLLs and drivers to run the programs for whatever operating system you are on.
To rebuild the sample application after modifying the program, follow the steps below, noting that:
226The 32-bit sample code was compiled using Microsoft Developer Studio version 5.0.227You should have the same directory structure on your system for the sample code as the toolkit has.
121.Open up the compiler and select “Open Workspace” under the file menu.122.Go to the desired sample code directory, select the .mdp workspace file and click OK.123.Go to the Project menu item and select “Settings.”124.Choose the C/C++ tab and choose the “Preprocessor” category.125.If necessary, under the “Additional include directories”, modify the drive letter so that it is correct for where the
sample code and include files are located on your system.126.Go to the Link tab and verify that the path to the hpscl32.lib is correct under Object/library modules. (Except for
Lampcon which does not use the SCL library)127.Click OK.128.Select “Rebuild all” or “build <name of program>.exe”.
To run the program, you will need the appropriate DLLs set up on your system. The most common DLLs needed for Windows 95 are the hpscl32.dll and hpscnmgr.dll. If the sample is the Lampsdk.exe you will also need reg32.dll. These can be put in the WINDOWS\SYSTEM directory. To run Sharpsdk.exe you will need hpswtran.dll.
Building the 16-bit Sample ProgramTo build the 16-bit sample program, follow the steps below, noting that:
228The 16-bit sample was compiled using Microsoft Visual C++ version 1.52.229You should have the same directory structure on your system for the sample code that the toolkit has.
129.Under Project, open the make file. 130.Go to OptionsàProjectàCompileràPreprocessor.131.Under “Include Path”, modify the drive letter if necessary so that it is correct for where the sample code include
files are located.132.Build the project.
To run the program on Windows 3.11, you will need hpscaner.dll and hpwnscsi.dll.
Things to Remember When Creating a New ApplicationThe following hints will help you create an application:
230The 16-bit and 32-bit host.h are different.231If the new application will use host.h as an include file, make sure that the preprocessor definitions needed are
added to the preprocessor definition sections. Look in host.h for what you need. Alternatively, you can uncomment the defines you need in host.h and comment out the ones you do not need. For example, __VISUALC__, __BORLAND__, __MSW__, __MSW32__, __MAC__, __UNIX__, __OS2__, __PM__.
See File Definitions starting on page 126 and File Placements starting on page 125
Appendix A: SCL Command Summary and Support Matrix
Command Summary and SupportCommand Code Inquiry
IDRange Default S
canJet
ScanJet+
IIp
IIc
IIc
*
IIcx
3p
3c/4c/6100C
4p
5p
4100C/5100C
6200C
5200C
Automatic Background Esc*a#B 10307 0=Off,1=On 0 X X X X X X X N N N N N NCompression Esc*a#C 10308 0=No compression,1=PackBits 0 X X X XDownload Type Esc*a#D 10309 0=B/W Dither X X X X X X X X X X X X
1=GrayscaleTone Map X X X X X X X X X X X X2=Matrix Coefficient X X X X X X X X X3=Color Dither X X X X4=Cal Strip111111 X X X X X X X X5=16x16 B/W Dither X X X X X X6=10x8 Tone Map X8=B/W Matrix Coefficients X X X X9=10-bit Color Matrix Coefficients X X X X10=RGB 7x12 Tone Maps X X X X11=B/W 7x12 Tone Maps X X X X
X Scale(see Scaling and Resolution Ranges on page 163)
Esc*a#E 10310 (7-1578) Variable (1-5000) Variable(1-6666) Variable(1-10,000) Variable
100100100100
XX
XX X X
XXZ
X X X X X
Y Scale(see Scaling and Resolution Ranges on page 163)
Esc*a#F 10311 (7-1578) Variable(1-5000) Variable(1-6666) Variable(1-10,000) Variable
100100100100
XX
XX X X
XXZ
X X X X X
Output Data Type Esc*a#T 10325 0=B/W Threshold, 1 = Wht, 2=Blk, 3=Dither 0 X X X X X X X X X X X X X4=Grayscale X X X X X X X X X X X X X5 = Color X X X X X X X X X6=Color Threshold, 7=Color Dither X X X X8=Chunk Threshold, 9=Chunk Dither X X X X50=Fast B/W Bin X X51=Fast B/W Dither X X52=Fast Grayscale 4-bit X X
Data Width Esc*a#G 10312 Variable variablefor Thresholded data type (0) 1 1 X X X X X X X X X X X X Xfor White data type (1) 1 1 X X X X X X X X X X X X Xfor Black data type (2) 1 1 X X X X X X X X X X X X Xfor Dithered date type (3) 1 1 X X X X X X X X X X X X Xfor Grayscale data type (4) 4 4 X X X X X X X X X X X X X
8 X X X X X X X X X X X X10 X X X X X12 X X X X
for Color data type (5) 24 24 X X X X X X X X X30 X X X X X36 X X X X
for Color Thresholded data type (6) 3 3 X X X Xfor Color Dithered data type (7) 3 3 X X X Xfor Chunky Thresholded data type (8) 4 4 X X X Xfor Chunky Dithered data type (9) 4 4 X X X Xfor Fast B/W Thresholded data type (50) 1 1 X Xfor Fast B/W Dithered data type (51) 1 1 X Xfor Fast B/W Grayscale data type (52) 4 4 X X
Inverse Image Esc*a#I 10314 0=Normal,1=Inverse 0 X X X X X X X X X X X X XB/W Dither Pattern Esc*a#J 10315 -1=User,
0= Coarse 1=Fine, 2=Bayer, 3=Vertical 0 X
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
Contrast Level Esc*a#K 10316 (smaller diff.) -127 - +127 (larger) 0 (normal) X X X X X X X X X X X XIntensity Level Esc*a#L 10317 (darker) -1 - 1 (lighter)
(darker) -127 - +127 (lighter)0 (normal)0
XX X X X X X X X X X X X
Mirror Image Esc*a#M 10318 0=Off,1=On 0 X X X X X X X X X X X XWindow X Extent (Dec) Esc*a#P 10321 3-6120 6120 X X X X X X X X XWindow Y Extent (Dec) Esc*a#Q 10322 3-10080 8420
10080X X X
X X XX
X XX Res Esc*a#R 10323 38-600
12-150012-1600
300300300
XX X
X X XX
X X X X X XY Res Esc*a#S 10324 38-600
12-150012-1600
300300300
XX X
X X XX
X X X X X XDownload Binary Esc*a#W[data] 10328 Size: Dither=64 X X X X X X X X X X X X
Command Code InquiryID
Range Default ScanJet
ScanJet+
IIp
IIc
IIc
*
IIcx
3p
3c/4c/6100C
4p
5p
4100C/5100C
6200C
5200C
Tone Map=256 X X X X X X X X X X X XMatrix Coeff.=9 X X X X X X X X XColor Dither=192 X X X XCal Strip=3 X X X X X X X X16x16 B/W Dither=256 X X X X X X10x8 Tone Map=1024 XB/W Matrix Coefficients=6 X X X X10-bit Color Matrix Coefficients=18 X X X XRGB 7x12 Tone Maps=774 X X X XB/W 7x12 Tone Map=258 X X X X
Window X Pos (Dec) Esc*a#X 10329 0-6118 0 X X X X X X X X XWindow Y Pos (Dec) Esc*a#Y 10330 0-10078 0 X X X X X X X X XSet Number of Views Esc*f#A 10466 1-2 1 X X X XSet View Esc*f#B 10467 0-1 0 X X X XPreload ADF Esc*f#C 10468 0=first page only; 1=every page 0 X X X XPos Secondary Elem Esc*f#F 10471 0-3507
0-41990 X X X
X X XX
X XX X X X
Light Source Test Esc*f#L 10477 0=Off, 1=On 0 X X X X X X X X X X X X XSet Window X Ext (Pix) Esc*f#P 10481 1-2550 2550 X X X X X X X X X X X X XSet Window Y Ext (Pix) Esc*f#Q 10482 1-4200
1-3508; 1-4200 w/ADF
350842003508
X X XX X X
XX X
X X X XSet Scan Window Esc*f0S 0 0 X X X X X X X X X X X X XSet Window X Pos (Pix) Esc*f#X 10489 0-2549 0 X X X X X X X X X X X X XSet Window Y Pos (Pix) Esc*f#Y 10490 0-4199
0-3499 (4199 w/ ADF)0 X X X X X X X X X
X X X XUpload Binary Esc*s#U 10902 0=B/W Dither Pattern
1=Grayscale Tone Map 2=Matrix Coefficient.3=Color Dither4=Cal Strip5=16x16 B/W Dither6=10x8 Tone Map8=B/W Matrix Coefficients9=10-bit Color Matrix Coefficient.10=RGB 7x12 Tone Map11=B/W 7x12 Tone Map
0 XX
XX
XXXX
XXXXX
XXXXX
XX
XXXXXXX
XXX
XX
XXX
XX
XXXX
XXX
XX
XXXX
XXX
XX
XXXX
XXX
XX
XXXX
Set Calibration Y Start Esc*u#A 10946 -1 - 4099-1 - 3499
-1-1
X X X XX X X X
Set Byte Order Esc*u#B 10947 0=MSB, LSB; 1=LSB,MSB 0 X X X X XSet Calibration Strip Parameters Esc*u#C -1=Download Parameters
0=Auto Select1=Default for Normal Scan2=Default for Transparency Scan
0 X X X X X X X
Transparency Adapter Scan Window
Esc*u0D 0 0 X X X X X X X
Speed Mode Esc*u#E 10950 0=Automatic X X X X X1=Illegal Command X1=Slow X X X X2=Normal, 3=Fast X X X X X4=Extra Fast X
Set Filter Esc*u#F 10951 0=Auto-Filter, 1=2-pixel2=4-pixel, 3=Off Always 4=8-pixel
0 XX
XX
XX
XXX
XXX
Transparency Adapter Disable/Enable
Esc*u#H 10953 0=Enable,1=Disable 0 X X
Color Dither Pattern Esc*u#J 10955 -1= User0= Coarse Fatting
0 XX
XX
XX
XX
Set Tone Map Esc*u#K 10956 -2=B/W User-1=User0= Contrast/Intensity Model
0XX
XX
XX
XX
XX
XX
XX
XX
XXX
XXX
XXX
XXX
Recalibrate Esc*u0R 0 0 X X X X X X XADF Scan Window Esc*u0S 0 0 X X X X X X X X XSet Matrix Coef Esc*u#T 10965 variable variable
-2=Download (3x1 B/W) X X X X-1=Download (3x3 Color), 0=RGB X X X X X X X X X1=B/W NTSC, 2=Pass Thru X X X X X X X X X3=Red Only, 4=Blue Only X X X X X X X X X5=Transparency Adapter RGB X X5=Red, Green, Blue sRGB X X X6=Transparency Adapter B/W NTSC X X
Unload Document Esc*u0U 10966 0 0 X X X X X X X X XChange Document Esc*u0X 10969 0 0 X X X X X X X X X
Command Code InquiryID
Range Default ScanJet
ScanJet+
IIp
IIc
IIc
*
IIcx
3p
3c/4c/6100C
4p
5p
4100C/5100C
6200C
5200C
ADF Bkgrd Feed Esc*u0Y 10970 0 0 X X X X X X XClear Errors Esc*oE X X X X X X X X X X X X XReset EscE X X X X X X X X X X X X XX = Fully supported by this scanner. N = Not fully supported by this scanner. Can be set but provides no functionality change.Z = On HP ScanJet 4c with 3642 datecode or later.* = The enhanced SCSI ScanJet IIc appears in units with date code 3226 or later; in units with serial prefix 3265A or later.
Inquire Summary and SupportInquire Device Parameter Code Inquiry
IDResponse Values Default S
canJet
ScanJet+
IIp
IIc
IIc
*
IIcx
3p
3c/4c/6100C
4p
5p
5100C
4100C
6200C
5200C
HP Model #1 3 (HP ScanJet) 9190A(HP ScanJet +) 9195A
XX X X X X X X X X X X X X
HP Model #2 10 (HP ScanJet IIc) 1750A X X X XHP Model #3 9 (HP ScanJet IIp) 1790A X XHP Model #4 11 (HP ScanJet IIcx) 2500A X XHP Model #5 12 (HP ScanJet 3c/4c/6100C) 2520A XHP Model #6 14 (HP ScanJet 3p) 2570A XHP Model #8 15 (HP ScanJet 4p) 1130A X X X X X XHP Model #9 16 (HP ScanJet 5p) 5110A
(HP ScanJet 5100C) 5190A(HP ScanJet 4100C) 6290A
XX
X
X X
HP Model #14 21 (HP ScanJet 6200C) 6270A X XHP Model #16 31 (HP ScanJet 5200C) 7190A XFirmware Date 4 4 bytes X X X X X X X X X X X X X XADF Capability 24 0=No, 1=Yes X X X X X X X X X X X X X XADF Bin 25 0=No, 1=Yes X X X X X X X X X XOpen Since last Chg
ADFTransparency Adapter
26 0=No, 1=YesX X X
XXX
X X X X X X
Ready to Unload 27 0=No, 1=Yes X X X X X X X X X XTransparency Adapter Capability 28 0=No, 1=Yes X XTransparency Adapter Ready 30 0=No, 1=Yes X XMax Error Stack 256 1 1 X X X X X X X X X X X X X XCurrent Error Stack 257 0=None, 1=Err X X X X X X X X X X X X X XCurrent Error # 259 0-4, 1024-1025
0-7,1024-10250-8, 1024-10260-9, 1024-10260-10,1024-1026
XX X
XX
X
X
X X X X X X XOldest Error 261 0-4, 1024-1025
0-7,1024-10250-8, 1024-10260-9, 1024-10260-10,1024-1026
XX X
XX
X
X
X X X X X X XPixels/Scan Line 1024 X X X X X X X X X X X X X XBytes/Scan Line 1025 X X X X X X X X X X X X X XNumber Scan Lines 1026 X X X X X X X X X X X X X XADF Ready 1027 0=No, 1=Yes X X X X X X X X X X X X X XDevice Pixels/inch 1028 300 300 X X X X X X X X X X X X X XNative Optical Resolution 1029 300
400600
300400600
X X XX
X X X X X X
Auto Filtering 1031 X XInquire Auto Speed Mode 1040 X X X X X XInquire Preloaded 1045 0=No, 1=Yes X X X X XX = Fully supported by this scanner. N = Not fully supported by this scanner. Can be set but provides no functionality change.* = The enhanced SCSI ScanJet IIc appears in units with date code 3226 or later; in units with serial prefix 3265A or later.
Error Codes0 Command Format Error Escape Sequence has illegal Format
1 Unrecognized Command Escape Sequence has proper format, Function not supported2 Parameter Error Parameter value out of legal bounds3 Illegal Window Window and scannable area do not intersect4 Scaling Error Scale factor out of bounds5 Dither ID Error Dither selected, not downloaded before (dithered) scan6 Tone Map ID Error Tone Map selected, not downloaded before scan7 Lamp Error Lamp did not achieve required intensity8 Matrix ID Error Matrix selected, not downloaded before scan9 Cal Strip Param Error Cal Strip selected, not downloaded before scan10 Gross Calibration Error Scanner could not calibrate a substantial # of pixels1024 ADF Paper Jam Paper jam in the document feeder1025 Home Position Missing Scanner element failed to return to home position1026 Paper Not loaded Change Document Command issued, no paper in input
Inquire SyntaxInquire Type Inquire Esc Seq Response Esc Seq Null ResponseInquire Present Value Esc*s$R Esc*s$p#V Esc*s$pNInquire Minimum Value Esc*s$L Esc*s$k#V Esc*s$kNInquire Maximum Value Esc*s$H Esc*s$g#V Esc*s$gNInquire Device Parameter Esc*s$E Esc*s$d#V Esc*s$dNUpload Binary Data Esc*s$U Esc*s$t#W[data] Esc*s$tNFor the above table, the inquiry id of the desired SCL parameter is represented by “$”. The value returned to the host is represented by “#”.
Scaling and Resolution RangesHP ScanJet
(x,y): 3750 <= scale factor * resolution <= 60,000 for all data typesx: scale factor * resolution * bits/pixel * extent <= 2048 bytes
HP ScanJet +(x,y): 1200 <= scale factor * resolution <= 60,000 for all data types
HP ScanJet IIp, 3p(x,y): 1200 <= scale factor * resolution <= 120,000 for binary or 4-bit Grayscale(x,y): 1200 <= scale factor * resolution <= 60,000 for 8-bit Grayscale
HP ScanJet IIc(x,y): 1200 <= scale factor * resolution <= 80,000 for all data types
HP ScanJet IIcx(x,y): 1200 <= scale factor * resolution <= 80,000 for all data types except 50, 51, 52(x,y): 1200 <= scale factor * resolution <= 60,000 for 50, 51, 52 (fast B/W Threshold, fast B/W Dither, fast 4-bit Grayscale)
HP ScanJet 3c/4c/6100Cx: 1200 <= scale factor * resolution <= 120,000 for most data types in normal speedx: 1200 <= scale factor * resolution <= 60,000 for most data types in fast speedx: 1200 <= scale factor * resolution <= 40,000 for most data types in extra fast speedy: 1200 <= scale factor * resolution <= 120,000 for most data types in normal, fast, and extra fast speed(x,y): 1200 <= scale factor * resolution <= 60,000 for 50, 51, 52 (fast B/W Threshold, fast B/W Dither, fast 4-bit Grayscale)x: 1200 <= scale factor * resolution <= 60,000 for 10-and 30-bit data types in normal speedx: 1200 <= scale factor * resolution <= 30,000 for 10-and 30-bit data types in fast speedx: 1200 <= scale factor * resolution <= 20,000 for 10-and 30-bit data types in extra fast speedy: 1200 <= scale factor * resolution <= 60,000 for 10-and 30-bit data types in normal, fast, and extra fast speed
HP ScanJet 4p(x,y); 1200 <= scale factor * resolution <= 60,000 for all data types
HP ScanJet 5p, 4100C, 5100C, 5200C, 6200C(x,y); 1200 <= scale factor * resolution <= 30,000 for all color data types and NTSC Grayscale, at fast speed(x,y): 1200 <= scale factor * resolution <= 60,000 for all other data types and speeds
Appendix B: ASCII Character Codes
ASCII Character CodesDec Oct Hex Chr Dec Oct Hex Chr Dec Oct Hex Chr000 000 00H NUL 045 055 2DH - 090 132 5AH Z001 001 01H SOH 046 056 2EH . 091 133 5BH [002 002 02H STX 047 057 2FH / 092 134 5CH \003 003 03H ETX 048 060 30H 0 093 135 5DH ]004 004 04H EOT 049 061 31H 1 094 136 5EH ^005 005 05H ENQ 050 062 32H 2 095 137 5FH _006 006 06H ACK 051 063 33H 3 096 140 60H `007 007 07H BEL 052 064 34H 4 097 141 61H a008 010 08H BS 053 065 35H 5 098 142 62H b009 011 09H HT 054 066 36H 6 099 143 63H c010 012 0AH LF 055 067 37H 7 100 144 64H d011 013 0BH VT 056 070 38H 8 101 145 65H e012 014 0CH FF 057 071 39H 9 102 146 66H f013 015 0DH CR 058 072 3AH : 103 147 67H g014 016 0EH SO 059 073 3BH ; 104 150 68H h015 017 0FH SI 060 074 3CH < 105 151 69H i016 020 10H DLE 061 075 3DH = 106 152 6AH j017 021 11H DC1 062 076 3EH > 107 153 6BH k018 022 12H DC2 063 077 3FH ? 108 154 6CH l019 023 13H DC3 064 100 40H @ 109 155 6DH m020 024 14H DC4 065 101 41H A 110 156 6EH n021 025 15H NAK 066 102 42H B 111 157 6FH o022 026 16H SYN 067 103 43H C 112 160 70H p023 027 17H ETB 068 104 44H D 113 161 71H q024 030 18H CAN 069 105 45H E 114 162 72H r025 031 19H EM 070 106 46H F 115 163 73H s026 032 1AH SUB 071 107 47H G 116 164 74H t027 033 1BH ESC 072 110 48H H 117 165 75H u028 034 1CH FS 073 111 49H I 118 166 76H v029 035 1DH GS 074 112 4AH J 119 167 77H w030 036 1EH RS 075 113 4BH K 120 170 78H x031 037 1FH US 076 114 4CH L 121 171 79H y032 040 20H SP 077 115 4DH M 122 172 7AH z033 041 21H ! 078 116 4EH N 123 173 7BH {034 042 22H " 079 117 4FH O 124 174 7CH |035 043 23H # 080 120 50H P 125 175 7DH }036 044 24H $ 081 121 51H Q 126 176 7EH ~037 045 25H % 082 122 52H R 127 177 7FH DEL038 046 26H & 083 123 53H S039 047 27H ' 084 124 54H T040 050 28H ( 085 125 55H U041 051 29H ) 086 126 56H V042 052 2AH * 087 127 57H W043 053 2BH + 088 130 58H X044 054 2CH , 089 131 59H Y
Appendix C: Frequently Asked Questions
Frequently Asked QuestionsQ: What is the Scanner Control Language (SCL)?
A: The Scanner Control Language (SCL) is a toolkit for experienced programmers. SCL gives your application precise control over the behavior and state of the scanner and its components (such as Automatic Document Feeders and Transparency Adapters). SCL also provides inquiry routines to allow your application to determine the current state of the scanner and its components.
Q: What scanners and operating systems are supported with the HP SCL Toolkit?
A: Only the stand-alone flatbed HP ScanJet scanners are supported with the HP SCL Toolkit. Products that are not supported with the HP SCL Toolkit include the HP ScanJet 4s/5s, HP Network ScanJet 4si/5, HP PhotoSmart products, and the HP OfficeJet products. Please refer to the HP Developer Web Site for more information on all these products. ( http://www.hp.com/go/devexchange/ ) Refer to the Product Descriptions Table on page 1 for the operating systems currently supported by these toolkits.
Q: What programming languages does the HP SCL Toolkit support?
A: The HP SCL Toolkit is designed for C/C++ development. The HP SCL Toolkit does include source code for developers who need to recompile the HP SCL library for use with other languages or compilers.
Q: Does the SCL Toolkit include documentation on the HP ScanJet SCSI command set?
A: Yes. Complete information on the SCSI command set for the HP ScanJet scanners is included in the HP SCL Toolkit documentation. (See Chapter 8: Input/Output Protocols on page 129 for more information.)
Q: Where can I get information about signing up with the HP Peripherals Developers Program?
A: Complete information is available on the HP web site at http://www.hp.com/go/devexchange/ .
Q: Where can I get the latest drivers/software for my HP ScanJet Scanner?A: http://www.scanjet.hp.com/ then select Support & Upgrades.
Q: Where can I find product specifications on my HP ScanJet Scanner?A: http://www.scanjet.hp.com/ then select Products.
Q: I am in the process of porting my 16-bit application to a 32-bit application. I use your 16-bit SCL library in my application. I am having problems where the scanner driver will not go into Binary mode, despite using the “Virtual” IOCTL call available on Windows 95. How can I correctly access an HP ScanJet Scanner?
A: The 32-bit SCL library needs to be used when you have a 32-bit application that wants to connect and use an HP ScanJet Scanner. The 32-bit SCL library has been available since the 6.0 version of the SCL library.
To access an HP ScanJet Scanner through the 16-bit SCL library, you would do the following:if ((Handle = _lopen(“HPSCAN”, OF_READWRITE)) != (-1))
In the 32-bit SCL library, you now use one of the following functions to obtain exclusive use of the scanner:INT16 FP ScannerLock(INT16 hWnd, INT16 bLock);
orINT32 ScannerLockButton(HWND hWnd, INT16 bLock);
Parameters:hWnd -- Handle to the window requesting the lock/unlock (exclusive use of scanner by loading Dynamic
Link Library- hpscnmgr.dll or hpsm32s.dll)bLock -- locking operation.
These functions will obtain exclusive use of the scanner by locking the library (e.g. hpscnmgr.dll or hpsm32s.dll). When the library is locked, all other attempts to lock the library will fail unless the current window has been destroyed. When the scanner is no longer needed, the library should be unlocked. Please refer to the SCL toolkit documentation version 7.0 or later to understand the differences between ScannerLock and ScannerLockButton.
Q: Does the HP SCL Toolkit include support for saving the image data to a graphics file?
A: No, but third-party imaging software is available for saving the raw data to one of many popular graphics formats including BMP, GIF, JPEG, and TIFF. HP cannot recommend any specific product or make any warranties about its applicability or compatibility with the HP ScanJet products or HP SCL Toolkit. The following is a company that provides imaging software for developers:
Lead Technologies, Inc.
· http://www.leadtools.com/
·Q: Does HP provide UNIX support for HP ScanJet Scanners?A: HP relies on third party companies to provide UNIX solutions, such as Mentalix, Inc.
26Telephone: 1-800-MENTALX27Electronic Mail: [email protected]
28WEB: http://www.pfx.com/29Q: Does HP provide OS/2 support for HP ScanJet Scanners?A: HP relies on third party companies to provide OS/2 solutions, such as Danmar Corporation and Solution
Technology.
Danmar Corporation:30Telephone (305) 388-4671
31Solution Technology:32Telephone (561) 241-321033WEB: http://www.gate.net/~stidev
34Q: I added macro definitions to HOST.H as specified in the HP SCL documentation for 32-bit SCL applications, but
this results in several macro redefinition warnings when compiling my application. How can I prevent this?
A: Rather than adding macro definitions (e.g. __MSW__, __MSW32__, and __VISUALC__), we recommend modifying the preprocessor settings for your project so the necessary macros are defined at compile time. This should prevent the redefinition warnings when you compile your project.
Q: Why do I get the error SL_BADCOMMAND when attempting to download my custom Tone Map with the Download function?
A: The prototype for the Download function is as follows:
INT16 FP Download(INT16 Type, PUINT8 Data);
When you download the data using the Download function, the first parameter will be the type of data to be sent. It is the same numerical value specified for the SetDownloadType function. (Refer to Set Download Type on page 58 for the list of valid options.) The second parameter will be the pointer to the array of data to be sent to the scanner.
Q: Which DLLs and drivers may be distributed with an SCL application?
A: The SCL library and support drivers (e.g. HPSCNMGR.DLL and SJIIX.SYS) may be distributed with your application if necessary. The HP Scanning Software that is bundled with the HP ScanJet scanner (e.g. HP PictureScan, HP DeskScan, and HP PrecisionScan) cannot be distributed with your application. Distribution of the ASPI drivers requires a license from Adaptec.
To obtain an end-user ASPI license, contact ADAPTEC at: www.adaptec.com
Phone: (408) 945-8600 Fax: (408) 262-2533
Q: When attempting to make a call to the Scan function, I always get the error SL_BADACCESS. What is wrong?A: You may need to check several things:
1. Make sure all cables are connected properly and the scanner is turned on. Make sure the SCSI card or other adapter is firmly set.
2. Make sure all drivers are installed. We recommend installing from the CD or disks that were provided with your scanner.
3. Make sure no other applications are currently using the scanner.
4. Check for error conditions when using the SCL functions. Make sure the scanner is properly locked with ScannerLock or ScannerLockButton and has been reset with ResetScanner.
5. The requested data size may be too large for the SCSI adapter and drivers to handle, especially on a Windows NT platform. Rather than request the entire data set in a single call to Scan, try requesting the image data piecemeal, no greater than 64 kilobytes at a time. For scanners that support it, such as the HP ScanJet 5p and 5100C, data compression can minimize the time necessary to receive all of the data.
Q: I am using the SCL Scan() function in my application. I am requesting to receive the whole buffer of scan data at one time. While performing the scan, the scanner begins scanning but then stops. The scanner lamp remains lit and the carriage does not retract for approximately 5 minutes. What could be the problem?
A: This could be a data transfer problem. Theoretically you could request the whole buffer size but the scanner can scan at a faster rate than data can be transferred over the SCSI bus. Since the amount of data that can be transferred at one time over the SCSI bus varies with different SCSI cards, a safe transfer amount is less than 64K at a time. The following code has an example of how to use the Scan function to scan a complete image in small chunks. (Refer to the SCL Documentation for more information on the Scan() function.)
INT32 RecvBytesPerScan = 0;INT32 TotalDataRecv = 0;
m_pTotalScanBuf= (PUINT8)GlobalAlloc(GLB_MEM,m_nBuffer + 10240);
INT16 Status = Scan(SL_FIRST, m_pTotalScanBuf, m_nBufferRecv, &RecvBytesPerScan);
if (Status != OKAY){
// Place error handling code here}else{
m_pTotalScanBuf += m_nBufferRecv;TotalDataRecv += RecvBytesPerScan;
while (RecvBytesPerView) {
Status = Scan(SL_NEXT, m_pTotalScanBuf,m_nBufferRecv, &RecvBytesPerScan);
if(Status != OKAY){ // Place error handling code here}
m_pTotalScanBuf += m_nBufferRecv;TotalDataRecv += RecvBytesPerScan;
} }
Q: Where can I find information and download the latest TWAIN Toolkit?A: http://www.twain.org
Q: Where can I obtain support on standard TWAIN implementations?A: E-mail: [email protected]
Appendix D: Information and Support
Scanner Toolkit Technical SupportObtain HP SCL Toolkit technical support by using one of the following methods:
35Electronic Mail: [email protected]: http://www.hp.com/go/devexchange37America Online: send email to HPSCANNER38CompuServe: send email to HP_SCAN or 73363,137539Fax: (970) 346-2254
TWAIN SupportFor TWAIN information:
40Electronic Mail: [email protected] site: http://www.twain.org42Phone: (831) 338-8842
HP Peripherals Developer ProgramJoin HP at the Corporate level! The HP Peripherals Developer Program offers several benefits to assist in your development efforts, including loaner units and special discounts for developers. If you are interested in joining, please visit the HP Peripherals Developer Program Web Site at: http://www.hp.com/go/devexchange/
Appendix E: Tech Notes
HP ScanJet IIcx Notes
Changes to SCL Source Code LibraryThe HP ScanJet IIc is Hewlett Packard’s first color scanner. This scanner is a 400 dpi, 24-bit, SCSI scanner that also supports an Automatic Document Feeder. Introduced after the HP ScanJet IIc, the HP ScanJet IIcx scanner is also a 400 dpi, 24-bit, SCSI scanner but it supports a Transparency Adapter.
With the introduction of color scanners came the ability to download or upload Color Dither Data. The capability of uploading Matrices, Tone Maps and colors is provided for your convenience. There is no special need to upload these. Hewlett Packard provides standard patterns but gives you the option of modifying them.
Image Data Transfer Curves (Tone Maps)The 24-bit color values generated as the "output" of the Coefficient Matrix and modified by the filtering and scaling are further transformed through a lookup table which contains the transfer curve called a Tone Map. Each color is transformed separately using the same Tone Map to create a value adjusted by contrast and intensity.
For each color, the details of the Tone Map are a function of the number of bits specified (1, 4 or 8) and the contrast and intensity control settings. The default power-on settings for the scanner are black and white, 1-bit mode with contrast = 0 and intensity = 0. The Tone Map for 1, 4 and 8-bit modes with default contrast and intensity for the black and white data types are:
1-bit mode A straight line mapping of 0% to 100% reflectance which is then thresholded or dithered, depending upon the data type selected
4-bit mode A straight line mapping of 4% to 74% reflectance into an output of 0 to 15
8-bit mode A straight line mapping of 0% to 100% reflectance into an output of 0 to 255
For the color data types (Color, Color Thresholded, Color Dithered, Chunky Thresholded, Chunky Dithered), every color’s value is modified by the same Tone Map. The Default Tone Map for all the color data types is a straight line mapping of 0% to 100% reflectance into the appropriate data format.
The Tone Map for dithered l-bit mode (per color) or 8-bit mode (per color) becomes non-linear as the contrast and intensity are changed from 0.
ScalingScaling for the HP ScanJet IIcx differs from some previous scanners in several ways. In describing these differences, "resolution" will mean the physical pixels per inch that the scanner uses which is
( _ * _ )scl resolution scl scaling100
For resolutions greater than 60 ppi in the y-direction (120 ppi for fast mode) the scan speed is adjusted so that the requested resolution is the true resolution. For resolutions less than 60 ppi (120 ppi for fast mode) the scanner scans at 60 ppi and uses a binary rate multiplier scheme to drop lines until the desired resolution is obtained.
In the x-direction, the image is always scanned at 400 ppi. The HP ScanJet IIcx uses linear interpolation to generate new pixels to provide an apparent stream of 800 ppi. Between 400 and 800 ppi, a straight rate multiplier is used to select the pixels to be dropped. At 400 ppi the raw data is used, and below 400 ppi a modified rate multiplier scheme is used to select the pixels to be dropped.
HP ScanJet 3c/4c/6100c NotesThe HP ScanJet 3c replaced the HP ScanJet IIcx. The HP ScanJet 3c is Hewlett Packard’s first 600 dpi, 30-bit scanner. The HP ScanJet 3c along with its successors, the HP ScanJet 4c and HP ScanJet 6100C, support an Automatic Document Feeder (C2521A) and a Transparency Adapter (C2526A). These scanners are capable of returning 10-bit grayscale data and 30-bit color data.
The HP ScanJet 4c is a software roll. The HP ScanJet 6100C evolved from the HP ScanJet 4c in response to customer needs and market demands. The HP ScanJet 6100C contains HP Intelligent Scanning Technology, which is an exclusive combination of HP hardware and software technologies that simplify the scanning process and optimize the results.
From a programmer’s perspective, the HP ScanJet 6100C, 4c, and 3c respond to the same four model number commands (see Inquire HP Model Number on page 71).
For a complete summary of the SCL commands supported by the HP ScanJet 3c/4c/6100C , see Command Summary and Support starting on page 159.
The data path for the HP ScanJet 3c/4c/6100C is :
4330-bit color data is scanned at 600 dpi from the scan window44the Coefficient Matrix mixes the three colors resulting in a stream of modified 30-bit color data45the (optional) filter averages 0, 2, 4, or 8 pixels together color by color46data enters the scaler stage which adjusts the data for desired scaling and resolution47contrast and intensity is adjusted by using the specified 10-bit Tone Map on each color channel in the 30-bit data stream converting the data to a 24-bit data stream - or the Tone Map is bypassed preserving the 30-bit data stream48output data type is derived in this final stage. For b&w only 1/3 of the data stream is used (the green channel)49inverse (optional) is applied
Changing Your CodeYou do not have to change your code to use the HP ScanJet 3c scanner. The HP ScanJet 3c, is backwards compatible with the HP ScanJet IIcx (as well as the IIc, 3p, IIp, ScanJet+ and ScanJet) in all Scanner Control Language Commands (SCL). The scanner will always scan in 10/30-bit mode as long as a Tone Map as been downloaded or if the brightness or contrast controls have been moved off of unity (Brightness = 0, Contrast = 0). The scanner always returns 8-bit Grayscale or 24-bit Grayscale to your application even though it has automatically scanned at 10-bit or 30-bit (unless you force returning of the 10/30-bit data).
Tone MapsWhen the HP ScanJet 3c/4c/6100C is powered on, the scanner defaults to Black and White 1-bit data width with a contrast = 0 and an intensity = 0. The Default Tone Map for each data type is:
1-bit data width Straight line mapping of 0 to 100% reflectance which is then thresholded or dithered according to the data selected.
4-bit data width Straight line mapping of 4 to 74% reflectance into an output of 0 to 15.
8-bit data width Straight line mapping of 0 to 100% reflectance into an output of 0 to 255.
10-bit data width Straight line mapping of 0 to 100% reflectance into an output of 0 to 1023.
The same Tone Map is used for all three color channels.
A Tone Map is created internally if the contrast and/or the intensity value is changed. A Tone Map may be downloaded to the scanner. Any 8-bit to 8-bit Tone Map downloaded to the HP ScanJet 3c/4c/6100C is automatically expanded to a 10-bit to 8-bit Tone Map using linear interpolation between each pair of adjacent points. You can also download a 10-bit by 8-bit Tone Map.
The 10-bit x 8-bit Tone Map is used in all data cases except 10-bit gray and 30-bit color.
With 10-bit grayscale or 30-bit color no Tone Map is allowed.
If you download an 8-bit Tone Map the scanner automatically expands it to 10-bit by interpolating between each pair of points.
If you do not download a Tone Map or alter contrast and brightness you will get a default 8-bit/24-bit data stream returned.
Set Speed Mode (HP ScanJet 3c/4c/6100c)Command: Set Speed Mode (HP ScanJe 3c/4c/6100C)Inquire ID: 10950Escape Sequence: Esc*u#ERange: See Command Summary and Support starting on page 159Default: 0SCL Command n/aMacro: SetSpeedMode(x)SendCommand: SendCommand(SL_SPEED_MODE, x)
Where x can be:SL_AUTO_SPEED_MODESL_NORMAL_SPEED_MODESL_FAST_SPEED_MODESL_EXTRA_FAST_SPEED_MODE (Not supported by all scanners)
Comment: Use this command to set the speed of the scanner. The default is 0 (auto mode).
In the auto mode the speed mode is dependent on the x and y resolution of the scan according to the table below (unless the scaling/resolution/data type will produce a Scaling Error for that speed, in which case the next slowest speed will be used which not produce a Scaling Error. If there are not speeds which would not give a Scaling Error, the speed from the table is used and a Scaling Error is put on the SCL stack). This command is overridden when data types 50, 51, 52 are selected (these data types are provided for backwards compatibility with the HP ScanJet IIcx. Their use is now discouraged in favor of the auto speed mode). For fast and extra fast scans the light will remain on at a low level after the scan if an ADF is detected with paper ready. The light will turn off if any of the following commands are received before a new scan command is received: SCSI reset, recalibrate, turn light on/off, set calibration mode 2 (always calibrated). An SCL reset will not turn off the light if it is on at a low level.
Speeds:
effective x-resolutioneffective y resolution 301 to 1200 201 to 300 12 to 20012 to 120 normal speed normal speed normal speed121 to 199 normal speed fast speed fast speed 200 to 1200 normal speed fast speed extra fast speed
Each speed mode has its own effective Optical Resolution in the x-direction: 600 ppi for normal, 300 ppi for fast, and 200 ppi for extra fast.
HP ScanJet 4p NotesThis document highlights changes to the Scanner Control Language (SCL) for the low-cost color scanner, the HP ScanJet 4p. The HP ScanJet 4p utilizes some of the advanced features and technology of the HP ScanJet 6100C/4c/3c, in a way that is consistent with the lower price of the HP ScanJet 4p. The command set of the HP ScanJet 4p is, therefore, closer to that of the HP ScanJet 3c/4c/6100C than to the grayscale-only HP ScanJet 3p.
Although very similar to the HP ScanJet 3c/4c/6100C, the HP ScanJet 4p is basically a 300 dpi scanner that does not support a Transparency Adapter. It supports 8-bit/24-bit grayscale and color respectively, but not 10-bit/30-bit.
Model Number SchemeThe HP ScanJet 4p scanner has model number 1130A (Inquire Model #8, Esc*s15E), and is only backwards compatible with the 9195A (Inquire Model #1, Esc*s3E). The scanner gives a null response to any other model inquiries.
The main reason that the HP ScanJet 4p does not respond to any other model numbers is that the scaling and resolution model is only compatible with the HP ScanJet + (9195A) and not with any other scanners. Programs which expect a certain scaling and resolution model would give VERY poor results if the HP ScanJet 4p responded like a scanner with a different scaling and resolution model.
SCSI Driver ConsiderationsThe driver SJIIX.SYS must be recent enough to recognize the HP ScanJet 4p. Use the SJIIX.SYS that was shipped with the HP ScanJet 4p or later, or use the SJIIX.SYS shipped with this toolkit.
Automatic Background ModeSome commands were kept in the HP ScanJet 4p only for backwards compatibility reasons. An example of this is Automatic Background Mode.
For the HP ScanJet 3c/4c/6100C, the Automatic Background Mode Command could be used to “set” the variable on and off, but did not perform any other function. The same is true for the HP ScanJet 4p—the variable can be set, but no “automatic background’ function is ever performed.
Changed Behavior for Line-Dropping and Magic ResolutionsLine-dropping is used to obtain the requested number of scan lines per inch (y-direction dpi). This practice is common in non-HP scanners, but previous HP color scanners (e.g., HP ScanJet IIc, IIcx, 3c/4c/6100C) only performed line-dropping at very low resolutions (generally less than 60 dpi).
Due to the color imaging technology on the HP ScanJet 4p, line-dropping may be necessary to maintain accurate color registration. As with other non-HP color scanners, this line-dropping may cause some irregular “jaggies” in the image. In the HP ScanJet 4p, no line-dropping occurs at certain “magic” resolutions. If not at a “magic” resolution, the scan is internally performed at the next higher “magic” resolution, and line-dropping is performed to achieve the requested resolution.
The “magic” resolutions are at the following “effective” resolutions (the “effective” resolution is the product of scaling times resolution(scaling*resolution)). For example, 300 dpi at 50% scaling is an effective resolution of 150 dpi). “Magic” resolutions occur every 37.5 dpi over the full range from 12 to 600 dpi. These resolutions are: 600, 562.5, 525, 487.5, 450, 412.5, 375, 337.5, 300, 262.5, 225, 187.5, 150, 112.5, and 75 dpi. Below 75 dpi, line-dropping occurs from the internal scan resolution of 75 dpi to get the requested effective resolution.
Line-dropping may occur for all data types except binary-thresholded data (date type 0). Also, note that at 300 dpi, no line-dropping occurs for any data type, since this is a “magic” resolution. Lastly, note that an effort to use only “magic” resolutions should only need to be done for extremely critical applications, where any “jaggies” or line-dropping would be unacceptable. The marginal image improvements for the additional software complexity may not be worth the effort.
Lamp Standby Mode with ADF and "Fast" Scans (1-bit and 4-bit)When performing an ADF scan with the HP ScanJet 3c/4c/6100C, when the scan completed and the following conditions were both met, the lamp would not turn completely off, but rather enter a “standby” mode with the lamp at 20% duty cycle:
50In Fast mode (explicitly, or in auto mode fast, or due to data type)51ADF ready (present, with paper present and no jams)
The HP ScanJet 4p always runs in “Normal” mode. Therefore, to mimic this lamp standby mode in the HP ScanJet 4p, the following conditions must be met:
52Data Width is 1-bit or 4-bit53ADF ready (ADF present, with paper present and no jams)
HP ScanJet 5p NotesThe SCL command set for the HP ScanJet 5p is basically a superset of the HP ScanJet 4p. The additional new features affecting SCL include:
54A front scan button 55Dual view scanning ability56Compression57Additional matrix and Tone Map capability (see Command Summary and Support starting on page 159.)5810-bit and 12-bit grayscale, and 30-bit and 36-bit color data types. (Refer to Format of Scanned Data on page 27 or Set Output Data Type on page 46.)
Another significant difference is that the HP ScanJet 5p has a scanning bed that is smaller than the HP ScanJet 4p. The maximum value for some parameters is different for the two scanners.
Like the HP ScanJet 4p, the HP ScanJet 5p does not support a Transparency Adapter.
This tech note describes the specific changes to SCL for the HP ScanJet 5p in relation to the HP ScanJet 4p. For a complete summary of the HP ScanJet 5p SCL commands and inquires (including parameter maximum, minimum and defaults), see Command Summary and Support starting on page 159 and see Inquire Summary and Support starting on page 161.
A Front Scan ButtonThe HP ScanJet 5p is the first HP flatbed scanner that contains a scan button on the front of the scanner. This button provides the ability for an end-user to press the button and have the HP Scanning Software launch to perform a scan. There is also the capability for a developer to make their application “Button Aware” so that an end-user could choose to press the button and have their application launch instead of HP’s Scanning Software. Please refer to Chapter 6, HP ScanJet Button Manager, for information on how to make your application “Button Aware”.
Dual ViewThe HP ScanJet 5p has a unique feature that allows two data streams to be received from the scanner for the same window on the same scan (with one pass of the scanner you can get two buffers of data that are different). Each data stream may have parameters set for the particular “view.” For example, one “view” may be set up for low resolution color for an image, while the other view may be set up for higher resolution grayscale for text. The data for the two views will be interleaved. Please refer to DualScan on page 96, see Set Number Of Views on page 63, and Set View on page 65.
CompressionThe Hp ScanJet 5p is the first HP flatbed scanner that supports the setting of compression in the hardware. Please refer to the Set Compression Command on page 62.
Set Speed Mode (HP ScanJet 5p Scanner)Command: Set Speed ModeInquire ID: 10950Escape Sequence: Esc*u#ERange: See Command Summary and Support starting on page 159Default: 0SCL Command n/aMacro: SetSpeedMode(x)SendCommand: SendCommand(SL_SPEED_MODE, x)
Where x can be:SL_AUTO_SPEED_MODESL_SLOW_SPEED_MODESL_NORMAL_SPEED_MODESL_FAST_SPEED_MODE
Comment: Use this command to set the speed of the scanner. The default is 0 (auto mode). In auto mode, the speed mode is dependent on the effective Y resolution of the scan according to the table below (unless the scaling / Y resolution / data type will produce a Scaling Error for that speed, in which case the next slowest speed which will not produce a Scaling Error will be used. If there are no speeds which would not give a Scaling Error, the speed from the table is used and a Scaling Error is put on the SCL stack.). If a fast speed mode is set and the default matrix is used, any scan that only has gray scale images will only put mono into the buffer and use a green matrix. If a fast speed mode is set and a matrix is picked or downloaded that is not pass through, 3 channel color will be put into the buffer and the specified matrix will be used (the speed will be overridden). No SCL error will be generated. In the following table:
2321C = one channel2333g = three times the gain2343C = three channels235cs = adjustable carriage speed236Ave # L = average # lines together237lump 2 = lump 2 pixels in CCD together (150 dpi optical resolution)
Data Type Effective Y Resolution
Fast Scan Internal Speed
B/W all 180 - 600 1 C, 3g extra fast60 - 179 3 C, cs normal30 - 59 118 - 60 cs, Ave 2 L normal15 - 29 116 - 60 cs, Ave 4 L normal12 - 14 112 - 96 cs, Ave 8 L normal
Color all 301 - 600 3 C normal151 - 300 3 C, lump 2 up sample fast120 - 150 3 C, lump 2 fast60 - 119 3 C, cs normal30 - 59 118 - 60 cs, Ave 2 L normal15 - 29 116 - 60 cs, Ave 4 L normal12 - 14 112 - 96 cs, Ave 8 L normal
Data Type Effective Y Resolution
Normal Scan Internal Speed
all 60 -600 3 C, cs normal30 - 59 118 - 60 cs, Ave 2 L normal15 - 29 116 - 60 cs, Ave 4 L normal12 - 14 112 - 96 cs, Ave 8 L normal
Data Type Effective Y Resolution
Slowest Scan Internal Speed
all 101 - 600 double y res, 1/2 speed, line merge 2
slow
30 - 100 double y res, 1/2 speed, 9x9 kernel scale
slow
15 - 29 116 - 60 cs, Ave 4 L normal12 - 14 112 - 96 cs, Ave 8 L normal
Data Type Effective Y Resolution
Auto Scan
B/W 1, 4 bit 12 - 600 fastB/W dither 12 - 600 normalall 10 bit 12 - 600 slow *color 24, 8 bit 151 - 600 slow *color 24, 8 bit 12 - 150 normal
* if 64k of available buffer space (normal speed otherwise)for 300dpi 24bit data (normal speed > 1950 / 1900 x-extent > slow speed)for 200dpi 24bit data (normal speed > 2500 / 2450 x-extent > slow speed)
HP ScanJet 5100C Notes The HP ScanJet 5100C will respond to the same commands as the HP ScanJet 5p with one exception. The scanner will respond to Inquire Model #9 as a 5190A instead of a 5110A.
The HP ScanJet 5100C is a parallel scanner designed to provide a simple “boardless” installation. The HP ScanJet 5100C installation is easy, involving use of the existing parallel port on your PC and does not require you to open the PC to install a card. The HP ScanJet 5100C is designed to use the high speed EPP parallel port, though the scanner will work with any parallel configuration and uses the IEEE 1284.3 emerging standard. With the IEEE standard, parallel interface technology is maturing to the point that HP decided to offer a parallel interface in the HP ScanJet 5100C.
In most applications HP provides automatic adjustments to the PC BIOS settings to enable the Enhanced Parallel Port mode, while other manufacturers require their customers to "adjust" the BIOS. EPP enables a 10x increase in performance compared to other parallel modes and provides data transfer rates comparable to other scanner interfaces. The HP ScanJet 5100C parallel drivers optimize performance by choosing the best chip settings on the PC to see if it is capable of handling EPP and makes changes automatically, enabling EPP. HP has implemented a parallel solution that is better than competitors by removing most scanner-to-printer conflicts associated with their simultaneous use of the parallel port. The HP ScanJet 5100C's parallel interface offers ease of use during installation and gives increased performance through the IEEE1284.3 Standard.
If your HP DeskJet printer exhibits garbled output, unwanted lines, erroneous error messages or total non-recognition of a print job, it could be the result of using a non-compliant IEEE-1284 parallel printer cable to connect your printer to the HP ScanJet 5100C. HP recommends using a high-quality IEEE-1284 Compliant Parallel Printer Cable when connecting a HP DeskJet printer to your HP ScanJet 5100C. HP IEEE-1284 Compliant Parallel Printer Cables, part numbers C2950A or C2951A, may be purchased from local computer dealers or from HP Direct at (800)538-8787(U.S. only) and (800)387-3154(Canada only).
Printer drivers for certain HP DeskJet Printers may have problems sharing the parallel bus. If you encounter communication errors or print job failures, the solution could be to disable bi-directional communication with these printers. This will still allow simultaneous scan and print functionality. With bi-directional communication left enabled the scanner functions are not affected but print jobs could not complete. This situation could occur with HP DeskJet Series 400, 540, 600 or 800 printers. We have provided an executable file, prntfix.exe, that will scan your system for these HP DeskJet Printer drivers, turn off bi-directional communication and turn on the print spooler. This file can be found on the SCL v 10.0 Toolkit in the TK10\Drivers directory. To run this program from your Windows 95 or Windows NT 4.0 environment:
133.Go to where you installed the SCL toolkit on your system.134.In the TK10\Drivers directory, double click on prntfix.exe.135.There is no UI associated with this program and it takes only a few seconds to complete.
You could also incorporate this executable into your application’s install program if you feel it is appropriate.
HP ScanJet 4100C Notes The HP ScanJet 4100C will respond to the same commands as the HP ScanJet 5p and the HP ScanJet 5100C with one exception. The scanner will respond to Inquire Model #9 as a 6290A.
Note: Due to operating system restrictions for Windows 95, the HP SCL Toolkit can provide support for USB systems running Windows 98 only.
The HP ScanJet 4100C is HP’s first USB (Universal Serial Bus) scanner designed for easy plug and play installation. The USB interface has been supplied on virtually all PC’s beginning sometime in 1997. With USB, you can enjoy hot-swap capability of multiple devices. You can connect directly to over 120 peripherals at once without installing a single card.
HP ScanJet 6200C Notes The HP ScanJet 6200C/6250C will respond to the same superset of commands as the HP ScanJet 5p. The scanner will respond to Inquire Model #14 as a 6270A. The HP ScanJet 6250C is a HP ScanJet 6200C bundled with a 25-page Automatic Document Feeder. The HP ScanJet 6200C also supports a passive transparency adapter. (Refer to http://www.scanjet.hp.com for more information)
The HP ScanJet 6200C has both USB and SCSI interfaces. The SCSI interface is supported under Windows 95 as well as Windows 98 and Windows NT 4.0.
Note: Due to operating system restrictions for Windows 95 the HP SCL Toolkit can provide support for USB systems running Windows 98 only.
One major difference between the HP ScanJet 6200C and its predecessors is that the HP ScanJet 6200C defaults to the sRGB primaries instead of the NTSC primaries. This incompatibility requires that applications wishing to use the NTSC primaries instead send a command to the scanner to set it to the NTSC matrix:
status = SetMatrix( SL_RGB_MATRIX );
With the HP ScanJet 4100C, the HP ScanJet 6200C, and all future scanners, a new matrix has been defined:
status = SetMatrix( SL_sRGB_MATRIX );
This command should only be used with the HP ScanJet 4100C and HP ScanJet 6200C. Since these scanners do not support active transparency adapters, the constant for specifying an active transparency adapter matrix is the same value as sRGB to simplify the firmware (see scanner.h).
#define SL_USER_DEFINED_BW -2#define SL_USER_DEFINED_COLOR -1#define SL_RGB_MATRIX 0 /* Matrix Coefficients */#define SL_BW_NTSC_MATRIX 1#define SL_PASS_THRU_MATRIX 2#define SL_GREEN_MATRIX 2#define SL_RED_MATRIX 3#define SL_BLUE_MATRIX 4#define SL_XPA_RGB_MATRIX 5 /* for the IIcx, 4p, 3c/4c/6100C only */#define SL_sRGB_MATRIX 5 /* for the 4100C and 6200C only */#define SL_XPA_BW_MATRIX 6 /* for the IIcx, 4p, 3c/4c/6100C only */
To be sRGB compliant, our scanners may need to have the following settings:
a) The Color Matrix should be the sRGB primaries
b) The default Tone Map for Color and Grayscale should be a gamma compensation of 2.2.
c) The default data type may need to be Color
To generate a gamma 2.2 compensated Tone Map, do the following:
void sRGBgamma( void )/*** Tone Map array 0..255 of bytes to store gamma 2.2 compensated Tone Map** Operation: Load the Tone Map with a fixed sRGB gamma curve** History: 09/11/96, RES, original code*/{
double dMapSize = 255.0;double gamma = 1.0 / 2.4;for ( INT16 i = 0; i < 256; i++ ){
double in = (double)i / dMapSize;double out;if ( in <= 0.00304 ){
// linear portion, slope limitedout = 12.92 * in * dMapSize;
}else{
out = (1.055 * pow( in, gamma ) - 0.055 ) * dMapSize;if ( out > dMapSize ){
out = dMapSize;}
}toneMap[i] = (INT16)( out + 0.5 );
}}
Set Speed Mode (HP ScanJet 6200C Scanner)Command: Set Speed ModeInquire ID: 10950Escape Sequence: Esc*u#ERange: See Command Summary and Support starting on page 159Default: 0SCL Command n/aMacro: SetSpeedMode(x)SendCommand: SendCommand(SL_SPEED_MODE, x)
Where x can be:SL_AUTO_SPEED_MODESL_SLOW_SPEED_MODESL_NORMAL_SPEED_MODESL_FAST_SPEED_MODE
Comment: Use this command to set the speed of the scanner. The default is 0 (auto mode). In auto mode, the speed mode is dependent on the effective Y resolution of the scan according to the table below (unless the scaling / Y resolution / data type will produce a Scaling Error for that speed, in which case the next slowest speed which will not produce a Scaling Error will be used. If there are no speeds which would not give a Scaling Error, the speed from the table is used and a Scaling Error is put on the SCL stack.). If a fast speed mode is set and the default matrix is used, any scan that only has gray scale images will only put mono into the buffer and use a green matrix. If a fast speed mode is set and a matrix is picked or downloaded that is not pass through, 3 channel color will be put into the buffer and the specified matrix will be used (the speed will be overridden). No SCL error will be generated. In the following table:
59N = Normal Speed Mode60F = Fast Speed Mode
61Auto Effective X Res \ Data Width 1 4 8 10 12 Dith12 00 / 29 99 N N N N N N30 00 / 119 99 N N N N N N120 00 / 149 99 F(2) F(2) N N N N150 00 F(2) F(2) F(1,2) F(1,2) F(1,2) N150 01 / 301 00 F(2) F(2) N N N N301 01 / 600 00 N N N N N N600 01 / 1200 00 N N N N N N
62Fast Effective X Res \ Data Width 1 4 8 10 12 Dith12 00 / 119 99 N N N N N N120 00 / 600 00 F(2) F(2) F(2) F(2) F(2) F(2)600 01 / 1200 00 N N N N N N
63Normal/Slow Effective X Res \ Data Width 1 4 8 10 12 Dith12 00 / 1200 00 N N N N N N(1) Changes to Normal Speed of X Extent > 1650
(2) Changes to Normal Speed if Exposure Mode = Short (i.e. 4.5 ms)
HP ScanJet 5200C NotesThe HP ScanJet 5200C will respond to the same commands as the HP ScanJet 6200C with one exception. The scanner will respond to Inquire Model #16 as a 7190A. The HP ScanJet 5200C is a dual I/O scanner with Parallel and USB interfaces available. The USB interface has been supplied on virtually all PC’s beginning sometime in 1997. With USB, you can enjoy hot-swap capability of multiple devices. You can connect directly to over 120 peripherals at once without installing a single card.
Index
AADF, 6, 14, 19, 20, 29, 84, 88, 89, 91, 96, 160, 161, 162ADF Background Change, 75ADF Scan Window, 73ASPI, 111
Installing on Windows 95, 112Installing on Windows NT 4.0, 112Licensing, iii
Attention Condition, 138Automatic Background Mode, 176Automatic Document Feeder, 18
ADF Background Change, 75ADF Scan Window, 73Change Document, 74SCL Reset, 29Unload Document, 74
Automatic Document Feeder Inquires, 76Inquire ADF Connected, 76Inquire ADF Open Since Last Change/Scan, 77Inquire ADFReady, 76Inquire Paper in ADF Bin, 76Inquire Ready to Unload, 77
BB/W dither pattern, 159B/W Dither Pattern, 48B/W Dithered Pattern, 3, 10B/W Thresholded Data, 8Black and White Dithered Data, 9Black and White Grayscale Data, 9Black Data, 8BuildCommand, 90, 98Building the SCL Library, 150BuildInquire, 98Button
Front Scan Button, 178Button Manager, 105
CheckPollingState Command, 109Files, 105InstallLaunchApp Command, 108IsAppAlone Command, 109PushLaunchPending Command, 109RegisterLaunchApp Command, 108SetPollingState Command, 109UnregisterLaunchApp Command, 108
ButtonPoll, 102
CChange Document, 74, 161, 162CheckIO, 101CheckPollingState, 109Chunky Dithered Data, 12Chunky Thresholded Data, 12Clear Errors, 82, 83, 161ClearButton, 102Coefficient Matrix, 15Color, 93Color Coefficient Matrix, 15Color Data, 11Color Dither Pattern, 49, 160Color Dithered Data, 12Color Thresholded Data, 11ColorDither, 93ColorThreshold, 93CommandInquire, 93Commands
ADF Background Change, 75ADF Scan Window, 73Change Document, 74CheckPollingState, 109Clear Errors, 83Color Utility Call, 93ColorDither Utility Call, 93ColorThreshold Utility Call, 93CommandInquire Utility Call, 93Dither Utility Call, 94Download Binary Data, 59Download Utility Call, 94DualScan Utility Call, 96GetScanInfo Data Structure Call, 92GetScanState Data Structure Call, 92GrayScale Utility Call, 94InitSharpenTransform, 104Inquire ADF Connected, 76Inquire ADF Open Since Last Change/Scan, 77Inquire ADF Ready, 76Inquire ADF/Transparency Adapter Open Since Last
Change/Scan, 81Inquire Auto Speed Mode, 72Inquire Auto-Filtering, 72Inquire Bytes Per Scan Line, 70Inquire Current Error Stack Depth, 83Inquire Device Parameter, 68Inquire Device Pixels Per Inch, 69Inquire Firmware Date Code, 70Inquire HP Model Number 1, 71
Inquire HP Model Number 14, 72Inquire HP Model Number 16, 72Inquire HP Model Number 2, 71Inquire HP Model Number 3, 71Inquire HP Model Number 4, 71Inquire HP Model Number 5, 71Inquire HP Model Number 6, 72Inquire HP Model Number 8, 72Inquire HP Model Number 9, 72Inquire Maximum Error Stack Depth, 83Inquire Maximum Value, 68Inquire Minimum Value, 67Inquire Native Optical Resolution, 69Inquire Number of Scan Lines, 70Inquire Paper in ADF Bin, 76Inquire Pixels Per Scan Line, 68Inquire Present Value, 67Inquire Ready to Unload, 77Inquire Transparency Adapter Connected, 81Inquire Transparency Adapter Ready, 81InstallLaunchApp, 108Inverse Image, 53IsAppAlone, 109Light Source Test, 57, 79Mirror Image, 54Position Scanner Element, Secondary, 57PushLaunchPending, 109Read Current Error Number, 83Read Oldest Error, 83Recalibrate, 61RegisterLaunchApp, 108ResetScanner Utility Call, 94Scan Utility Call, 95Scan Window, 32SCL Reset, 29Set Automatic Background, 56Set B/W Dither Pattern, 48Set Byte Order, 62Set Calibration Strip Parameters, 80Set Calibration Y-Start, 79Set Color Dither Pattern, 49Set Compression, 62Set Contrast Level, 56Set Data Width, 47Set Download Type, 58Set Filter, 55Set Intensity Level, 54Set Matrix Coefficients, 50Set Number Of Views, 63Set Output Data Type, 46Set Speed Mode, 61Set Speed Mode (HP ScanJet 3c/4c/6100C), 175Set Speed Mode (HP ScanJet 5p Scanner), 179Set Speed Mode (HP ScanJet 6200C Scanner), 185Set Tone Map, 52Set View, 65Set Window X Extent (Decipoints), 40Set Window X Extent (Device Pixels), 44Set Window X Position (Decipoints), 38Set Window X Position (Device Pixels), 42Set Window Y Extent (Decipoints), 41Set Window Y Extent (Device Pixels), 45Set Window Y Position (Decipoints), 39
Set Window Y Position (Device Pixels), 43Set X Resolution, 34Set X Scale Factor, 36Set Y Resolution, 35Set Y Scale Factor, 37SetDecipointWindow Utility Call, 97SetPixelWindow Utility Call, 97SetPollingState, 109SetResolution Utility Call, 97SetScale Utility Call, 98SetScanState Data Structure Call, 92SetScanWindow Data Structure Call, 92SetSharpening, 104Sharpen, 104Threshold Utility Call, 96Transparency Adapter Disable/Enable, 80Transparency Scan Window, 78Unload Document, 74UnregisterLaunchApp, 108Upload Binary Data, 60Upload Utility Call, 97
Compound Commands, 90Compression, 3, 4, 91, 159, 178Current Stack Depth, 82
DData Format, 27Data Structure Calls, 91
GetScanInfo, 92GetScanState, 92SetScanState, 92SetScanWindow, 92
Data Types, 8Decipoint, 7Device Pixel, 7Dimensional Units, 7Directory Structure, 149Dither, 48, 49, 94Dither Pattern. See Color Dither Pattern. See B/W Dither
PatternDownload, 94Download Binary Data, 59Dual View, 3, 178DUALDATA.EXE, 153DualScan, 96
EError
Clear Errors, 83Inquire Current Error Stack Depth, 83Inquire Maximum Error Stack Depth, 83Printer Communication Errors, 181Read Current Error Number, 83Read Oldest Error, 83
Error Inquiries, 83Error Numbers, 84Error Reporting, 82Error Stack, 82Escape Sequence Format, 23
FFAQ’s, 167Fast Data Types, 14Fast Scans, 177File Placements, 125Format of Escape Sequences, 23Format of Scanned Data, 27Front Scan Button, 3, 4
GGetScanInfo, 34, 88, 92GetScanState, 87, 92, 104GrayScale, 94
HHardware
Sharpening, 103HOST.H, 102HP C1752/C1753 Card (MicroChannel with switches), 115HP C2502 Card (ISA without switches), 114, 124HP C2503 Card (MicroChannel without switches), 115HP C2522 Card, 121, 124HP C2522 Card (Plug and Play), 114HP Developer Program, 2HP ScanJet Button Manager, 105HP ScanJet Plus Card, 116
IImage Data Transfer Curves, 17, 52, 54, 56, 173InitSharpenTransform, 104Inquire ADF Connected, 76Inquire ADF Open Since Last Change/Scan, 77Inquire ADF Ready, 76Inquire ADF/Transparency Adapter Open Since Last
Change/Scan, 81Inquire Auto Speed Mode, 72Inquire Auto-Filtering, 72Inquire Bytes Per Scan Line, 70Inquire Current Error Stack Depth, 83Inquire Device Parameter, 68, 162Inquire Device Pixels Per Inch, 69Inquire Firmware Date Code, 70Inquire HP Model Number, 71Inquire HP Model Number 1, 71Inquire HP Model Number 14, 72Inquire HP Model Number 16, 72Inquire HP Model Number 2, 71Inquire HP Model Number 3, 71Inquire HP Model Number 4, 71Inquire HP Model Number 5, 71Inquire HP Model Number 6, 72Inquire HP Model Number 8, 72Inquire HP Model Number 9, 72Inquire Maximum Error Stack Depth, 83Inquire Maximum Value, 68, 162Inquire Minimum Value, 67, 162Inquire Native Optical Resolution, 69
Inquire Number of Scan Lines, 70Inquire Paper in ADF Bin, 76Inquire Pixels Per Scan Line, 68Inquire Present Value, 67, 68, 162Inquire Ready to Unload, 77Inquire Transparency Adapter Connected, 81Inquire Transparency Adapter Ready, 81InquireModel, 67, 69, 99InquireNumber, 67, 68, 69, 88, 99InquireOldestError, 99InquireString, 99Inquiry commands, 67InstallLaunchApp, 106, 108Interface
Parallel, 116, 119, 145SCSI, 114, 121, 124SCSI-1, 129SCSI-2, 135USB, 118, 119, 120, 146
Inverse Image, 53, 159IsAppAlone, 109
LLamp Standby Mode with ADF, 177LAMPCON.EXE, 151LAMPSDK.EXE, 154Library Errors, 88Library Typedefs, 89Licensing
ASPI, iiiLight Source Test, 57, 79, 160Line-dropping, 176
MMacintosh, 1, 129Magic Resolutions, 176Matrix coefficients, 160Matrix Coefficients, 50, 91, 160Mirror Image, 54, 159Model Number Scheme, 8, 176
OOldest Error Report, 82OS/2, 1, 129, 168Output Data Types, 8
PParallel, 116, 119, 123, 145, 181, 186Parallel Printer Cables, 181Position Scanner Element, Secondary, 57Powerup Condition, 138Printer Communication Errors, 181Printer Errors, 181Prntfix.exe, 181Product Descriptions, 1PushLaunchPending, 109
RRead Current Error Number, 83Read Oldest Error, 83READINI.C, 156Recalibrate, 61ReceiveResponse, 100RecFromScanner, 101RegisterLaunchApp, 106, 108Reset Condition, 138ResetScanner, 94Resolution, 5, 7, 14, 29, 34, 35, 36, 37, 42, 43, 44, 88, 96,
153, 163
SSample Code, 151Scale, 5, 32, 36, 37, 67, 68, 163
Set X Scale Factor, 36Set Y Scale Factor, 37
Scaling, 7, 173Scan, 95Scan Window, 32, 160SCAN.C, 156SCAN.EXE, 155ScanJet 3c, 174ScanJet 4100C, 118, 119, 120, 146, 182ScanJet 4c, 174, 176ScanJet 4p, 176, 177, 178ScanJet 5100C, 15, 116, 119, 123, 145, 181ScanJet 5200C, 123, 145, 186ScanJet 5p, 15, 178ScanJet 6100C, 174, 183ScanJet IIc, 111, 131, 132, 133, 134, 176
And SCSI-2, 135ScanJet IIcx, 50, 173, 174ScanJet Plus, 111, 116, 124
And Windows NT, 121Scanner Library Commands, 102SCANNER.C, 85, 86, 90, 93SCANNER.H, 89, 90, 99, 101, 102ScannerLock, 101, 151ScannerLockButton, 102Scanning Process, 87SCANNING.EXE, 152SCL Commands, 29SCL library files, 85SCL Reset, 29SCL Sample Code, 151SCL.C, 85, 86, 90, 98, 102SCL.C Entry Points, 98
BuildCommand, 98BuildInquire, 98InquireModel, 99InquireNumber, 99InquireOldestError, 99InquireString, 99ReceiveResponse, 100SendCommand, 100
SCSI, 33, 111, 114, 121, 130, 132, 133, 135, 138, 139, 140, 141, 142, 143, 176ANSI Documents, 129
SCSI CardHP C1752/C1753, 115HP C2502, 114HP C2502 (ISA without switches), 124HP C2503, 115HP C2522, 124HP C2522, 114HP C2522 Plus, 121HP ScanJet Plus, 116Third Party, 114
SCSI-1And the ScanJet IIc, 129And the ScanJet IIp, 129Commands, 131General Operation, 130Interface Protocol, 129Massages, 134Phases and Support, 131Physical Characteristics, 129
SCSI-2And the ScanJet IIp/IIc, 135Commands, 141Conditions, 138Disconnects, 141Hints for use, 144Interface Protocol, 135Messages, 139
SendCommand, 100SendToScanner, 90, 101, 102Set Automatic Background, 56Set B/W Dither Pattern, 48Set Byte Order, 62, 160Set Cal Area(Y-position), 160Set Calibration Strip Parameters, 80Set Calibration Y-Start, 79Set Color Dither Pattern, 49Set Compression, 62Set Contrast Level, 56Set Data Width, 47Set Download Type, 58Set Filter, 55, 160Set Intensity Level, 54Set Matrix Coefficients, 50Set Number Of Views, 63, 160Set Output Data Type, 46Set Speed Mode, 61Set Speed Mode (HP ScanJet 3c/4c/6100C), 175Set Speed Mode (HP ScanJet 5p Scanner), 179Set Speed Mode (HP ScanJet 6200C Scanner), 185Set Tone Map, 52, 160Set View, 65, 160Set Window X Extent (Decipoints), 40Set Window X Extent (Device Pixels), 44Set Window X Pos (Pix), 160Set Window X Position (Decipoints), 38Set Window X Position (Device Pixels), 42Set Window Y Extent (Decipoints), 41Set Window Y Extent (Device Pixels), 45Set Window Y Pos (Pix), 160Set Window Y Position (Decipoints), 39Set Window Y Position (Device Pixels), 43Set X Resolution, 34Set X Scale Factor, 36Set Y Resolution, 35
Set Y Scale Factor, 37SetDecipointWindow, 38, 39, 40, 41, 97SetPixelWindow, 42, 43, 44, 97SetPollingState, 109SetResolution, 34, 97SetScale, 98SETSCAN.EXE, 152SetScanState, 34, 87, 92SetScanWindow, 92SetSharpening, 104Sharpen, 104Sharpening, 103
Hardware, 103InitSharpenTransform Command, 104SetSharpening command, 104Sharpen Command, 104
SHARPSDK.EXE, 155sRGB, 183Support
OS/2, 168ScanJet Support, 167SCL Toolkit, 171TWAIN, 170, 171UNIX, 168
Supported scanners, 3
TThird-Party SCSI Cards, 114Threshold, 96Tone Maps, 17, 52, 54, 56, 173, 174
Gamma 2.2, 184Transparency Adapter
Inquire ADF/Transparency Adapter Open Since Last Change/Scan, 81
Inquire Transparency Adapter Connected, 81Inquire Transparency Adapter Ready, 81Light Source Test, 79SCL Reset, 29Set Calibration Strip Parameters, 80Set Calibration Y-Start, 79Transparency Adapter Disable/Enable, 80Transparency Adapter Scan Window, 78
Transparency Adapter Disable/Enable, 80Transparency Scan Window, 78TWAIN, 170, 171
UUnit Attention Condition, 138UNIX, 1, 168Unload Document, 74, 160UnregisterLaunchApp, 108Upload, 97Upload Binary Data, 60, 162USB, 118, 119, 120, 146, 182, 183, 186
Utility Calls, 93Color, 93ColorDither, 93ColorThreshold, 93CommandInquire, 93Dither, 94Download, 94DualScan, 96GrayScale, 94ResetScanner, 94Scan, 95SetDecipointWindow, 97SetPixelWindow, 97SetResolution, 97SetScale, 98Threshold, 96Upload, 97
UTILS.C, 156
VView
Dual Scan, 96Dual View, 3, 4, 31, 52, 65, 178Set Number Of Views, 63Set View, 65
WWEB
Drivers for HP ScanJet Scanners, 167HP Developer Program, 2HP Scanner Products, 2OS/2 Support, 168Specs for HP ScanJet Scanners, 167TWAIN Information, 170UNIX Support, 168
White Data, 8Windows 3.11, 123
And the HP C2502 Card, 124And the HP C2522 Card, 124
Windows 95, 113, 125And HP ScanJet Plus Card, 116And the HP C1752/C1753 Card, 115And the HP C2502 Card, 114And the HP C2503 Card, 115And the HP C2522 Card, 114And Third Party SCSI Cards, 114Installing ASPI, 112
Windows 98, 111Windows NT, 111, 112, 121, 125
And ScanJet Plus, 121And the HP C2522 Card, 121
Windows NT 4.0Installing ASPI, 112
WINSCAN.C, 85, 90, 101, 102WINSCAN.C Entry Point, 101
ButtonPoll, 102CheckIO, 101ClearButton, 102RecFromScanner, 101ScannerLock, 101ScannerLockButton, 102SendToScanner, 101