User`s guide
FreeStar Pro SMAC Programmers’ Guide
Rev B 0006-00-08-02-000 Page 34 of 34
3.9 TIMERS
A variety of options exist on the MC13224V for periodic timers that expire and generate an
interrupt.
The sample SMAC project on the CD uses Timer0 to generate an interrupt every 5mS.
See timers.c for setup and usage.
A variety of the other timers based on Timer0 can be set up and updated every time
Timer0 expires. See the UpdateTimer0() function in main_state.c.
3.10 EVENTS
Low priority events (turn LED’s off, responding to switches) are handled in the EventDo()
function in main_state.c.
Other events can be easily added.
3.11 READING ADC’S
Two A/D converters are connected to Potentiometers on the CEL ZFSM-201-EVB-1
FreeStar Pro Evaluation Board.
Another A/D internal to the MC13224V can be used to monitor the battery voltage.
It is important to monitor the battery voltage when the Buck Regulator is active. If the
battery voltage falls below 2.5V the Buck needs to be placed in bypass mode. See
Freescale Semiconductors’
“MC1322x Reference Manual”
(Freescale Doc # MC1322xRM)
.
When a GUI message is received to query the A/D channels a Timer is set up to read the
A/D’s every 500mS.
The ADC_Setup() function in main_state.c sets up the A/D’s.
Although the battery is used as the A/D reference, its value is based on an internal 1.2V
reference.
Value read back by the 9
th
A/D input (battery) is actually a 1.20V reference.
To obtain the actual power supply use the following formula:
o Power Supply Voltage = (4095*1.20)/Power Supply A/D result
This ‘adjusted’ Power Supply Value can be used to improve the accuracy of the A/D values
obtained from the power supply.
o ADC Voltage = (A/D result /4095) * Power Supply Voltage
3.12 USER INPUTS (SWITCHES)
When an interrupt is detected on a switch, a 25mS Timer based off Timer0 is started.
Upon expiration the switch input to the MC13224V is read. If it is low (pressed) a valid
switch press flag is set. The EventDo() function in main_state.c will respond to the
switch event.
4 REVISION HISTORY
Revision Date Description
Preliminary 28Oct08 Preliminary Release
A 04Feb09 Updated Table #1
B 22May09 Updated for BeeKit v1.9.5 / SMAC v1.11 Release