In this very simple code I am just trying to play with the if statement. I have set port A pin 0 to be an input and have it hotwired to be high. However, the led connected to port B pin 0 WONT TURN ON. The led for port B pin 1 is just a heartbeat. I know that my circuit is wired correctly, and I can't see anything wrong in this code. Any help would be appreciated.
TRISA.0 = 1
loop1:
if PORTA.0 = 1 then
PORTB.0 = 1
endif
high PORTB.1
goto loop1
end
EDIT: I went back and changed the line:
PORTB.0 = 1
to
high PORTB.0
After this change the led is always on even when I disconnect PORTA.0 from the 5 volt supply. It seems as if the IF statement is being ignored. Also, I dont have resistors connected to any of the PORTA or PORTB pins. I dont think this is the problem though.
Bookmarks