avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] strange behaviour of my interrupt routine, please help


From: Nicolas nickisch
Subject: [avr-gcc-list] strange behaviour of my interrupt routine, please help
Date: Sun, 15 Jul 2001 18:41:09 +0200

I am quite new with the AVR-GCC, so some of my softwrae projects were
primarily developed
 with the demo version of the CODEVISION C- Compiler.

So I developed a program which uses the external interrupt 0 with an falling
edge on the pin.

The program works now with the AVR-GCC as well as with CODEVISION.

The problem is, the interrupt program works only AFTER the first
CODEVSION-program was loaded on the 8515.

So this works:

- POWER ON
- Flash Codevision program
- Flash GCC-version of the program

Then it deosn't work any more:
- POWEROFF
- Wait as long as you want
- POWER ON (AVR-GCC version stays flashed)

I think it is a question of correct initialitzation of the AVR8515

Do you find an error in the following code sequence ?

....
SIGNAL(SIG_INTERRUPT0)
{
        unsigned char pcf8574[3];
        u16 test;
        char int_zaehler_str[8];
        char i=0;


        lcd_gotoxy(9,1);
        lcd_puts("##\n");

        //Baustein mit Adresse 70 lesen ...
        for(i=0;i<2;i++) {      // später sind die ADRESSEN ZU KORRIGIEREN
                //i2c_start(71);

                //die nachfolgende I2C-Adresse muss in der endgültigen Version
                //auf 65 geändert werden !!!
                i2c_start(71+i*2);              // set device address and read 
mode
(Adresse 70 + 1)
                pcf8574[i] = i2c_read(0);       // read one byte
                i2c_stop();                     // sende STOP-Kondition

                 // set stop conditon = release bus

        }
....

main()
{
        outp(0x00,PORTD);
    outp(0x00,DDRD);

    outp(0x40| inp(GIMSK),GIMSK);
    outp(0x02|inp(MCUCR),MCUCR);
    outp(0x40|inp(GIFR),GIFR);


    sei();
}


Thank you for your help

Nicolas Nickisch




reply via email to

[Prev in Thread] Current Thread [Next in Thread]