7526 DCT Reference


Reference&mdash.Sensor Input Ports

reference&mdash.sensor input ports

SenActLed

This function lights a panel or sensor port LED for the duration specified.

C Format

     #include   "cfrapi26.h"          // For defined values
 
     USHORT     SenActLed(lednumber, duration)
 
     UCHAR      lednumber             // LED select
     UCHAR      duration              // Duration to light LED
                                      //  1 = 20 milliseconds
 
     Returns:   E_OK                  // If no error occurred
                E_PARAM               // If input parameters are incorrect

Masm Format

     Input:    ah = 0
               al = lednumber
               bl = duration
 
     Call:     INT 43h
 
     Returns:  ax = 0       If no error occurred
                    1       If parameter values are incorrect

Comments:

The LED is lit for the duration times 20 milliseconds and then extinguished. If duration is set to 0, the LED is turned on for an indefinite time. Using a non-zero duration turns the LED off again.

Notes:

  1. The LEDs for Port A are not available to this API if the bar code coprocessor is installed.

  2. In V2.00 and above, LED2 is available for use. l.

Example

int far main (int funct,char far *params)

SenQueryPort

This function returns the port number from which the most recent bar code or magnetic input originated. The query gives the port number of the last read.

This allows the CFR to process the transaction differently based on which bar code or magnetic device was used by the operator. For example, two-slot readers may be used to control separate entrance and exit gates. Based on the port the data comes from, the CFR can operate the correct gate lock.

Note:

Reads performed while inside the CFR can not be processed using this query, instead see "SenRead". This is due to the fact that sensor reads are buffered while inside the CFR, and the port value shown may not match the sensor read currently being processed by the CFR.
.

C Format

     #include   "cfrapi26.h"          // For defined values
 
     USHORT     SenQueryPort(port)
 
     UCHAR      *port                 // Pointer to returned value
 
     Returns:   E_OK                  // If no error occurred
                E_NO_DATA             // If no read occurred

Masm Format

     Input:    ah = 3
 
     Call:     INT 43h
 
     Returns:  ax = 0       If no error occurred
                    5       If no read occurred
               bl = port number
 

Comments:


Example

int far main (int funct,char far *params)

SenQueryPort2

This function returns the port number and direction of scan from the most recent bar code or magnetic input. The query gives the port number used in the last read.

This allows the CFR to process the transaction differently based on which bar code or magnetic device was used by the operator. For example, two-slot readers may be used to control separate entrance and exit gates. Based on the port the data comes from, the CFR can operate the correct gate lock.

Notes:

  1. Reads performed while inside the CFR can not be processed using this query, instead see "SenRead". This is due to the fact that sensor reads are buffered while inside the CFR, and the port value shown may not match the sensor read currently being processed by the CFR.

  2. This function is only available in V2.00 or higher. l.

    C Format

         #include   "cfrapi26.h"        // For defined values
     
         USHORT     SenQueryPort2 (port, direction)
     
         UCHAR      *port                    // Pointer to returned value
         UCHAR      *direction               // Pointer to direction of last read
     
         Returns:   E_OK                  // If no error occurred
                    E_NO_DATA          // If no read occurred
    

    Masm Format

         Input:    ah = 3
     
         Call:     INT 43h
     
         Returns:  ax = 0       If no error occurred
                        5       If no read occurred
                   bl = port number
                   bh = read direction
     
    

    Comments:

    • Defined values for port are:
      • 00h = SEN_PORTA
      • 01h = SEN_PORTB
    • Defined values for direction are:
      • 00h = FORWARD
      • 01h = BACKWARD
      • 02h = COPROCESSOR

    Example

    int far main (int funct,char far *params)
    
    • {
      • UCHAR port; // Returned port number
      • UCHAR direction; // Direction of last read
      • ·
      • // Get the port number of the last sensor read
      • if (SenQueryPort2 (&port, &direction) == E_OK)
        • // port contains valid port number
        • // direction tells the direction of the read
        • ·
      • else
        • // Handle error or data not available
        • ·
    • }

    SenRead

    This function returns the next sensor data record available. In addition to the data, also returned are: the type of input read, the input port used, and the direction of the scan (forward or backward read).

    C Format

         #include   "cfrapi26.h"         // For defined values
     
         USHORT     SenRead(databuffer, maxlist)
     
         UCHAR      *databuffer          // Pointer to returned next
                                         //  sensor data record.
         USHORT     maxlist              // Size of databuffer
     
         Returns:   E_OK                 // If no error occurred
                    E_NO_DATA            // If data record not available
                    E_SPACE              // If databuffer too small
    

    Masm Format

     
          Input:    ah = 2
                    es:bx = databuffer
                    cx    = maxlist
     
          Call:     INT 43h
     
          Returns:  ax = 0      If no error occurred
                         5      If data record not available
                         6      If databuffer too small
    

    Comments:

    • The databuffer record format is:

      • The first byte is the bar code type
        • 00h = UPC_A_READ
        • 01h = UPC_E_READ
        • 02h = EAN_13_READ
        • 03h = EAN_8_READ
        • 04h = CODE_39_READ
        • 05h = I_25_CODE_READ
        • 06h = BAR_ERROR_READ
        • 07h = MAGNETIC_READ
        • 08h = MAG_ERROR_READ
        • 09h = CODABAR_READ
        • 0Ah = CODE_11_READ
        • 0Bh = MSI_CODE_READ
        • 0Ch = CODE_128_READ
      • The second byte is the port number
        • 00h = SEN_PORTA
        • 01h = SEN_PORTB
      • The third byte is the number of data bytes in the read.
      • The fourth byte starts the ASCII data from the sensor of the size in the third byte.
      • The last byte of the buffer is the direction of the last read.
        • 00h = FORWARD_READ
        • 01h = BACKWARD_READ
        • 02h = COPROCESSOR

        Notes:

        1. Sensor reads may have up to 99 bytes of data. It is recommended that a buffer size of 103 bytes be created and then use the data length field in the third byte of returned data to determine how to process the current read. This will prevent E_SPACE errors (buffer too small) if a data read occurs which is too large for the defined buffer and would leave the input buffer full and unable to read the next record.

        2. The direction byte is not included in the length of the data read, but is always the first byte after the end of the data. l.

    Example

    int far main (int funct,char far *params)
    
    • {
      • UCHAR databuffer[103]; // Pointer to data
      • USHORT maxlist; // Size of buffer
      • ·
      • // Get sensor data record
      • maxlist = sizeof (databuffer);
      • if (SenRead (databuffer, maxlist) == E_OK)
        • // Process sensor data
        • ·
      • else
        • // Handle error or data not available
        • ·
    • }

    SenSetDiscrimGrp

    This function sets the selected bar code enabled and the I 2 of 5 bar code length during the CFR. This setting affects only the sensor port operation within the CFR. When the CFR returns, the fast clocking and badge initiated bar code settings resume. These settings do not affect the bar code coprocessor, if installed, which can be programmed only from File 0.

    This function allows changing the accepted (enabled) bar code symbology between reads. For example, the first read may be from an Interleaved 2 of 5 shipping label, and the second from a UPC label. For Interleaved 2 of 5 labels, the desired length must be set prior to the read.

    C Format

         #include   "cfrapi26.h"         // For defined values
     
         USHORT     SenSetDiscrimGrp(barcode, i2of5len)
     
         UCHAR      barcode              // Bar code to enable
     
         UCHAR      i2of5len             // Length for I 2 of 5
                                         // Must be even; ignored for other bar code types
     
         Returns:   E_OK                 // If no error occurred
                    E_PARAM              // If parameter values are incorrect
    

    Masm Format

     
          Input:    ah = 1
                    al = barcode
                    cl = i2of5 length
     
          Call:     INT 43h
     
          Returns:  ax = 0      If no error occurred
                         1      If parameter values are incorrect
    

    Comments:

    • Defined values for barcode are:
      • 00h = UPC_ENABLED
      • 01h = EAN_ENABLED
      • 02h = CODE_39_ENABLED
      • 03h = I_25_CODE_ENABLED
      • 04h = I_25_CHECK_CODE_ENABLED

    Example

    int far main (int funct,char far *params)
    
    • {
      • UCHAR barcode;
      • UCHAR i2of5len;
      • ·
      • // Set up: 2 of 5 for length of 8
      • barcode = I_25_CODE_ENABLED
      • i2of5len = 8;
      • if (SenSetDiscrimGrp(barcode,i2of5len) == E_OK)
        • // Bar code mode set
        • ·
      • else
        • // Handle error
        • ·
    • }