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

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

Re: [avr-gcc-list] TWI interrupt problem


From: Sander Pool
Subject: Re: [avr-gcc-list] TWI interrupt problem
Date: Tue, 25 Mar 2003 17:52:24 -0800

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;
> }




reply via email to

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