[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] TWI interrupt problem
From: |
Todd Lucas |
Subject: |
RE: [avr-gcc-list] TWI interrupt problem |
Date: |
Tue, 25 Mar 2003 18:05:24 -0800 |
It does indeed. The CRT just goes into an endless loop when main is exited.
-----Original Message-----
From: Sander Pool [mailto:address@hidden
Sent: Tuesday, March 25, 2003 5:52 PM
To: Andreas Trenkwalder; AVRGCC List
Subject: Re: [avr-gcc-list] TWI interrupt problem
What happens to an interrupt driven program that falls out of main? I
presume it continues to service interrupts but I always put a while(1); at
the end.
I haven't played with TWI myself yet so no other help, sorry.
Sander
----- Original Message -----
From: "Andreas Trenkwalder" <address@hidden>
To: "AVRGCC List" <address@hidden>
Sent: Tuesday, March 25, 2003 5:39 PM
Subject: [avr-gcc-list] TWI interrupt problem
> --
> void i2c_init(void)
> {
> cbi(TWSR, TWPS0);
> cbi(TWSR, TWPS1);
> TWBR = F_CPU/(2 * 100000) - 8;
> // enable ACK, twi interrupt, and twi hardware
> TWCR = _BV(TWEA) | _BV(TWEN)| _BV(TWIE);
> sei();
> }
>
> inline void i2c_start(void)
> {
> TWCR = _BV(TWINT)|_BV(TWSTA)|_BV(TWEN);
> }
>
> //TWI interrupt service routine
> SIGNAL(SIG_2WIRE_SERIAL)
> {
> PORTB = 0xF0;
> TWCR = _BV(TWINT);
> }
>
> int main (void)
> {
> DDRB = 0xFF;
> PORTB = 0x00;
> i2c_init();
> i2c_start();
> return 0;
> }
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list