i did a small test but it is not what i need.
I would like now once again to clear the following.
Henrik said
"One more thing: You're clearly reading PORTB which must mean you're using those five low bits as inputs, yet, at the top of the program you have TRISB = %00000000 which makes all of PORTB outputs..."
As this statement, how could we read the status of the actual pin without using the port as input. Could you please explain to me the method?
Code:
ANSELA = 0
DEFINE OSC 64
OSCCON = $70
OSCTUNE.6 = 1
TRISA = %11111100
led1 var porta.0 ; alias led1 to porta.0
led2 var porta.1 ; alias led2 to porta.1
x var bit ; tried to use X var as a bit in order to hold the value of the actual status of the pin.
lata = 0 ; based on the schematic, we write to LATA and clear the ports
x = 0 ; we write 0 to var X
loopy:
lata.0 = 1 ; we write 1 to lata.0
gosub holdmem ; gosub to holdmem
pause 500
read 5,led2 ; write the value of the location 5 to led2
pause 500
lata.0 = x ; write the value of X to lata.0
lata.1 = x ; write the value of X to lala.1
pause 1000
goto loopy
holdmem:
write 5,led1 ; read the state of the porta.0 and place it to location 5 in memory.
return
Bookmarks