ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
Loading...
Searching...
No Matches
Macros
avr_timers.h File Reference
#include <avr/io.h>
#include <stdint.h>
Include dependency graph for avr_timers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TIMER0_Init(cs, ctc, timsk0)
 Initialize Timer0.
 

Macro Definition Documentation

◆ TIMER0_Init

#define TIMER0_Init ( cs,
ctc,
timsk0 )
Value:
TCCR0A = ((ctc & 1) << WGM01); \
TCCR0B = cs & 0b111; \
TIMSK0 = timsk0 & 0b111;

Initialize Timer0.

Normal waveform gen mode (WGM2:1 are 0)

Parameters
cs3 bits: 0: no timer, 1: no prescale, 2, /8 prescale 3: /64 prescale 4: /256 prescale 5: /1024 prescale
ctc(1 bit); 1: clear counter when counter reaches OCR0A; 0: clear counter when read 255
timsk0bits enable interrupts: bit 0: interrup on overflow bit 1: interrupt on match OCR0A bit 2: interrupt on match OCR0B

OCR0A and OCR0B are writable compare registers to set when interrupt and ctc happens

Definition at line 28 of file avr_timers.h.