i tried to connect a potentiometer at the analog channel 0 (pin 2 of the pic) but the led in pin rb5 just wont light up.
does the code has something missing?
PORT B is also an 8 bit bi-directional PORT. Its direction controlled and maintained by TRIS B data direction register. Setting the TRIS B into logic ‘1’ makes the corresponding “PORT B” pin as an input. Clearing the TRIS B bit make PORT B as an output.
im feeding the pot with 5v. i try to tune the pot but led doesnt light up
i tried to connect a potentiometer at the analog channel 0 (pin 2 of the pic) but the led in pin rb5 just wont light up.
does the code has something missing?
it works but there is a delay. eg: when i turn the pot to the max, i have to wait for about 15 sec before the LED turns on. and turn i turn the pot the other way, i have to wait another 15 sec before the LED is turned off.
my modified code below
PORT B is also an 8 bit bi-directional PORT. Its direction controlled and maintained by TRIS B data direction register. Setting the TRIS B into logic ‘1’ makes the corresponding “PORT B” pin as an input. Clearing the TRIS B bit make PORT B as an output.
[update]
Problem solved, it was the configuration words. i forget to set to XT which im using @ 4MHz. after setting the conf words, it works perfect now. thnx guys!