27220 Parallax Inc, 27220 Datasheet - Page 81

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
The clock display is created by moving the minutes value (secs / 60) into the
thousands and hundreds columns of the variable time. The remaining seconds
(secs // 60) are added to time, placing them in the tens and ones columns.
Here’s how the conversion math works:
Example: 754 seconds
Now that the time display value is ready, the segments are cleared for the next
update. Clearing the current segments value keeps the display sharp. If this isn’t
done, the old segments value will cause “ghosting” in the display. Once the display
is clear the current digit is selected and the segments get updated.
Pay special attention to the DIG operator; it is quite handy. DIG returns the single
digit value from the specified position of a number. For example:
Remember, the right-most digit is digit 0. By updating the variable, theDig, we use
it as a column pointer for both the cathode control as well as pulling the digit offset
from time for use in reading the segments.
The PDB display does not have the colon (:) normally found on a digital clock, so
we’ll enable the decimal point behind digit 2 (ones digit of hours). When theDig is
not pointing to this digit the decimal point illumination is skipped. The final step is to
update theDig for the next calling of the subroutine.
Take it Further
Update the program to use a 10 Hz input from the Signal Generator and blink the
decimal point on every other transition (see SW21-EX10-Clock-DP_Blink.BS2 for full
listing).
754 / 60 = 12
12 x 100 = 1200
754 // 60 = 34
1200 + 34 = 1234
725 DIG 1 = 2
(
(
time
time
= 1200)
= 1234; 12 minutes and 34 seconds)

Related parts for 27220