• AVR Freaks

Hot!Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808

Author
didac_dsg
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/10/09 07:24:09
  • Location: 0
  • Status: offline
2019/11/05 10:12:41 (permalink)
0

Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808

Hello,
I'm using DSPIC33EP128GS808.
I'm having problems to access following pins:
RB2 (RB2 is mapped to pin 35: OSC2/CLKO/AN7/CMP3D/CMP4B/PGA1N2/RP34/RB2 ).
RC2 (RC2 is mapped to pin 45: EXTREF1/AN9/CMP4D/RP50/RC2 ).
I want to access those pins as a digital output.
I'm configuring rellated TRISbits as "0" (pin is configured as output).
TRISCbits.TRISC3 = 0;
TRISDbits.TRISD15 = 0;
I'm configuring RPOR3 with value 0x0000 in order to have RP34 pin as default value (which I asume it's RB2).
RPOR3=0x0000;

I'm configuring RPOR11 with value 0x0000 in order to have RP50 pin as default value (which I asume it's RC2).
RPOR11=0x0000;

What configuration I'm missing??

Thank you very much in advance.
With best regards,
Didac
#1

6 Replies Related Threads

    rodims
    Super Member
    • Total Posts : 1557
    • Reward points : 0
    • Joined: 2009/02/10 11:08:59
    • Location: 51.9627, 7.6262
    • Status: offline
    Re: Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808 2019/11/05 11:06:32 (permalink)
    5 (1)
    I assume you are using the 80 pin TQFP
     
    I'm configuring related TRISbits as "0" (pin is configured as output).

    How are
    TRISCbits.TRISC3 = 0; 
    TRISDbits.TRISD15 = 0;

    related to RB2 and RC2  ?
    #2
    ric
    Super Member
    • Total Posts : 28336
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808 2019/11/05 15:15:53 (permalink)
    0
    As above, you are switching the wrong TRIS bits.
    Also, as you mentioned, RB2 is "OSC2/CLKO/AN7/CMP3D/CMP4B/PGA1N2/RP34/RB2"
    The first two functions (OSC2/CLKO) are controlled by your CONFIG settings, but you have not revealed them.
     
    That is why we prefer to a see a small COMPLETE example program of how you tested something, as by definition you don't know where the problem is.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #3
    spdmtl
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Status: offline
    Re: Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808 2019/11/05 16:44:50 (permalink)
    0
    You will need to clear ANSEL bits and set cgf OSCIOFNC to use digital pin function instead of OSCO
    #4
    ric
    Super Member
    • Total Posts : 28336
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808 2019/11/05 16:49:49 (permalink)
    0
    ANSEL bits have no effect on outputs, unless you're silly enough to write PORTx registers when you should use LATx registers.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #5
    rodims
    Super Member
    • Total Posts : 1557
    • Reward points : 0
    • Joined: 2009/02/10 11:08:59
    • Location: 51.9627, 7.6262
    • Status: offline
    Re: Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808 2019/11/06 11:13:46 (permalink)
    0
    Identical 2 week old request by OP with different pins.
    https://www.microchip.com/forums/m1116360.aspx
    Obviously a sloppy copy and paste.
     
    #6
    du00000001
    Just Some Member
    • Total Posts : 3942
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Problem accessing pins RB2 and RC2 on DSPIC33EP128GS808 2019/11/06 12:23:30 (permalink)
    0
    Some are slow learners, ans some never learn.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #7
    Jump to:
    © 2020 APG vNext Commercial Version 4.5