Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

timer.h File Reference

Timer functions (mainly needed for Heartbeats). More...

#include <general.h>

Go to the source code of this file.

Functions

void initTimer (void)
void resetTimer (void)
WORD getTime (WORD *time)
void setTime (WORD *time, WORD value)


Detailed Description

Timer functions (mainly needed for Heartbeats).

Responsible for timer related functions such as heartbeat. The functions in this file are platform dependent


Function Documentation

WORD getTime WORD *    time
 

This function returns the correct value of the actual time. If the time would be read without this function, its possible to get the wrong time, because the interrupt service routine could be executed during reading this value, and the LSB of the time value is incremented, so an overflow of the LSB occrues, and the program read the wrong value.
This function calls itself (recursive) if it seams that the ISR was called during reading the time.

Parameters:
time  The pointer to the variable thats points to the time that should be used in the program

void initTimer void   
 

Initiates the timer. Normally the timer should create an overflow every 1ms. but on linux it is a bit complicated to do this. Thats the reason why it only generates an overflow every 100ms at the moment

void resetTimer void   
 

Resets the timer. This is mainly needed for microcontrollers where interrupt flags have to be set back and initial values for the timer registers have to be set.

void setTime WORD *    time,
WORD    value
 

This function sets the correct value of the actual time. If the time would be written without this function, its possible to set the wrong time, because the interrupt service routine could be executed during writing this value.
This function calls itself (recursive) if it seams that the ISR was called during setting the time.

Parameters:
time  The pointer to the variable thats points to the time that should be set in the program
value  The time that should be set.


Generated on Wed Dec 25 01:04:57 2002 for CANopen SlaveLib by doxygen1.2.17