I have a strange problem when setting a pin high on a PIC18F2525 on the A port. Below is the code simplified to almost nothing, but demonstrates the problem. PortA.3 will not go high to 5v, it stays at 0v when I also set PortA.4 pin high, but if I add a 1 ms delay between the commands, then it works or reverse the order in setting the pins high then PortA.3 can be set high to 5v. Below is the code. Does anybody have any clues as to what is going on, or have I missed something in the data sheet on configuring Port A. Even though I have a simple solution, it would be nice to understand what is going on, because it usually will come back to bite me.
Terry
Define OSC 20
ADCON1 = %00001110 ' Sets port A to digital except A0
TRISA=%00000001 ' Set Port A to outputs, except A0
PORTA.3 = 1 ' This does not work, but if either a delay is added after this
'pause 1 ' line or the PortA.4=1 line is in front of the PortA.3=1 line it works.
PortA.4 = 1
END
Bookmarks