Connect with us

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

Discussion in 'Microcontrollers, Programming and IoT' started by grom, Dec 7, 2010.

  1. grom

    grom

    23
    0
    Dec 5, 2010
    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:
     

    Attached Files:

    • errr.png
      errr.png
      File size:
      44.1 KB
      Views:
      318
  2. 1mshop

    1mshop

    1
    0
    Dec 23, 2010
    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
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-