Permalink
Browse files

Something resembling finished

  • Loading branch information...
1 parent 2adc33f commit 502c18c41f1263746d01be2f55208761fa04ef8c Sam Jacoby committed Jun 7, 2012
Showing with 35 additions and 12 deletions.
  1. +35 −12 t45_pwm/blink.c
View
@@ -10,9 +10,32 @@
*
*/
+/* Interrupt Code
+ *
+ * This bit of code is executed everytime something magnificent happens
+ *
+ */
+
+ISR(SIG_OUTPUT_COMPARE0A) {
+
+
+
+}
+
+
+
int main(void) {
+ /* GTCCR: General Timer/Counter Control Register
+ *
+ * Turn that sucker on and off
+ *
+ */
+
+ // Might as well be off while we're setting up, eh?
+ GTCCR &= ~_BV(TSM);
+
/* TCCR0A: Timer/Counter Control Register A
*
* Set this register to control what happens on the output pin,
@@ -60,29 +83,29 @@ int main(void) {
OCR0A = 0xFF;
+ /* We're going to want to trigger some events synchronously with the timer,
+ * so we'll set the TIMSK: Timer/Counter Interrupt Mask here.
+ *
+ */
+
+ TIMSK |= _BV( OCIE1A )
- // We want PWM output on PB0 -- so set it to an output
+
+ // We want the PWM output on PB0 -- so it's got to be set as an output
DDRB |= (1 << PB0);
// This enables global interrupts now and forever--until they're turned off
sei();
+ // Turn the timer on, stand back, and do nothing.
+ GTCCR = _BV(TSM);
+
while(1) {
- cycle_pin(PB0);
- cycle_pin(PB1);
- cycle_pin(PB2);
+
}
return 0;
}
-// Cycle @pin for @delay milliseconds
-void cycle_pin(int pin) {
-
- PORTB |= (1 << pin);
- _delay_ms(DELAY);
- PORTB &= ~(1 << pin);
-
-}

0 comments on commit 502c18c

Please sign in to comment.