Gast
#427356
Halli Hallo,
Benutze Atmega16
Ich hab ein großes Problem, bitte helft mir. Ich bekomm das mit den
Interrupts nicht auf die Reihe. Ich erhalte beim compilieren Warnungen,
kann also das Hex-file draufladen aber es tut sich nix. Ich will die
Variable Sek hochzählen und auf ein LCD schreiben, wie schnell ist mir
vorerst mal egal.
Laut den Warnungen kennt er die ISR nicht (no prototype), benutze ich
ein
fasches interrupt.h?
#include <avr\io.h>
#include <avr\interrupt.h>
#include "xlcd16.h"
void initPortsMC(void);
volatile int Sek;
//----------------------------------------------------------------------
--
ISR(SIG_OVERFLOW0)
{
Sek++;
}
//----------------------------------------------------------------------
--
//----------------------------------------------------------------------
--
int main( void )
{
Sek = 0;
initPortsMC();
lcd_port_init16();
lcd_init16();
// Display-Hintergundbeleuchtung
BelDisHintergrund(1);
TIMSK = ( 1 << TOIE0 ); // Timer Overflow Interrupts zulassen
TCCR0 = ( 1 << CS01 ); // Vorteiler von 8
sei();
while(1)
{
lcd_gotoxy16(1,1);
lcd_show_intvalue16(Sek);
}
}
//----------------------------------------------------------------------
--
//----------------------------------------------------------------------
--
void initPortsMC(void)
{
DDRA |= 0b11110000;
PORTA |= 0b11110000;
DDRB = 0b11111000;
PORTB = 0b11111111;
DDRC = 0b11111111;
PORTC = 0b11111111;
}
//----------------------------------------------------------------------
-----