This example project shows how a virtual hardware timer is set up and used for a variety of purposes.
We can not imagine any embedded application without Timer. Timer is an essential component for providing timing to our application. This example project will teach how to implement timer in Virtuoso. In virtuoso we don’t need any setup to initialize Timer, just write a service routine which will be called after a particular time and perform the task defined in it and that simple!!
In our example project we are toggling the LED state in service routine and bind this service routine to Timer of Target Model Builder and define the Timer interval for 1 second. As a result our LED in virtuoso started blinking at every one second upon execution of main.
Click here to download complete Project File Click here to download getting started Project File
char SIM_LEDState = 0; // Variable to store the value of LED state
void SetLEDState(char LEDState) // Function to set the LED state
SIM_LEDState = LEDState;
void TimerISR(void) // Hardware timer ISR
SIM_LEDState = ~SIM_LEDState; // This will be call at every 1 Sec
// Toggle the LED state at every 1 Sec