Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: Can’t read Port F on a PIC18F87K22

Re: Can’t read Port F on a PIC18F87K22 5 years 11 months ago #16567

Hello

I am struggling to use Port F on a PIC18F87K22 as inputs, I have no issues with other Ports (I’m using D, E & J as inputs) but can’t read F

I’m using Proton Basic and have set
TRISF = %11111111
ADCON0 = %00000000
ADCON1 = %00000000
ADCON2 = %00000000

The manual has a note on turning off the comparators but I’m not sure I've got it right: -

“To configure PORTF as a digital I/O, turn off the comparators and clear ANCON1 and ANCON2 to digital”

Any ideas ?

Regards

Re: Can’t read Port F on a PIC18F87K22 5 years 11 months ago #13568

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
You need to clear the ANCONx registers, not ADCONx

Try this to make all the IO's digital

ANCON0 = %00000000
ANCON1 = %00000000
ANCON2 = %00000000

CM1CON = 0
CM2CON = 0
CM3CON = 0

Set TRIS regs as appropriate

Re: Can’t read Port F on a PIC18F87K22 5 years 11 months ago #13570

Yes, that sorted it

Thanks
Time to create page: 0.238 seconds