Port C on PIC18F2420 not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
barryw
Posts: 13
Joined: Wed Jun 24, 2009 2:05 pm

Port C on PIC18F2420 not working

Post by barryw »

I have a problem in that the port C on a PIC18F2420 can't be controled! all works in simulation however once the program is compiled port C seems to be switched to all output's set to low, port A & B are OK (in and outputs on port A OK, LCD connected to port B is also OK) I have tried to set port C with
a "C" function (TRISC = 0xfc;) but still no control. any Idea's?

User avatar
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: Port C on PIC18F2420 not working

Post by Benj »

Hello Barry,

Please can you post up your program or a program that exibits this problem and I will take a look for you. From looking at the device datasheet there doesn't seem to be anything out of the ordinary with PortC on these devices.

barryw
Posts: 13
Joined: Wed Jun 24, 2009 2:05 pm

Re: Port C on PIC18F2420 not working

Post by barryw »

port c test.fcf
(40.71 KiB) Downloaded 227 times
Hi Ben,
I hope the attachment is ok as I an not used to this froum. As I said all works well in simlation but not in hardware. I had tried to use port c for the display
and noticed that leds connected to bort b (bits 2 & 3 ) were misbehaving too wilst in simulation.
Regards

Barry w

User avatar
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: Port C on PIC18F2420 not working

Post by Benj »

Hello Barry,

I have just had a look at your program and it seems to be fine. I cant find any reason that PortC should not be working correctly for you.

I would do the following C code in a blank program to see if you can make the lower nibble of PortC do anything.

trisc = 0x00;
portc = 0x01;
delay_s(2);
portc = 0x02;
delay_s(2);
portc = 0x04;
delay_s(2);
portc = 0x08;
delay_s(2);

It may also be worth using the above code for say PortB just to ensure that the program is actually running.

LEDs connected to PortB will share connections with the LCD and as such will do strange looking things when the program is running.

Post Reply