CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Digital input not being read properly

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

Digital input not being read properly
PostPosted: Wed Dec 04, 2019 9:17 am     Reply with quote

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: 19510

View user's profile Send private message

PostPosted: Wed Dec 04, 2019 9:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 04, 2019 12:04 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group