Shop OBEX P1 Docs P2 Docs Learn Events
Microscan(barcode) serial data to BS2 then serial out to a 16x2 Crystalfontz Lcd — Parallax Forums

Microscan(barcode) serial data to BS2 then serial out to a 16x2 Crystalfontz Lcd

GmaxeyGmaxey Posts: 3
edited 2008-03-25 20:52 in BASIC Stamp
I am·reading· barcodes with a Microscan 820. I use·a BS2 to send serial codes to this barcode reader in order to change scanner modes.·When one of the BS2's pins changes states a·serial string of commands is sent to the scanner, works great. The only thing is that·there is alot of wasted potential sitting in that BS2. My question,·How can I read the serial info from the scanner (the barcode number)through the BS2 and display it on a Crysalfontz 16x2 LCD. The scanner·has the capabilities to·send the barcode number.·The following code will display info on the lcd:

'{$STAMP BS2}
'This program demonstrates driving the Crystalfontz 2X16 Serial
'Display using BASIC and the BASIC Stamp II. Bar Graphs, Backlight
'control are all easy to do with one line commands to the display.
'This program assumes the display is connected to pin 9 on the Stamp.
'by Jeff Lionberger
'If you are driving the display's "DATA_IN" line with 0v to 5v
'signals (which would be typical in a Basic Stamp application), be
'sure to close "JPE" on the LCD.
BAUD· CON $4020···················· 'Set Baud rate to 19200 inverted
CLR·· CON 012······················ 'LCD Clear Screen instruction
LINE1 CON 001······················ 'Cursor Home Position
begining:
PAUSE 4000························· 'Pause (4sec) Wait for LCD Bootup to Clear
SEROUT 9,BAUD,[noparse][[/noparse]003]················ 'Hide display
SEROUT 9,BAUD,[noparse][[/noparse]014,100]············ 'Turn Backlight to 100% (On)
SEROUT 9,BAUD,[noparse][[/noparse]020]················ 'Turn Scroll Off
SEROUT 9,BAUD,[noparse][[/noparse]024]················ 'Turn Wrap Off
SEROUT 9,BAUD,[noparse][[/noparse]004]················ 'Turn Cursor Off
SEROUT 9,BAUD,[noparse][[/noparse]CLR]················ 'Clear Screen
SEROUT 9,BAUD,[noparse][[/noparse]LINE1]·············· 'Goto Home Position
SEROUT 9,BAUD,[noparse][[/noparse]"Hello World!"]····· 'Display Text
SEROUT 9,BAUD,[noparse][[/noparse]017,000,001]········ 'Position Cursor at Col 1 of Line 2 on LCD
SEROUT 9,BAUD,[noparse][[/noparse]"Text Sent by BS2"]· 'Display Text
PAUSE 4000························· 'Pause
SEROUT 9,BAUD,[noparse][[/noparse]CLR]················ 'Clear Screen
B1=1
countloop:
SEROUT 9,BAUD,[noparse][[/noparse]LINE1]·············· 'Goto Home Position
SEROUT 9,BAUD,[noparse][[/noparse]"Counting:"]········ 'Display Text
SEROUT 9,BAUD,[noparse][[/noparse]017,000,001]········ 'Position Cursor at Col 1 of Line 2 on LCD
SEROUT 9,BAUD,[noparse][[/noparse]DEC B1,"····· "]···· 'Print Value of b1 then 6 spaces
B1 = B1+1·························· 'Increment b1
PAUSE 100·························· 'Pause - Slow Loop Down
IF B1=100 THEN turnoff············· 'When the count reaches 100 goto turnoff
GOTO countloop····················· 'Repeat
turnoff:
SEROUT 9,BAUD,[noparse][[/noparse]002]················ 'Hide display
SEROUT 9,BAUD,[noparse][[/noparse]014,000]············ 'Turn Backlight to 0% (Off)
PAUSE 6000························· 'Pause for 6 Seconds
GOTO begining······················ 'Repeat to Begining

Any help will be greatly appreciated!!!!

Glenn
Sign In or Register to comment.