rknepp
- 8th March 2011, 13:14
I am using an 18F4525 and I would like to use PortA as inputs. I am using an external osc, so pins RA6 and RA7 are allocated for that function. I have configured PortA to be all inputs, but when I read the port with logic 1 on the inputs, RA2 and RA3 always show 0. Can someone point out what I am doing wrong? Thank you.
porta = %00000000
adcon1 = %11111111 ' PortA - Set to digital
cmcon = %00000111 ' Disable Comparators
trisa = %11111111 ' PortA - All Inputs
trisb = %00000000 ' PortB - All Outputs
statusloop: portb = porta
pause 500
goto statusloop
I have LEDs on all PortB pins and bits 0, 1, 4, & 5 follow the logic placed on the corresponding PortA pins. Bits 2 and 3 always show 0.
porta = %00000000
adcon1 = %11111111 ' PortA - Set to digital
cmcon = %00000111 ' Disable Comparators
trisa = %11111111 ' PortA - All Inputs
trisb = %00000000 ' PortB - All Outputs
statusloop: portb = porta
pause 500
goto statusloop
I have LEDs on all PortB pins and bits 0, 1, 4, & 5 follow the logic placed on the corresponding PortA pins. Bits 2 and 3 always show 0.