]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/main.c
Use timer 4 instead of 3 for systick (1ms).
[z180-stamp.git] / avr / main.c
index 2199454fa0bd9654ea83804c2ebf051594a59d4b..0a1cab6535be3d4268a2d4264998a04687b089aa 100644 (file)
@@ -115,10 +115,10 @@ void setup_avr(void)
        CLKPR = 0;
 
        /* Timer */
-       PRR1 &= ~_BV(PRTIM3);
-       OCR3A = F_CPU / 1000 - 1;       /* Timer3: 1000Hz interval (OC3A) */
-       TCCR3B = (0b01<<WGM32)|(0b001<<CS30); /* CTC Mode, Prescaler 1 */
-       TIMSK3 = _BV(OCIE3A);           /* Enable TC2.oca interrupt */
+       PRR1 &= ~_BV(PRTIM4);
+       OCR4A = F_CPU / 1000 - 1;       /* Timer4: 1000Hz interval */
+       TCCR4B = (0b00<<WGM42)|(0b001<<CS40); /* Normal Mode, Prescaler 1 */
+       TIMSK4 = _BV(OCIE4A);           /* Enable Output Compare A interrupt */
 
        /* INT5, INT6: falling edge */
        EICRB = (EICRB & ~((0b11 << ISC50) | (0b11 << ISC60))) |