Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Registers associados com o Timer 1 e envolvidos como code
- *
- * TCCR1A Timer/Counter1 Control Register A COM1A1 COM1A0 COM1B1 COM1B0 – – WGM11 WGM10 -->> 0x40
- *
- * Compare Output Mode, non-PWM
- * COM1A1/COM1B1 COM1A0/COM1B0 0 1 Toggle OC1A/OC1B on Compare Match.
- *
- * Mode | WGM13 | WGM12 | WGM11 | WGM10 | Timer/Counter | TOP | Update of | TOV1 Flag
- * | | CTC1) |(PWM11)|(PWM10)|Mode of Operation| | OCR1x at | Set on
- * 4 | 0 | 1 | 0 | 0 | CTC | OCR1A | Immediate | MAX
- *
- * MAX = The counter reaches its MAXimum when it becomes 0xFFFF (decimal 65535).
- *
- * TCCR1B – Timer/Counter1 Control Register B ICNC1 ICES1 – WGM13 WGM12 CS12 CS11 CS10 -->> 0x09
- *
- * Mode | WGM13 | WGM12(CTC1)
- * 4 | 0 | 1
- *
- * CS12 | CS11 | CS10 | Description
- * 0 | 0 | 0 | No clock source (Timer/Counter stopped).
- * 0 | 0 | 1 | clkI/O/1 (No prescaling) 8 mHz
- * 0 | 1 | 0 | clkI/O/8 (From prescaler) 1 mHz
- * 0 | 1 | 1 | clkI/O/64 (From prescaler) 125 kHz
- * 1 | 0 | 0 | clkI/O/256 (From prescaler) 31250 Hz
- * 1 | 0 | 1 | clkI/O/1024 (From prescaler) 7812,5 Hz
- * 1 | 1 | 0 | External clock source on T1 pin. Clock on falling edge.
- * 1 | 1 | 1 | External clock source on T1 pin. Clock on rising edge.
- *
- * DDRB = Direction port bits 0 INPUT 1 OUTPUT
- *
- * OC1A/PCINT1 – Port B, Bit 1
- * OC1A, Output Compare Match output: The PB1 pin can serve as an external output for the Timer/Counter1
- * Compare Match A. The PB1 pin has to be configured as an output (DDB1 set (one)) to serve this function.
- * OC1A é o PIN PB1 OC1A (Timer/Counter1 Output Compare Match A Output) PORT 9
- */
- //------- CODE ----------------
- void setup()
- {
- DDRB = 0x02; // define port 9 como saida
- TCCR1A = 0x40; // Ler texto acima
- TCCR1B = 0x0A; // Ler texto acima 1 mHz
- }
- //---------------------------
- void loop ()
- {
- ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement