Page 1 of 1

Using LCD on ECIO port A

Posted: Thu Jan 31, 2013 4:33 pm
by kidney
Hi,

I was initially having problems getting LCD show proper characters when connected to 28-pin ECIO port A. Somewhere on this forum I found a working solution that was to adjust A/D conversion using, for instance,

Code: Select all

adcon0 = 0x3D; //Analog channel select bits: unimplemented
in a C block.

It does indeed make the LCD work. I'd still like to understand why.

Reading the PIC18F2455 manual, I get the idea that setting

Code: Select all

adcon1=0x0F; // Configure ports as digital I/O
trisa = 0x0; // Configure pins as outputs
should be all that's needed to make port A feed LCD. However, this solution fails.

What I don't get is why changing input A/D converter settings makes LCD, driven by digital (right?) output, work as intended. Besides, looking at a functional C code, I can't even see trisa register being set to zero anywhere. According to the manual, the reset state for trisa is 0x7F, "all inputs".

This is really bugging me. I'd really appreciate if someone could explain it to me.

Re: Using LCD on ECIO port A

Posted: Fri Feb 01, 2013 11:11 am
by Benj
Hello,

I think that even though the pin is in digital mode the analogue sampling cap is connected to one of the port A pins by default and maybe slugging the rise/fall times on the output which in turn may be corrupting the data received by the LCD. Changing the ADC channel disconnects the cap. I will see about adding this extra line in by default in v6 so that others will not have this issue.