heat control
r71
|
#include "types.h"
Go to the source code of this file.
Macros | |
#define | T0_TOP 255 |
#define | T0_RELOAD 0xb1 |
#define | T0_INC20 25 |
#define | IV_1S 1202 |
#define | BTN_DN (PINB & _BV(PINB2)) |
#define | BTN_UP (PINB & _BV(PINB1)) |
#define | DEBOUNCED_S 130 |
#define | DEBOUNCED_L 8 * DEBOUNCED_S |
#define | BTN_TEMP_DELTA 100 |
#define | ENG_RUN_CW PORTB |= _BV(PB4) |
#define | ENG_STOP_CW PORTB &= ~_BV(PB4) |
#define | ENG_RUN_CCW PORTB |= _BV(PB3) |
#define | ENG_STOP_CCW PORTB &= ~_BV(PB3) |
#define | OVM_MSR 8 |
Functions | |
void | TimerInit (void) |
initialize timer resource period: 32µs More... | |
ISR (TIMER0_COMPA_vect) | |
compare match interrupt service for OCR0A More... | |
BTN_CODE | DecodeButton (void) |
identify whether a (and which) button is pressed or not More... | |
UCHAR | GetTenthSec (void) |
interface to get the global tenth seconds More... | |
UCHAR | gMov (void) |
return minute overflow counter More... | |
void | sMov (UCHAR mov) |
set minute overflow counter More... | |
#define BTN_DN (PINB & _BV(PINB2)) |
addressing the value of down button from input pin
Definition at line 24 of file timer.h.
Referenced by DecodeButton().
#define BTN_TEMP_DELTA 100 |
#define BTN_UP (PINB & _BV(PINB1)) |
addressing the value of up button from input pin
Definition at line 28 of file timer.h.
Referenced by DecodeButton().
#define DEBOUNCED_L 8 * DEBOUNCED_S |
number of timer increments to realize a long debounce delay
Definition at line 36 of file timer.h.
Referenced by DecodeButton().
#define DEBOUNCED_S 130 |
number of timer increments to realize a short debounce delay
Definition at line 32 of file timer.h.
Referenced by DecodeButton().
#define ENG_RUN_CCW PORTB |= _BV(PB3) |
translation of engine mode ENG_RUN_CCW to proper output signals
Definition at line 52 of file timer.h.
Referenced by ControlEngine().
#define ENG_RUN_CW PORTB |= _BV(PB4) |
translation of engine mode ENG_RUN_CW to proper output signals
Definition at line 44 of file timer.h.
Referenced by ControlEngine().
#define ENG_STOP_CCW PORTB &= ~_BV(PB3) |
translation of engine mode ENG_STOP_CCW to proper output signals
Definition at line 56 of file timer.h.
Referenced by ControlEngine(), and ISR().
#define ENG_STOP_CW PORTB &= ~_BV(PB4) |
translation of engine mode ENG_STOP_CW to proper output signals
Definition at line 48 of file timer.h.
Referenced by ControlEngine(), and ISR().
#define IV_1S 1202 |
#define OVM_MSR 8 |
#define T0_INC20 25 |
number of required timer increments to get a resolution of 833µs
Definition at line 16 of file timer.h.
Referenced by EnableUsi(), ISR(), and TimerInit().
BTN_CODE DecodeButton | ( | void | ) |
identify whether a (and which) button is pressed or not
btnOff | offset value, indicates the action which is active dependent on the press duration |
Definition at line 119 of file timer.c.
References BC_DN, BC_DNUP, BC_DNUP_L, BC_NONE, BC_UP, BTN_DN, BTN_UP, DEBOUNCED_L, DEBOUNCED_S, FALSE, g_debouncer, TRUE, UCHAR, and UINT.
Referenced by main().
UCHAR GetTenthSec | ( | void | ) |
interface to get the global tenth seconds
Definition at line 192 of file timer.c.
References g_s100.
Referenced by PrintPage().
UCHAR gMov | ( | void | ) |
ISR | ( | TIMER0_COMPA_vect | ) |
compare match interrupt service for OCR0A
TIMER0_COMPA_vect | desired compare match interrupt vector |
counter to count a tenth of a second
counter to count one second
Definition at line 72 of file timer.c.
References ENG_TIMER::allow, CM_MEAS, ENG_TIMER::cnt, ENG_TIMER::em, EM_STOP, ENG_STOP_CCW, ENG_STOP_CW, FALSE, g_ctm, g_debouncer, g_min, g_mov, g_s100, g_sec, IV_1S, NUM_MS, T0_INC20, UCHAR, and UINT.
void sMov | ( | UCHAR | mov | ) |
void TimerInit | ( | void | ) |
initialize timer resource
period: 32µs
TCCR0B <- Timer/Counter0 Control Register B
| - | - | - | TSM [0] | PSR0 [0] | CS02 [1] | CS01 [0] | CS00 [0] |
clock selection:
CS02:CS00, we need a clkio division of 256
enable compare match mode
T0 match value (to get 20ms period)
enable compare match A interrupt
no PLL used
Definition at line 38 of file timer.c.
References CTC0, T0_INC20, and TCC_R0.
Referenced by Init().