18f4550 usb issues
Moderator: Benj
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
18f4550 usb issues
I need to use ports C4 and C5 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)."
can someone help me with the config setting in flowcode please.
"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)."
can someone help me with the config setting in flowcode please.
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: 18f4550 usb issues
I think this should work...
At the start of your program, add a C-icon and enter the following:
At the start of your program, add a C-icon and enter the following:
Code: Select all
UCON = 0x00;
UCFG = 0x08;
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
Re: 18f4550 usb issues
Thank you,
unfortunately it is not helping.
I attached my flowcode.
I simply cannot read the two inputs as inputs.
is it not possibly the standard config in Flowcode overriding this instruction.
unfortunately it is not helping.
I attached my flowcode.
I simply cannot read the two inputs as inputs.
is it not possibly the standard config in Flowcode overriding this instruction.
- Attachments
-
- controller_3_Tester.fcfx
- (50.27 KiB) Downloaded 216 times
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
Re: 18f4550 usb issues
I have basicly done a simple flowcode only to test this function, it is not working.
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: 18f4550 usb issues
There seem to be lots of issues with these pins on that chip. Another suggestion from my searches is to add these to the C-icon:
Unfortunately, I don't have suitable hardware to hand so I can't test.
Code: Select all
ADCON1 = 0x0F;
CMCON = CMCON | 0x07;
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 18f4550 usb issues
Hello,
This is the code we use on the 18F4550 devices to initialise them with all I/O.
Hopefully this will work for you.
The pins C4 and C5 should hopefully now work as inputs, the pins cannot be used as outputs.
This is the code we use on the 18F4550 devices to initialise them with all I/O.
Code: Select all
ADCON0 = 0x3D;
ADCON1 = 0x0F;
UCFG = 0x08;
cr_bit(PIE2, USBIE);
The pins C4 and C5 should hopefully now work as inputs, the pins cannot be used as outputs.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
Re: 18f4550 usb issues
thanks for the help but Unfortunately it has not helped.
- Attachments
-
- usb_input.fcfx
- (9.55 KiB) Downloaded 222 times
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
Re: 18f4550 usb issues
thanks for the help but Unfortunately it has not helped.[attachment=0].
I have written a basic program, that reads 3 inputs and switches 3 outputs.
input D4 works perfectly
C4 and C5 don't , the following happens.
if C4 is high or low the output is low.
if C5 is high or low the output is low.
if C$ and C5 is high then both outputs are high, however it remains high irrespective of the inputs.
I have written a basic program, that reads 3 inputs and switches 3 outputs.
input D4 works perfectly
C4 and C5 don't , the following happens.
if C4 is high or low the output is low.
if C5 is high or low the output is low.
if C$ and C5 is high then both outputs are high, however it remains high irrespective of the inputs.
- Attachments
-
- usb_input.fcfx
- (9.55 KiB) Downloaded 226 times
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
Re: 18f4550 usb issues
Thank you for all the help.
I came right.
it ended up being the chip not functioning the way it should have.
I replaced the 18F4550 and all is well now.
all we need to do is disable the usb voltage regulator (bit 21) in the config parameters and it works like a charm.
I came right.
it ended up being the chip not functioning the way it should have.
I replaced the 18F4550 and all is well now.
all we need to do is disable the usb voltage regulator (bit 21) in the config parameters and it works like a charm.