Manual

User’s Manual
Scott Edwards Electronics, Inc.
1939 S. Frontage Road, Suite F, Sierra Vista, AZ 85635 USA
ph: 520-459-4802 • fax: 520-459-0623 • www.seetron.com
BPP-420 • v4.0 • 2/03 • pg 9
Program Examples (cont.)
' Program: Q420DEMO.BAS (QBASIC Demo of 4x20 Serial LCD)
' This program demonstrates the 4x20 Serial LCD Module from Scott
' Edwards Electronics, Inc. with QBASIC. This program requires
' slight modifications to run under PowerBASIC or First BASIC,
' available from www.powerbasic.com. A modified version is
' available for download from www.seetron.com/bpk_ex1.zip.
' To run this program, connect the serial input of the LCD
' module to the com port transmit-data pin (pin 3 of DB9;
' pin 2 of DB25). Connect GND of module to com port signal GND
' (pin 5 of DB9; pin 7 of DB25). Configure LCD module for 9600 bps
' (S1: switch 1 down; 2 up). Connect +5V power to LCD module : +5V
' to +5V and GND to GND. Run demo.
DECLARE SUB pause (time AS INTEGER)
CONST clrLCD = 12 ' Clear the LCD screen.
CONST noCurs = 4 ' Make cursor invisible.
CONST ulCurs = 5 ' Turn on underline cursor.
CONST bell = 7 ' Beep piezo buzzer (if attached).
CONST bksp = 8 ' Backspace.
CONST bigNums = 2 ' Begin big-number mode.
CONST clrCol = 17 ' Clear column.
CONST wedge = 128 ' Wedge-shaped symbol.
CONST posCmd = 16 ' Position the cursor.
OPEN "com1:9600,N,8,1,CD0,CS0,DS0,OP0" FOR OUTPUT AS #1
PRINT #1, CHR$(clrLCD); ' Clear LCD.
FOR i = 0 TO 79
PRINT #1, CHR$(wedge); ' Fill the screen with wedges.
NEXT
PRINT #1, CHR$(posCmd); CHR$(68); ' Move cursor to pos. 4 (64+4).
FOR i = 1 TO 12 ' Clear a 12-column section of
PRINT #1, CHR$(clrCol); CHR$(bell); ' ..screen. Ring bell w/each loop.
pause (350)
NEXT
PRINT #1, CHR$(posCmd); CHR$(90); CHR$(ulCurs);
PRINT #1, "4x20 LCD"; ' Print message on LCD.
SLEEP 1 ' Wait a second.
FOR i = 1 TO 8
PRINT #1, CHR$(bksp); CHR$(bell); ' Backspace to erase message.
pause (150) ' Ring bell w/each loop.
NEXT
SLEEP 1 ' Wait a second.
PRINT #1, CHR$(noCurs); ' Make cursor invisible.
FOR i = 0 TO 99 ' Show #s 0-99 as big numbers.
theNum$ = LTRIM$(RTRIM$(STR$(i))) ' Trim spaces from number string.
PRINT #1, CHR$(posCmd); CHR$(70); CHR$(bigNums); theNum$;
pause (500) ' Wait 1/2 second.
NEXT
END
SUB pause (time AS INTEGER)
FOR i = 1 TO time
PRINT #1, CHR$(0);
NEXT
END SUB