Àíòîùåíêîâ Ðîìàí Âèêòîðîâè÷ wrote:
> Hello!
> I build project on AVRStudio 4.16 and WinAVR.
> I try handle high level on PCINT8-11.
>
> PORTB=0x00;
> DDRB=0xF0;
>
> EICRA=0x02;
> EIMSK=0x01;
> EIFR=0x01;
> PCMSK1=0x0F;
> PCICR=0x02;
> PCIFR=0x02;
>
> ISR(PCINT1_vect)
> {
> unsigned char x = PORTB;
> if ((x & Bit(0)) == 1)
> {
> ...
> }
> if ((x & Bit(1)) == 1)
> {
> ...
> }
> if ((x & Bit(2)) == 1)
> {
> ...
> }
> if ((x & Bit(3)) == 0)
> {
> ...
> }
> }
>
> It doesn't work.
> Any idea?
>
Fix your code like this:
ISR(PCINT1_vect)
{
unsigned char x = PORTB;
if (x & Bit(0))
{
...
}
if (x & Bit(1))
{
...
}
if (x & Bit(2))
{
...
}
if (x & Bit(3))
{
...
}
} /* ISR */
Should work.
erikcMessage
Re: [AVR-Chat] How to handle PCINT8-11 on ATMEGA644P
2010-04-10 by erikc
Attachments
- No local attachments were found for this message.