All pastes #391419 Raw Edit

Mine

public c v1 · immutable
·published 2007-03-12 03:31 UTC
rendered paste body
#include <avr/io.h>int g_minutes = 0;int g_hour = 0;int g_seconds = 0;void incSeconds(){   g_seconds++;   if( g_seconds == 60 )   {      g_seconds = 0;      g_minutes++;      if( g_minutes == 60 )      {         g_minutes = 0;         g_hour++;         g_hour %= 24;       }   }}void displayTime(){   int digits[4];   digits[1] = g_hour % 10;   digits[0] = ( g_hour % 100 - digits[1] ) / 10;   digits[3] = g_minutes % 10;   digits[2] = ( g_minutes % 100 - digits[3] ) / 10;   digits[0] = 1;   digits[1] = 5;   digits[2] = 8;   digits[3] = 9;   PORTB = digits[0];   PORTC = 1 << 0;   PORTC = 0;   PORTB = digits[1];   PORTC = 1 << 1;   PORTC = 0;   PORTB = digits[2];   PORTC = 1 << 2;   PORTC = 0;   PORTB = digits[3];   PORTC = 1 << 3;   PORTC = 0;}int main(void) {   DDRB = 0xFF;   DDRC = 0xFF;   PORTB = 0;   PORTC = 0;   while( 1 )   {      incSeconds();      displayTime();   }   return 0;}