28029 Parallax Inc, 28029 Datasheet - Page 30

KIT PARTS SMART SENSORS W/TEXT

28029

Manufacturer Part Number
28029
Description
KIT PARTS SMART SENSORS W/TEXT
Manufacturer
Parallax Inc
Datasheet

Specifications of 28029

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp® or Javelin Modules
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Other names
28029PAR
Page 18 · Smart Sensors and Applications
' Smart Sensors and Applications - LcdTimer.bs2
' Display elapsed time with BS2 and Parallax Serial LCD.
' {$STAMP BS2}
' {$PBASIC 2.5}
hours
minutes
seconds
SEROUT 14, 84, [22, 12]
PAUSE 5
SEROUT 14, 84, ["Time Elapsed...", 13]
SEROUT 14, 84, ["
DO
LOOP
Your Turn - Defining Control Codes with Constants
Up to this point, the LCD control codes have been decimal values. However, when you
are writing or reading a long program, memorizing all those control code values can be
tedious. It's better to declare a constant for each control code at the beginning of the
program. Then, use the constant names instead of numbers. You can also do the same
with the
example:
' Calculate hours, minutes, seconds
IF seconds = 60 THEN seconds = 0: minutes = minutes + 1
IF minutes = 60 THEN minutes = 0: hours = hours + 1
IF hours
' Display digits on LCD on Line 1.
' place the cursor at character 0, 5, and 10 for the time values.
SEROUT 14, 84, [148, DEC2 hours,
PAUSE 991
seconds = seconds + 1
Verify that the display works as advertised.
LcdPin
T9600
LcdCls
BaudMode
= 24 THEN hours
VAR
VAR
VAR
value, and then add a
153, DEC2 minutes,
158, DEC2 seconds ]
h
PIN
CON
CON
Byte
Byte
Byte
m
s"]
14
84
12
= 0
PIN
The values 148, 153, 158
directive for I/O pin P14 as well. Here is an
' LCD I/O pin
' True, 8-bits, no parity, 9600
' Form feed -> clear screen
' Stamp directive
' PBASIC Directive
' Stores hours
' Stores minutes
' Stores seconds
' Start LCD & clear display
' Pause 5 ms for clear display
' Text + carriage return
' Text on second line
' Main Routine
' Pause + overhead ~ 1 second
' Increment second counter
' Repeat Main Routine

Related parts for 28029