View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
Digital input not being read properly |
Posted: Wed Dec 04, 2019 9:17 am |
|
|
Device: PIC24FJ1024GB606
I just set TRISD=0x0F03 and I have injected 3.05V on those pins defined as input but the microcontroller see 0x0020 (I have a TX on RD5) and not 0x0F23.
As far I know only RD6 & RD7 are analogs, so Why I can't read a 1 on those inputs?
Also RPOR12 = 0x0000, so there's no other peripheral output attached to those pins.
RPINR12 = 0x3F3F and I don't understand what does mean.
There's any other peripheral to disable? _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Wed Dec 04, 2019 9:49 am |
|
|
Everything else has priority over basic port I/O.
When a device is selected as 'analog', it is disconnected from the digital
I/O circuitry. It has to be otherwise a voltage that sat around the digital
'transition' point could result in massive overheating of the input circuitry.
The RPINR12 value is the default. means that CCP input A and B are both
mapped to RP63. So 'off'
RPOR12 only affects pins RP24 & RP25. Your pins are affected by a lot
of other registers. RPOR1 for example that affects D8 & D10. etc..
The parallel master port needs to be off. The CLC off. The MCCP off. All the
RPO registers need to be set to 0 for these pins. The RPI registers don't
matter so long as nothing is selecting any of those pins. |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Wed Dec 04, 2019 12:04 pm |
|
|
I just added this code, I need to perform some test, but seems to work as I need.
Code: | SETUP_PMP(PAR_DISABLE,0);
SETUP_PSP(PAR_DISABLE,0);
SETUP_CLC1(CLC_DISABLED);
SETUP_CLC2(CLC_DISABLED);
SETUP_CLC3(CLC_DISABLED);
SETUP_CLC4(CLC_DISABLED);
SETUP_CAPTURE(1,CAPTURE_OFF);
SETUP_CAPTURE(2,CAPTURE_OFF);
SETUP_CAPTURE(3,CAPTURE_OFF);
SETUP_CAPTURE(4,CAPTURE_OFF);
SETUP_CAPTURE(5,CAPTURE_OFF); |
_________________ Electric Blue |
|
|
|