View previous topic :: View next topic |
Author |
Message |
picuser1234
Joined: 06 Oct 2009 Posts: 1
|
Disable USB control and configuration in PIC18f4550 |
Posted: Tue Oct 06, 2009 2:29 pm |
|
|
I need to use ports C5 and C6 in the PIC18f4550. However, the datasheet says:
"To use pins RC4 and RC5 as digital inputs, the USB module must be disabled (UCON<3> = 0) and the on-chip USB transceiver must be disabled (UCFG<3> = 1)."
How do I turn off these functions using the C compiler? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 06, 2009 6:22 pm |
|
|
Look at this diagram in the USB section of the 18F4550 data sheet:
Quote: |
REGISTER 17-1: UCON: USB CONTROL REGISTER
|
It shows that the USBEN bit controls the USB module:
Quote: |
USBEN: USB Module Enable bit
1 = USB module and supporting circuitry enabled (device attached)
0 = USB module and supporting circuitry disabled (device detached) |
It shows that the power-on reset state of USBEN is 0, which disables
the USB module. The CCS start-up code in doesn't write to the UCON
register, so it's already disabled and you don't have to do anything.
If you do want to disable the USB module in code, then use a #byte
and #bit statement to create a USBEN_BIT variable. Get the UCON
register address and the USBEN bit number from the 18F4550 data
sheet. Then just set USBEN_BIT to 0 in your code. |
|
![](templates/subSilver/images/spacer.gif) |
erkantr67
Joined: 04 Aug 2012 Posts: 1
|
|
Posted: Sat Aug 04, 2012 5:48 pm |
|
|
Hi,
There was a circuit C programmer should use CCS 18F4550. But that is usb d + d-d + d-rc4 rc5 is on the edges is normal rc4 rc5, I / O, I can not use. How do I close the ends of the d-and d + Would Help?
More information in English for I'm not Turkish. So I wrote them to you using the google translation by you may seem a little pointless.
Thank you in advance for your answers.
If you send an email to xxxxxxxxxxxxx Is How I'll be satisfied.
Thank you again. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Aug 04, 2012 6:53 pm |
|
|
Pins RC4 and RC5 can only be digital inputs. You can't make them into
digital outputs. The 18F4550 is designed for them to be digital inputs
only (if you disable the USB function).
If you need RC4 and RC5 to be digital outputs, then you must use a
different PIC. You could use the 18F4520. |
|
![](templates/subSilver/images/spacer.gif) |
|