Timer example
Timer_example
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
new a;
new cs[10];
public callback (sk)
{
switch(sk)
{
case TIMER1:
{ // If timer callback event
write_buf(RS232,15,"Callback: Timer"); // Send data through RS232 with "Callback: Timer" data
}
}
return 0;
}
main(){
Init(TIMER1, 10); // Initialize Timer with 10ms period
Init(RS232, 9600, WORDLENGTH_8, STOPBITS_1, PARITY_NONE); // Initialize RS232
Delay(1000); // Delay 1 sec.
write_buf(RS232,5,"Start"); // Send data through RS232 with "Start" data
while(1){ // Forever
Delay(10000); // Delay 10 sec.
}
}