#include<90s2313.h>
#define enc_a PIND.3
#define enc_b PIND.4
bit a, b;
void main(void)
{
signed char d;
PORTB=0xFF;
DDRB=0xFF;
PORTD=0x18;
DDRD=0x07;
while (1)
{
if(a != enc_a || b != enc_b)
{
if(enc_a ^ b)
d++;
else
d--;
a = enc_a;
b = enc_b;
}
}
}