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?
Port C on PIC18F2420 not working
Moderator: Benj
- 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
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.
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.
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
Re: Port C on PIC18F2420 not working
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
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
- 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
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.
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.
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