Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  pak het project tint.zip.

Similar presentations


Presentation on theme: "Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  pak het project tint.zip."— Presentation transcript:

1 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  pak het project tint.zip

2 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 2 int Timeout = 0; extern void MyTimerInterrupt( void ){ // signal the timeout to the main Timeout = 1; // clear interrupt flags: prepare for next interrupt T1IR = 0xFF; }

3 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 3 extern int main(){ static int led = 1; InitTimer( MyTimerInterrupt ); while (1){ if( Timeout ){ Timeout = 0; // toggle LED led = !led; if (led) hc595(1); else hc595(0); } return 0; }

4 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 4 void InitTimer( void (*func)(void) ) { __disable_interrupts(); // Initialise timer1 T1TCR = 0;// stop and reset counter and prescaler T1PC = 2/*div by 2*/ - 1;// prescale counter T1MR0 = / 4/*VPBDIV*/;// max counter value T1MCR = 1<<1 | 1<<0;// reset and interrupt on match T1IR = 0xFF; // clear interrupt flags // Initialise VIC VICIntSelect &=~ (1<<5);// select IRQ mode instead of FIQ VICVectCntl[0] = 0x20/*enable*/ | 5/*timer 1*/; *irqVector0 = func;// wrapped interrupt vector VICIntEnable = 1<<5;// enable interrupt source T1TCR = 1;// start VICVectAddr = 0xFF;// update priority hardware __enable_interrupts(); }

5 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 5 Datasheet P.137 T1TCR = 0;

6 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 6 Datasheet P.136 T1PC = 2/*div by 2*/ - 1;

7 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 7 Datasheet P.137 T1MR0 = / 4/*VPBDIV*/;

8 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 8 Datasheet P.137 T1MCR = 1<<1 | 1<<0;

9 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 9 Datasheet P.136 T1IR = 0xFF;

10 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 10 Datasheet P.68

11 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 11 Datasheet P.136 VICIntSelect &=~ (1<<5);

12 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 12 Datasheet P.66 VICVectCntl[0] = 0x20/*enable*/ | 5/*timer 1*/;

13 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 13 Datasheet P.66 *irqVector0 = func;

14 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 14 Datasheet P.137 T1TCR = 1;


Download ppt "Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  pak het project tint.zip."

Similar presentations


Ads by Google