Open Sint
3.4-2
|
These routines are used to read the wind speed and direction, do media etc. More...
Functions | |
ISR (TIMER1_CAPT_vect) | |
ISR (TIMER1_OVF_vect) | |
calulate wind speed with collected pulse value. Any time the system trigger an overflow interrupt. The wind pointer must be present as global variables. wind flag is a boolean flag we enable to signal to main that there is a time to be elaborated. Once the main take care of the new value, it switch off the flag, so if we find the flag on, it means that the main didn't take care of the last value (maybe it was too busy) so we simply do nothing. Wind->direction is supposed to be a media, not a single shot, this is why it will not be converted in here. More... | |
void | davis_timer_setup (void) |
setup counters and timers. Time ellapsed every cycle is 4.19424 sec. 4Mhz / 256 = 15625 Hz (clock pre-scaled of 256) or 1Mhz / 64 = 15625 Hz (clock pre-scaled of 64) 1/15625 Hz = 0.000064 sec (every counter's step) Number of step per cycle is 65535 (16bit) 0.000064 sec * 65535 = 4.19424 sec every cycle. More... | |
void | davis_init (void) |
initialize the davis anemometer. | |
uint8_t | davis_adjust (void) |
anemometer value fine tuning and error correction. Any time the main find it has a wind speed flag active, it means we have a tick per cycle to elaborate. This routine is used to trasform ticks per cycle in (?? m/s) (?? km/h). More... | |
Variables | |
volatile int | loop |
These routines are used to read the wind speed and direction, do media etc.
uint8_t davis_adjust | ( | void | ) |
anemometer value fine tuning and error correction. Any time the main find it has a wind speed flag active, it means we have a tick per cycle to elaborate. This routine is used to trasform ticks per cycle in (?? m/s) (?? km/h).
Adjust wind speed, these value are hardware dependant. See spreadsheet.
void davis_timer_setup | ( | void | ) |
setup counters and timers. Time ellapsed every cycle is 4.19424 sec. 4Mhz / 256 = 15625 Hz (clock pre-scaled of 256) or 1Mhz / 64 = 15625 Hz (clock pre-scaled of 64) 1/15625 Hz = 0.000064 sec (every counter's step) Number of step per cycle is 65535 (16bit) 0.000064 sec * 65535 = 4.19424 sec every cycle.
The counter is: prescaler/256 (4Mhz) CS12 prescaler/64 (1Mhz) CS11 and CS10 noise canceller is enable and the trigger edge is on positive.
enable interrupt on timer 0 event and overflow.
ISR | ( | TIMER1_CAPT_vect | ) |
only to implement low pass filter
ISR | ( | TIMER1_OVF_vect | ) |
calulate wind speed with collected pulse value. Any time the system trigger an overflow interrupt. The wind pointer must be present as global variables. wind flag is a boolean flag we enable to signal to main that there is a time to be elaborated. Once the main take care of the new value, it switch off the flag, so if we find the flag on, it means that the main didn't take care of the last value (maybe it was too busy) so we simply do nothing. Wind->direction is supposed to be a media, not a single shot, this is why it will not be converted in here.
volatile int loop |
Global variable and pointer to be used inside the ISR routine