System
| tick()
wait rand() |
startrtc
setdate settime |
date$()
time$() |
These words are system related or they don’t fit into any of the other categories.
| tick() |
| a=tick() |
This gives access to the system tick. This is a 32bit word that is updated every 200uS on a high priority interrupt using timer 5.
5 = 1ms
5000 = 1s
It can be used for any general purpose timing but the count will roll over (return to 0) when 0xffffffff (4,294,967,295). At reset the tick counter is set to 0 and so could be used for detecting how long the system has been up and running from the last reset. It will take the counter just less then 9 days to roll over.
| wait () |
| wait (<time in
milliseconds>) wait 100 |
This causes the program to halt* for the given number of milliseconds.
*The tick timer and the process scheduler is not effected and they will continue to run whilst in the wait state.
| rand() |
| a=rand(min,max) a=rand(5,27) |
Returns a random number between the specified minimum and
maximum values. The Maximum is 214,7483,647 and the minimum is 0.
| startrtc |
| startrtc |
Starts the real time clock. This should not bee needed normally as the clock is started at reset.
| settime |
| settime "<hh:mm:ss>" settime “14:23:0” settime a$ |
Sets the time on the system Real Time Clock. The keywords expects a string to be in the format as shown above.
| time$() |
| a$=time$() |
Returns a sting in the format "hh:mm:ss" that represents the system time.
| setdate |
| setdate "<date string>" setdate "24/4/18 3" |
NOTE: prior to version 2.00, the year required 4 digits. Version 2 now requires 2 digits.
Sets the system date. The date is presented as a string and must be in the format as the example above. The year is stored as two digits. The number at the end after the space is the day of week that counts from 1 to 7 and rolls over back to 1.
| date$() |
| a$=date$() |
Returns the system date as a string in the same format as ‘setdate’.