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
BPI-216 • v1.2 • 07/00 • pg 6
Program Examples
Any computer/programming language that can produce serial output (2400 or 9600 bps, N81) can talk
to the BPI-216. The examples here are in BASIC, chosen because of its popularity and readability.
Don’t be put off by the size of the programs—they are mostly comments.
See www.seetron.com for Windows
®
programming examples and an easy-to-use DLL that works well
with Visual BASIC
®
.
' Program: BPKDEMO.BAS
' This program demonstrates fundamental techniques of driving
' BPI-216 serial LCDs in BASIC (compatible with QBASIC, Quick BASIC,
' First BASIC, and Power BASIC). First BASIC, an excellent shareware
' compiler, is available from www.powerbasic.com.
' Start by defining some useful constants for the Backpack
I = 254 ' Instruction prefix value.
CLR = 1 ' LCD clear-screen instruction.
LINE1 = 128 ' Address of first character of 1st line.
LINE2 = 192 ' Address of first character of 2nd line.
' Open the serial port (com1) for output at 9600 baud. Make sure BPS
' is also set for 9600. Turn off all handshaking (CD, CS, DS) by
' setting to zero (0).
OPEN "COM1:9600,N,8,1,CD0,CS0,DS0" FOR OUTPUT AS #1
' Once the port is open, we can print to it. Start by clearing the screen
' in case there's text left from a previous run of this program. Note that
' at 9600 baud, you need a delay after clearing the screen. To create a
' delay, you can use a timing instruction such as First/Power BASIC's
' DELAY or QBASIC's SLEEP, or you can send an unnecessary instruction,
' such as <254><128>. That sequence moves the cursor to the beginning of
' line 1, which is where it already is, thanks to clear-screen.
PRINT #1, CHR$(I); CHR$(CLR); ' Send <254><1> to clear screen.
PRINT #1, CHR$(I); CHR$(LINE1); ' Time delay (for 9600 baud).
' Now print some text. PRINT statements should end with ; to
' prevent unnecessary carriage return/line feeds (which the Backpack
' doesn't understand, and displays as junk characters).
PRINT #1, "Hello world!";
' Positioning the cursor requires sending the instruction prefix (ASCII
' 254, which we've assigned the name "I") followed by an address. We've
' assigned names to ASCII 128 (1st character of line 1) and 192 (1st
' character of line 2). We'll position the cursor to the start of
' line 2 and print some more.
PRINT #1, CHR$(I); CHR$(LINE2); "press return";
' Wait for a keypress (at PC) before continuing.
CLS : INPUT "PRESS RETURN TO CONTINUE", X$
' Now we'll simulate a common application by printing a label on the
' screen, then updating some data by positioning the cursor. Each
' time you press return on the PC, the program will add 1 to the
' count and update the value on the screen. Notice that to position
' the cursor at character 6 of line 1, we give the position value of
' LINE1 + 6. This is easier to read than 134, which is the address of
' line 1, character 6. Also note that we print several spaces after
' the number. It's not needed here, but in programs in which a number
' could be _lower_ than the previously displayed value, the spaces
' would erase any leftover digits.
PRINT #1, CHR$(I); CHR$(CLR); CHR$(I); CHR$(LINE1);
PRINT #1, "Count: "; CHR$(I); CHR$(LINE2); "press return";
theCount = 0
Again:
PRINT #1, CHR$(I); CHR$(LINE1 + 6); theCount; " ";
INPUT "ENTER TO CONTINUE, Q-ENTER TO QUIT ", X$
IF UCASE$(X$) = "Q" THEN END
theCount = theCount + 1
GOTO Again
Quickie Program
Want fast results? All you
need are these two lines
of code. The first opens
the serial port for output;
the second ‘prints’ text to
it.Type and run these lines
in QBASIC or Power
BASIC and “Hello World!”
appears on the display.








