timer.h File Reference

#include "t89c51cc02.h"
#include "datatypes.h"

Go to the source code of this file.

Defines

#define TIMER_RELOAD_H   0xFA
#define TIMER_RELOAD_L   0xCB
#define TIMER_MILLISECONDS   62
 length of sampling intervalls in milliseconds

Functions

void Timer_init (void)
 activate main timing interrupt to achieve a 1ms timing
void Timer_interrupt (void) interrupt 1 using 2
 keeps time frames for measurements and signals pending measurements in 62ms ticks

Variables

volatile bit measurement_task
 semaphore to signal a pending sensor measurement


Detailed Description

Definition in file timer.h.


Define Documentation

#define TIMER_MILLISECONDS   62
 

length of sampling intervalls in milliseconds

This intervall includes sampling _and_ reporting of its values according to the monitoring conditions.

Definition at line 16 of file timer.h.

Referenced by Timer_init(), and Timer_interrupt().

#define TIMER_RELOAD_H   0xFA
 

reload values to get approx. 1ms timing @ 16MHz: 0x10000 - 0x0535 = 0xfacb - HIBYTE

Definition at line 7 of file timer.h.

Referenced by Timer_init(), and Timer_interrupt().

#define TIMER_RELOAD_L   0xCB
 

reload values to get approx. 1ms timing @ 16MHz: 0x10000 - 0x0535 = 0xfacb - LOBYTE

Definition at line 9 of file timer.h.

Referenced by Timer_init(), and Timer_interrupt().


Function Documentation

void Timer_init void   ) 
 

activate main timing interrupt to achieve a 1ms timing

Timer 0 of the T89C51CC02 is used to maintain the timing.

Definition at line 32 of file timer.c.

References measurement_task, timekeeper, TIMER_MILLISECONDS, TIMER_RELOAD_H, and TIMER_RELOAD_L.

Referenced by main().

void Timer_interrupt void   ) 
 

keeps time frames for measurements and signals pending measurements in 62ms ticks

measurement_task is set after the amount of ms specified in TIMER_MILLISECONDS have passed.
The timer keeps running for the whole duty cycle of the sensor measurement.

Definition at line 56 of file timer.c.

References measurement_task, timekeeper, TIMER_MILLISECONDS, TIMER_RELOAD_H, and TIMER_RELOAD_L.


Variable Documentation

volatile bit measurement_task
 

semaphore to signal a pending sensor measurement

The semaphore is to be set from the main Timer ISR exclusively.
It is cleared after sampling all sensors.

Definition at line 22 of file timer.c.

Referenced by main(), Timer_init(), and Timer_interrupt().


Generated on Wed Oct 24 12:57:24 2007 for SensorControl by  doxygen 1.4.6