Commits

Trammell Hudson  committed 3fce575 Draft

Correct time scale

  • Participants
  • Parent commits c9cf357

Comments (0)

Files changed (1)

File alphawatch.c

 	out(WRCE, 1);
 }
 
-static uint8_t ms;
+static uint16_t ms;
 static uint8_t sec;
 static uint8_t min;
 static uint8_t hour;
 static void
 update_time(void)
 {
-	if (++ms < 200)
+	if (++ms < 500)
 		return;
 
 	ms = 0;
 	lcd_write(CHAR_RAM | 7, 'K');
 
         // Timer 0 is used for a 64 Hz control loop timer.
-        // Clk/1024 == 15.625 KHz, count up to 244
+        // Clk/256 == 62.5 KHz, count up to 125 == 500 Hz
         // CTC mode resets the counter when it hits the top
         TCCR0A = 0
                 | 1 << WGM01 // select CTC
 
         TCCR0B = 0
                 | 0 << WGM02
-                | 1 << CS02 // select Clk/1024
+                | 1 << CS02 // select Clk/256
                 | 0 << CS01
                 | 0 << CS00
                 ;
 
-        OCR0A = 244;
+        OCR0A = 125;
         sbi(TIFR0, OCF0A); // reset the overflow bit