i am using 18f4550 and c18 compiler.one sensor is connected to the port E0.motors are coneected to rc1 rd0 and rd3 rd4.
problem statement:whenever the sensor detects a black line or switches off, integer i has to increment by 1(all other times the sensor is high).
PATH:black tapes are arranged horizontally with gap of 20 cm on white surface
here goes my program.......
define an PORTEbits.RE0
TRISE = 0b00000001;
TRISC = 0;
TRISD = 0;
PORTC = 0b00000000; //run motors forward
PORTD = 0b00001001;
PORTC = 0b00000000; //turn left
PORTD = 0b00000101;
problem:the bot is running properly.....but it is not responding to the integer i(the direction is not changing)