PIC18F13K22 IO problems
Posted: 20 Nov 2012 00:58
Hi,
I have this very simple code that does not work. If I access PORTA.0 directly it works fine but going trough an IF bloc, it does not. I am sure I must be over looking some evident missing something. I have been reading all I could in the PIC's data sheets, internet, etc.
EasyPic7
program MyProject
' test
' Declarations section
' Use an PIC18F13K22, INTOSC 8MHz
main:
' Main program
cm1con0.c1on = 0 ' comparators off
cm2con0.c2on = 0
adon_bit = 0 'adc off
porta = 0
trisa.1 = 1
trisa.0 = 0
lata.0 = 1
delay_ms(1000)
while TRUE
'delay_ms(1000) ' this works... if you uncomment the bloc and comment the if bloc.
'lata.0 = 1
'delay_ms(1000)
'lata.0 = 0
if porta.1 = 1 then ' this does not... as is...
lata.0 = 1
else
lata.0 = 0
end if
wend
end.
I have this very simple code that does not work. If I access PORTA.0 directly it works fine but going trough an IF bloc, it does not. I am sure I must be over looking some evident missing something. I have been reading all I could in the PIC's data sheets, internet, etc.
EasyPic7
program MyProject
' test
' Declarations section
' Use an PIC18F13K22, INTOSC 8MHz
main:
' Main program
cm1con0.c1on = 0 ' comparators off
cm2con0.c2on = 0
adon_bit = 0 'adc off
porta = 0
trisa.1 = 1
trisa.0 = 0
lata.0 = 1
delay_ms(1000)
while TRUE
'delay_ms(1000) ' this works... if you uncomment the bloc and comment the if bloc.
'lata.0 = 1
'delay_ms(1000)
'lata.0 = 0
if porta.1 = 1 then ' this does not... as is...
lata.0 = 1
else
lata.0 = 0
end if
wend
end.