122-28029 Parallax Inc, 122-28029 Datasheet - Page 29

GUIDE STUDENT SMART SENSORS

122-28029

Manufacturer Part Number
122-28029
Description
GUIDE STUDENT SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-28029

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Smart Sensors
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
ACTIVITY #3: TIMER APPLICATION
This activity applies the techniques introduced in Activity #2 to an hour-minute-second
timer.
Displaying Time Elapsed
Here is a code block that starts the LCD, clears the screen, and places some display
characters on the LCD that will not change. The rest of the program can then display
changing hour, minute, and second number values next to the stationary "h", "m", and "s"
characters.
For this application, control codes for cursor placement can be particularly useful. For
example, the cursor can be placed on Line 1, character 0 before sending the two-digit
decimal value of hours. The cursor can then be moved to Line 1, character 5 to display
the minutes, and then to Line 1, character 10 to display the seconds.
Here is a single
correct location:
The next example program applies this concept with just the BASIC Stamp module's
timing abilities. The accuracy isn't digital wristwatch quality by a long shot; however, it
is good enough for showing how the time display can work with character positioning.
For higher accuracy, try incorporating the DS1302 timekeeping chip. It's available from
www.parallax.com, just enter DS1302 into the search field.
Example Program - LcdTimer.bs2
This example program displays hours, minutes and seconds elapsed with the Parallax
Serial LCD. By pressing the RESET button on the Board of Education, you can restart
the timer.
SEROUT 14, 84, [22, 12]
PAUSE 5
SEROUT 14, 84, ["Time Elapsed...", 13]
SEROUT 14, 84, ["
Enter, save, and run LcdTimer.bs2.
SEROUT 14, 84, [ 148, DEC2 hours,
SEROUT
command that displays all three variable values, each at the
h
153, DEC2 minutes,
158, DEC2 seconds ]
m
s"]
Chapter 1: Parallax Serial LCD Display · Page 17
' Start LCD & clear display
' Pause 5 ms for clear display
' Text + carriage return
' Text on second line

Related parts for 122-28029