© MCS Electronics, 1995-2007
directive.
The CONFIG CLOCK statement will use the TIMER0 or TIMER2 in async mode to create a 1 second interrupt. In this interrupt routine the _Sec, _Min and _Hour variables are updated. The time format is 24 hours format.
When you assign TIME$ to a string variable these variables are assigned to the TIME$ variable.
When you assign the TIME$ variable with a constant or other variable, the _sec, _Hour and _Min variables will be changed to the new time.
The only difference with VB is that all digits must be provided when assigning the time. This is done for minimal code. You can change this behavior of course.
The async timer is only available in the M103, 90S8535, M163 and M32(3), Mega128, Mega64, Mega8. For other chips it will not work.
As new chips are launched by Atmel, and support is added by MCS, the list above might not be complete. It is intended to serve as an example for chips with a timer that can be used in asynchrone mode. So when your micro has a timer that can be used in asynchrone mode, it should work.
Do not confuse DATE$ with the DATE function.
ASM
The following asm routines are called from mcs.lib.
When assiging TIME$ : _set_time (calls _str2byte)
When reading TIME$ : _make_dt (calls _byte2str)
See also
DATE$ , CONFIG CLOCK , CONFIG DATE
Example
See the sample of DATE$
TIME
Action
Returns a time-value (String or 3 Byte for Second, Minute and Hour) depending of the Type of the Target
Syntax
bSecMinHour = Time(lSecOfDay)
bSecMinHour = Time(lSysSec)
bSecMinHour = Time(strTime)
strTime = Time(lSecOfDay) strTime = Time(lSysSec)