comparison testavr.c @ 54:58f1ec46bff6

Add a beeper when the data is stale (only when USB is disabled as they share a pin) Move the time of day timer to OCR2 so we can use PB3/OC0 for PWM.
author darius@Inchoate
date Wed, 29 Oct 2008 17:41:04 +1030
parents 98b5a43fc748
children 09f8d879afb9
comparison
equal deleted inserted replaced
53:98b5a43fc748 54:58f1ec46bff6
82 DDRB = 0x0d; 82 DDRB = 0x0d;
83 PORTB = 0x00; 83 PORTB = 0x00;
84 #else 84 #else
85 DDRA = 0xff; 85 DDRA = 0xff;
86 PORTA = 0x00; 86 PORTA = 0x00;
87
88 DDRB = 0x00;
89 PORTB = 0x00;
90
87 #endif 91 #endif
88 /* GPIO (0:7) */ 92 /* GPIO (0:7) */
89 DDRC = 0xff; 93 DDRC = 0xff;
90 PORTC = 0x00; 94 PORTC = 0x00;
91 95
92 /* USART (0:1), IDBus (2:5), 485 (6:6), GPIO (7:7) */ 96 /* USART (0:1), IDBus (2:5), 485 (6:6), GPIO (7:7) */
93 DDRD = 0xf7; 97 DDRD = 0xf7;
94 PORTD = 0xf7; 98 PORTD = 0xf7;
99
100 #ifndef WITHUSB
101 /* Beep
102 *
103 * Fpwm = Fclk / (N * 510)
104 * = 16e6 / (8 * 510)
105 * = 3921Hz
106 *
107 * Behind ifndef because PB3 is A0 on PDI chip
108 *
109 * Phase correct PWM, non-inverted output, divide by 8 */
110 TCCR0 = _BV(WGM00) | _BV(WGM11) | _BV(COM00) | _BV(COM01) | _BV(CS01);
111 OCR0 = 253;
112 #endif
95 113
96 /* Set up the one wire stuff */ 114 /* Set up the one wire stuff */
97 OWInit(); 115 OWInit();
98 116
99 /* Init UART */ 117 /* Init UART */