Announcement

Collapse

New Sub-Forum

In an effort to help make sure there are appropriate categories for topics of discussion that are happening, there is now a sub-forum for databases and database programming under Special Interest groups. Please direct questions, etc., about this topic to that sub-forum moving forward. Thank you.
See more
See less

Serial port with Chatsworth scanner

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial port with Chatsworth scanner

    I am converting PB 3.5 for Dos to PBcc 4.04, or trying to just that.
    Dos code has been functioning just fine for years.
    My program(below) has the Dos code as comments

    FUNCTION PBMAIN
    CONSOLE SET SCREEN 25,80

    'Following comes from the Chatsworth scanner manual a long time ago
    'Just a description of a mark sense card, somewhat like a lottery card
    '-----------------------------------------------------------------------------

    dc1$ = CHR$(17) 'DC1 or Ctrl+Q
    dc2$ = CHR$(18) 'DC2 or Ctrl+R

    a$ = dc2$ & "R1777" 'Scan all rows except 8 and 9
    a$ = a$ & dc2$ & "T05" 'Use translation table to convert first 5 Hollerith columns
    a$ = a$ & dc2$ & "X*9876543210XX*" 'Defines Translation Table for columns 1-5
    ' * no response * bad response (multiple mark)
    ' XX are reminders that row 8-9 not read
    a$ = a$ & dc2$ & "R3737" 'Scan 8-7-6-5-4 and 2-1-0---&
    a$ = a$ & dc2$ & "S50" 'Split translation -- 2 bytes / timimg mark
    'for the next 50 rows
    a$ = a$ & dc2$ & "L*EDCBAX*" 'Defines Translation Table for double column
    ' * no response * bad response (multiple mark)
    ' X reminder that col 3-9 not read
    a$ = a$ & dc2$ & "E" 'End of message to Chatsworth 2000

    '--------------------------------------------------------------
    'Below is PB 3.5 for Dos code-working fine for several years
    'Initialize the Chatsworth for reading a card
    'OPEN "COM1:9600, E, 7, 1" FOR RANDOM AS #1
    ' PRINT #1, a$;
    ' INPUT #1, a$
    ' PRINT #1, dc1$
    ' INPUT #1, Card$
    'CLOSE #1
    'PRINT Card$;"<<<<<<<< works just fine"

    '--------------------------------------------------------------------------

    'Task is to duplicate the above using PBcc 4.04 in 25x80 text display
    'No error message and no output either

    'OPEN "COM1" AS #1
    ' or ->>> comm OPEN "COM1:9600, E, 7, 1" aS #1
    ' or ->>> OPEN "COM1:,9600, E, 7, 1" FOR RANDOM AS #1
    COMM OPEN "COM1" AS #1
    COMM SET #1, BAUD = 9600 ' 9600 baud
    COMM SET #1, BYTE = 7 ' 8 bits
    COMM SET #1, PARITY = 0 '%FALSE ' No parity
    COMM SET #1, STOP = 0 ' 1 stop bit
    COMM SET #1, TXBUFFER = 2048 ' 2 Kb transmit buffer
    COMM SET #1, RXBUFFER = 4096 ' 4 Kb receive buffer

    'Optional settings for flow control from PBcc 'Help'
    'COMM SET #1, CTSFLOW = 1 ' Enable CTS flow control
    'COMM SET #1, RTSFLOW = 1 ' Enable RTS flow control
    'COMM SET #1, XINPFLOW = 0 ' Disable XON/OFF Input flow control
    'COMM SET #1, XOUTFLOW = 0 ' Disable XON/XOFF output flow

    COMM PRINT #1, a$
    COMM LINE INPUT #1, a$
    COMM PRINT #1, dc1$
    COMM LINE INPUT #1, Card$
    COMM CLOSE #1

    PRINT ">>>";Card$;"<<<<<<<<"
    SLEEP 5000
    END FUNCTION

    Suggestions/gentle push in right direction/new code/etc are most welcome. As in the past, I know you'll have the answer. You always do.

    Thanks, Jack
Working...
X