View previous topic :: View next topic |
Author |
Message |
arrow
Joined: 17 May 2005 Posts: 213
|
PIN C5 on the PIC18F2550- question? |
Posted: Mon Oct 29, 2007 7:38 am |
|
|
Hi
I have an LED attached to PIN_C5 on the PIC18F2550. When this LED is attached to PIN_C0 it flashes and works well. I now attach the LED to PIN_C5 and I get no signal out of C5 with the same code running (Except the code has been changed from PIN_C0 to PIN_C5).
Can someone please tell me what I am doing wrong?
Thank you
a. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Mon Oct 29, 2007 8:19 am |
|
|
Page 119 of the spec. sheet states:
Quote: | RC5 and RC4 are only available as port pins when the USB module is disabled (UCON<3> = 0). |
This should get the port working.
Ronald |
|
|
Ttelmah Guest
|
|
Posted: Mon Oct 29, 2007 8:21 am |
|
|
A classic 'read the data sheet' question....
Look at paragraph 10.3.
Read what it says half way down about RC4, and RC5 (normally used for the USB interface), and what they can do, when not used for this...
Best Wishes |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Mon Oct 29, 2007 9:12 am |
|
|
Hi
Thank you. I feel a bit embarased for not reading the data sheet.
Can you please tell me how to set the 3rd bit of UCON to 0? (UCON<3>=0) and the UCFG<3>=1?
i.e. how do I access the UCON and UCFG variables?
I appreciate all your help.
a. |
|
|
Ttelmah Guest
|
|
Posted: Mon Oct 29, 2007 9:26 am |
|
|
You need to look further.
Even when the USB is disabled, these two pins are _input only_.
The chip wakes up with USB disabled.
Te reason you are not getting output, is that the pins don't support it...
You can access any bit using the #bit directive.
Best Wishes |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Mon Oct 29, 2007 9:33 am |
|
|
Hi Ttelmah
Thank you for your explanation. Back to the drawing board for me.
All the best
a. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Mon Oct 29, 2007 11:53 am |
|
|
I just remembered that I ran into this exact same problem with this same part. I couldn't figure out why C5 would not output a signal until I dug into the spec. sheet and found it was only available as an input. It's buried in there good.
I used an 18F2525 in it's place. See if that one might be a good replacement for your application. It's a close pin-to-pin replacement.
Ronald |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Tue Oct 30, 2007 1:43 am |
|
|
Thank you all for your help!
Best Regards
a. |
|
|
|