• AVR Freaks

Hot!PORTC pin RC4 and RC5

Author
Gorro
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/03/07 04:12:52
  • Location: 0
  • Status: offline
2020/03/31 04:59:43 (permalink)
0

PORTC pin RC4 and RC5

Hello,
 
I am using PIC18F4550 and I want to make RC4 and RC5 as digital inputs I was reading that I have to disable the USB by writting this (UCON<3> = 0) (UCFG<3> = 1) however this is not working.
 
Please can anyone help me.
Thank you in advance.
#1

2 Replies Related Threads

    pcbbc
    Super Member
    • Total Posts : 1691
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: PORTC pin RC4 and RC5 2020/03/31 05:33:36 (permalink)
    +3 (3)
    datasheetRC5 and RC4 are only available as port pins when the USB module is disabled (UCON<3> =0)

    NOT UCFG<3> = 1
     
    by writting this (UCON<3> = 0) (UCFG<3> = 1)

    That is not valid C.
     
    Probably something like...
    UCONbits.USBEN;

    ..although don't quote me as I haven't used that chip.
     
    Share the code you are using.  Define "not working".  Not compiling?  Not working correctly when run?  Real hardware or simulator?
     
    Edit:
    Note the default for USBEN = 0
    datasheetREGISTER 17-1:UCON: USB CONTROL REGISTER
    bit 3 USBEN: USB Module Enable bit R/W-0
    1 = USB module and supporting circuitry enabled (device attached)
    0 = USB module and supporting circuitry disabled (device detached)

    So, although you shouldn't rely on defaults, it seems unlikely that is your immediate problem.
    post edited by pcbbc - 2020/03/31 05:37:50
    #2
    Gorro
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2019/03/07 04:12:52
    • Location: 0
    • Status: offline
    Re: PORTC pin RC4 and RC5 2020/04/03 12:59:25 (permalink)
    +1 (1)
    I wrote this into main
     
    UCONbits.USBEN = 0; 
    UCFGbits.UTRDIS = 1;
     
    and it is working now.
     
    Thank you.
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5