Some comments added.

This commit is contained in:
Kai Lauterbach 2011-12-24 18:30:04 +01:00
parent b3d7d00593
commit 70e877008f
2 changed files with 12 additions and 8 deletions

View file

@ -33,20 +33,20 @@ void init()
DDRB = 0b11111111; // PB0-PB7: LED 1-8 (Kathode) DDRB = 0b11111111; // PB0-PB7: LED 1-8 (Kathode)
PORTB = 0b11111111; // HIGH PORTB = 0b11111111; // HIGH
DDRD = 0b01111000; // PD6: LED 9 (Kathode); PD5-PD3: A-C (Anoden) DDRD = 0b01111000; // PD6: LED 9 (Kathode); PD5-PD3: A-C (Anode)
PORTD = 0b01000000; PORTD = 0b01000000;
// Setup Timer-Interrupt "TIMER1" // Setup Timer-Interrupt "TIMER1" compare match interrupt
TIMSK |= (1 << OCIE1A); TIMSK |= (1 << OCIE1A);
// Refreshrate is 100Hz // Refreshrate is 100Hz of the whole LEDCube.
// Set the compare value // The ISR comes up at 300Hz.
// Set the compare value to
// 625d = 0x271 = 0b00000010, 0b01110001 // 625d = 0x271 = 0b00000010, 0b01110001
OCR1AH = 0b00000010; OCR1AH = 0b00000010;
OCR1AL = 0b01110001; OCR1AL = 0b01110001;
// anpassen auf reihenweise ausgabe // Set prescale to 64 and clear the counter on compare match.
// prescale is 64 (0x011) ----> CS12=0, CS11=1, CS10=1
TCCR1B |= (1 << CS11) | (1 << CS10) | (1 << WGM12); TCCR1B |= (1 << CS11) | (1 << CS10) | (1 << WGM12);
sei(); // Enable interrupts global sei(); // Enable interrupts global
@ -56,8 +56,7 @@ void init()
ISR (TIMER1_COMPA_vect) ISR (TIMER1_COMPA_vect)
{ {
//delay--; // decrease the delay counter if ( !(--delay) ) // decrease the counter and check if we are done with waiting
if ( !(--delay) ) // check if we are done with waiting
{ {
if (frmnum == MAX_EEPROM_FRAMES) if (frmnum == MAX_EEPROM_FRAMES)
{ {

View file

@ -20,6 +20,11 @@
#include <avr/eeprom.h> #include <avr/eeprom.h>
// Cube-Data // Cube-Data
// bit 0 - 8 = level 1
// bit 9 - 17 = level 2
// bit 18 - 26 = level 3
// bit 27 - 31 = The delay in ISR calls multiplied with 8 until
// the next frame will be shown (load from the EEPROM)
uint32_t frame; uint32_t frame;
uint8_t level; // current layer uint8_t level; // current layer