27220 Parallax Inc, 27220 Datasheet - Page 206

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
Once a value has been adjusted, the conversion back to BCD is equally simple:
Of the four pushbuttons connected, three are used to advance the minutes, hours,
and day (the seconds are reset when any other element is changed). To roll an
element back, the fourth button is held down. Note how the modulus operator is
used and keeps each element update to a single line of code.
Taking It Further
In applications where time-based math is concerned, a simple solution – if minutes
resolution is adequate – is to convert the time to a single value in minutes:
This will result in a value of 0 (midnight) to 1439 (23:59 or 11:59 PM). With this
single value mathematic operations are simplified.
minutes is simple too:
This will result in 24-hour time format. For 12 hour format, calculate hours like this:
To determine the state of AM/PM, simply look at the
between 0 and 719, PM times are between 720 and 1439.
Challenge
Reconnect the MC11489 multiplexer and display the running time on the 7-segment
LEDs.
rawTime = (hours * 60) + minutes
hours = rawTime / 60
hours = rawTime // 60
hours = 12 – (24 – (rawTime / 60) // 12)
decVal = (bcdVal.NIB1 * 10) + bcdVal.NIB0
bcdVal = (decVal / 10 << 4) + bcdVal // 10
rawTime
Getting back to hours and
value; AM times are

Related parts for 27220