'{$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,[003] 'Hide display serout 9,BAUD,[014,100] 'Turn Backlight to 100% (On) serout 9,BAUD,[020] 'Turn Scroll Off serout 9,BAUD,[024] 'Turn Wrap Off serout 9,BAUD,[004] 'Turn Cursor Off serout 9,BAUD,[CLR] 'Clear Screen serout 9,BAUD,[LINE1] 'Goto Home Position serout 9,BAUD,["Hello World!"] 'Display Text serout 9,BAUD,[017,000,001] 'Position Cursor at Col 1 of Line 2 on LCD serout 9,BAUD,["Text Sent by BS2"] 'Display Text pause 4000 'Pause serout 9,BAUD,[CLR] 'Clear Screen b1=1 countloop: serout 9,BAUD,[LINE1] 'Goto Home Position serout 9,BAUD,["Counting:"] 'Display Text serout 9,BAUD,[017,000,001] 'Position Cursor at Col 1 of Line 2 on LCD serout 9,BAUD,[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,[002] 'Hide display serout 9,BAUD,[014,000] 'Turn Backlight to 0% (Off) pause 6000 'Pause for 6 Seconds goto begining 'Repeat to Begining