Update for 03-11-21 15:15
This commit is contained in:
parent
5865a60940
commit
921348243e
@ -107,8 +107,31 @@ Status Register (SREG 0x5F). Bit 7 is the global interrupt enable flag, and
|
||||
must have a one (1) written to it in order for interrupts to occour, regardless
|
||||
of the state of the EIMSK register.
|
||||
|
||||
To implement an interrupt in code, see the following C example
|
||||
{{{
|
||||
//enable the interrupts as explained above
|
||||
ISR(INT0_vect){
|
||||
//perform interrupt task
|
||||
}
|
||||
}}}
|
||||
|
||||
=== Clock ===
|
||||
|
||||
The ATMega328P has 3 timers, two 8bit timers and one 16bit timer. These timers
|
||||
can be used for PWM for motors and the like.
|
||||
|
||||
The Timer Counter 1 Control Register A (TCCR1A 0x80) is the register for
|
||||
controlling Timer/Counter 1, along with Timer Counter 1 Control Register B
|
||||
(TCCR1B 0x81). The high sets of two bits (bits 7-6 and 5-4), control the
|
||||
compare output mode for channel A and B respectivly. These are controlled with
|
||||
2 bit combinations as shown below.
|
||||
|
||||
| Bits | Description |
|
||||
----------------------
|
||||
| 00 | Normal Port operation, Comp register disconnected |
|
||||
| 01 | Toggle OC1A/OC1B on compare match |
|
||||
| 10 | Clear OC1A/OC1B on compare match (set output low) |
|
||||
| 11 | Set OC1A/OC1B on compare match (set output high) |
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user