#define buton_ileri pin_a0
#define buton_geri pin_a1
#define buton_dur pin_a2
int i=0,hiz=200;
int ileri[]={0x01,0x02,0x04,0x08};
int geri[]={0x08,0x04,0x02,0x01};
int dur[]={0x00,0x00,0x00,0x00};
void main()
{
set_tris_a(0x07);
set_tris_b(0x00);
output_a(0x00);
output_b(0x00);
while(1)
{
if (input(buton_ileri))
{
for (i=0; i<=3; i++)
{
output_b(ileri[i]);
delay_ms(hiz);
}
}
if (input(buton_geri))
{
for (i=0; i<=3; i++)
{
output_b(geri[i]);
delay_ms(hiz);
}
}
if (input(buton_dur))
{
for (i=0; i<=3; i++)
{
output_b(dur[i]);
delay_ms(hiz);
}
}
}
}