Page 1 of 1
Port C on PIC18F2420 not working
Posted: Thu Jun 17, 2010 8:14 pm
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?
Re: Port C on PIC18F2420 not working
Posted: Fri Jun 18, 2010 10:41 am
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.
Re: Port C on PIC18F2420 not working
Posted: Sun Jun 20, 2010 6:03 pm
by barryw
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
Re: Port C on PIC18F2420 not working
Posted: Mon Jun 21, 2010 9:26 am
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.