i have a source code, i'm using PICC compiler.. the problem is the code is suppose to work as a remote control.. ok that part is working well.. but i cannot seems to remove the latching function.. when i inserted the data the PIC will kept hold of that current condition even though we did not put any data anymore.. let me get this simple k.. exp: if i put letter 'w' the motor will operate but it will operate even if i release the 'w' key, i want the motor to stop running as soon as i release the key... if u understand plz help me.. thanks in advance..
here's the code:
void main()
{
byte status=0;
char data;
set_tris_b(0x00);
output_b(0);
do{
if(kbhit())
{data=getch();
status=1;}
if(status==1)
output_b(0);
{
if(data=='w')
{OUTPUT_B(0b00001001);}
else if(data=='s')
{OUTPUT_B(0b00000110);}
else if(data=='a')
{output_high(PIN_B0);}
else if(data=='d')
{output_high(PIN_B3);}
else if(data=='e')
{output_high(PIN_B6);}
delay_ms(100);
status=0;
}}
while(1);}