Maker Pro
Maker Pro

PIC16F877A : How to config PORTA as analog i/p and PORTE as digital o/p

grom

Dec 5, 2010
23
Joined
Dec 5, 2010
Messages
23
I have this PIC16F877A development board with a 16x2 alphanumeric LCD display where the tracks connect the data pins of the LCD to PORT D and the control pins: RS, R/W, and E to PORT E.

I use C language to program(MikroC)

my purpose is to take an analog i/p from RA0 and give the o/p to the LCD (through ports B and E ).

for initialising ports, i do this:
void init_ports()
{
ADCON0.ADCS1=1;
ADCON0.ADCS0=1;
ADCON0.CHS2=0;
ADCON0.CHS1=0;
ADCON0.CHS0=0;
ADCON0.f2=0; //for ADGO
ADCON0.ADON=0;
ADCON1.ADFM=0;
ADCON1.PCFG3=0;
ADCON1.PCFG2=0;
ADCON1.PCFG1=1;
ADCON1.PCFG0=0;
}

and for configuring the output to the LCD, i have to use the Lcd_custom_config(&dataport,....,&controlport,...)

so i use this:
main()
{
init_ports();
TRISE=0;
TRISB=0 ;
LCD_Custom_Config(&PORTB,3,2,1,0,&PORTE,2,1,0);
.
.
.
}

but when i implement it, it doesn work at all... and when i try it in Proteus ISIS, it doesn work and i get a thousand warnings shown in the attached picture.

i've tried a lot but then in the end i jus gave up and used:
LCD_init(&PORTB)
and used three jumper wires to connect the control pins now configured to be in port B to the three pins in port E

can some one please help me?
sad[:'(]:confused:
 

Attachments

  • errr.png
    errr.png
    44.1 KB · Views: 318

1mshop

Dec 23, 2010
1
Joined
Dec 23, 2010
Messages
1
Hi Grom,

You mentioned that your LCD data pins are connected to Port D while you are sending the LCD data to Port B, this will not work for sure.

Try change your code so the LCD data is send to Port D.

Hope this helps.

Thanks.

Regards,
1Mshop Team
www.1mshop.com
 
Top