• AVR Freaks

Hot!GLCD Interfacing XC8 PIC16F877A

Author
delfindelfin
Super Member
  • Total Posts : 387
  • Reward points : 0
  • Joined: 2017/01/19 12:32:58
  • Location: Mexico
  • Status: offline
2019/05/10 14:36:21 (permalink)
0

GLCD Interfacing XC8 PIC16F877A

Hello, Could you give some ideas about how to intercae GLCDs. This my code:
 
 
post edited by delfindelfin - 2019/05/10 14:37:51

MPLAB X IDE v5.05
XC8 2.00
#1

12 Replies Related Threads

    delfindelfin
    Super Member
    • Total Posts : 387
    • Reward points : 0
    • Joined: 2017/01/19 12:32:58
    • Location: Mexico
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/10 14:38:40 (permalink)
    0
     Main:
     

     
    // Including XC8 Compiler Library
    #include <xc.h>
    // Including User's Libraties
    #include "glcd.h"
     
    // Defining Oscillator Frequency
    #define _XTAL_FREQ 8000000
     
    // Setting Configuration Bits
    #pragma config FOSC = HS // Oscillator Selection bits (XT oscillator)
    #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
    #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
    #pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled)
    #pragma config LVP = OFF // Low-Voltage In-Circuit Serial Programming Enable bit
    #pragma config CPD = OFF // Data EEPROM Memory Code Protection bit
    #pragma config WRT = OFF // Flash Program Memory Write Enable bits
    #pragma config CP = OFF // Flash Program Memory Code Protection bit
     
    #define GlcdDataBusDirnReg TRISB
    #define GlcdCtrlBusDirnReg TRISD
     
    /* 5x7 Font including 1 space to display HELLO WORLD */
    char H[]={0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00};
    char E[]={0x7F, 0x49, 0x49, 0x49, 0x41, 0x00};
    char L[]={0x7F, 0x40, 0x40, 0x40, 0x40, 0x00};
    char O[]={0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00};
     
    char W[]={0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00};
    char R[]={0x7F, 0x09, 0x19, 0x29, 0x46, 0x00};
    char D[]={0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00};
     
    void main(void)
    {
    GlcdDataBusDirnReg = 0x00; // Configure all the LCD pins as output
    GlcdCtrlBusDirnReg = 0x00; // Configure the Ctrl pins as output
     
    /* Select the Page0/Page1 and Turn on the GLCD */
    Glcd_SelectPage0();
    Glcd_CmdWrite(0x3f);
    Glcd_SelectPage1();
    Glcd_CmdWrite(0x3f);
    //delay(100);
    __delay_ms(100);
     

     
    Is it worthy to use a generic library? I would like to plot a graph, but I am not sure about coding the Bresenham's Line Algorithm or try to find a generic library that implements it
     
     
    post edited by delfindelfin - 2019/05/10 14:49:55

    MPLAB X IDE v5.05
    XC8 2.00
    #2
    delfindelfin
    Super Member
    • Total Posts : 387
    • Reward points : 0
    • Joined: 2017/01/19 12:32:58
    • Location: Mexico
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/10 14:51:30 (permalink)
    0
    I am still having problems posting my code and uploading files, but what I want to know is how to do a graph in the GLCD, do I use a generic Library, or do I code everything by myself

    MPLAB X IDE v5.05
    XC8 2.00
    #3
    katela
    Super Member
    • Total Posts : 1833
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/10 15:38:41 (permalink)
    0
    delfindelfin
    do I use a generic Library, or do I code everything by myself



    This is a call you have to make yourself.
    Read your GLCD datasheet/user guide and see if you are able to understand how it works and how to control it yourself.
    If you already have a library for it and it works fine, is it necessary to rewrite it? Or do you understand that library? Does it support your GLCD controller?
    post edited by katela - 2019/05/10 15:40:23

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #4
    delfindelfin
    Super Member
    • Total Posts : 387
    • Reward points : 0
    • Joined: 2017/01/19 12:32:58
    • Location: Mexico
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/10 20:52:42 (permalink)
    0
    Well, I think the first problem that I have is uploading the code. I upload the code and the GLCD doesn't display anything

    MPLAB X IDE v5.05
    XC8 2.00
    #5
    delfindelfin
    Super Member
    • Total Posts : 387
    • Reward points : 0
    • Joined: 2017/01/19 12:32:58
    • Location: Mexico
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/31 03:11:52 (permalink)
    0
    Oh, I have already checked and the GLCD is working. Probably I connected something wrong ... Anyway, I am using a generic GLCD library fron this page: http://en.radzio.dxp.pl/ks0108/ ... But I have problems compiling ... I have an error in this line of code:
     

     
     
     
    __CONFIG(WDTDIS & HS & UNPROTECT);
     
     
     

     
    What does it mean that line?
     
    The error is the next:
     

     
     
     
    KS0108-PIC16.c:8:33: error: too few arguments provided to function-like macro invocation
    __CONFIG(WDTDIS & HS & UNPROTECT);
    ^
    /opt/microchip/xc8/v2.05/pic/include/pic18.h:62:9: note: macro '__CONFIG' defined here
    #define __CONFIG(a,x) _NO_CONFIG_SUP(CONFIG)
     
     
     
     
     
     
     

    post edited by delfindelfin - 2019/05/31 03:15:04

    MPLAB X IDE v5.05
    XC8 2.00
    #6
    delfindelfin
    Super Member
    • Total Posts : 387
    • Reward points : 0
    • Joined: 2017/01/19 12:32:58
    • Location: Mexico
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/31 03:21:37 (permalink)
    0
    Oh, I fixed the error, I wasn't using the correct device, but, still, What does it mean that line of code? I have another errors, tough
     

     
    KS0108.c:14:: error: (1098) conflicting declarations for variable "_GLCD_Initialize" (glcd_generic_library.c:46)
     

     
    And what is <htc.h>? I have never used it before
    post edited by delfindelfin - 2019/05/31 03:29:17

    MPLAB X IDE v5.05
    XC8 2.00
    #7
    delfindelfin
    Super Member
    • Total Posts : 387
    • Reward points : 0
    • Joined: 2017/01/19 12:32:58
    • Location: Mexico
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2019/05/31 03:54:09 (permalink)
    0
    I think I am going to end up doing my own library

    MPLAB X IDE v5.05
    XC8 2.00
    #8
    yrdevram
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2020/03/15 21:52:40
    • Location: 0
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2020/07/04 21:33:51 (permalink)
    0
    delfindelfin
    Oh, I have already checked and the GLCD is working. Probably I connected something wrong ... Anyway, I am using a generic GLCD library fron this page: http://en.radzio.dxp.pl/ks0108/ ... But I have problems compiling ... I have an error in this line of code:
     

     
     
     
     
     
     
     
    __CONFIG(WDTDIS & HS & UNPROTECT);
     
     
     
     
     
     
     

     
    What does it mean that line?
     
    The error is the next:
     

     
     
     
     
     
     
     
    KS0108-PIC16.c:8:33: error: too few arguments provided to function-like macro invocation
    __CONFIG(WDTDIS & HS & UNPROTECT);
    ^
    /opt/microchip/xc8/v2.05/pic/include/pic18.h:62:9: note: macro '__CONFIG' defined here
    #define __CONFIG(a,x) _NO_CONFIG_SUP(CONFIG)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     





    Hey delfindelfin,
          I am facing same error in my code, can you share how can fix it.
     
    thanks
    #9
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: GLCD Interfacing XC8 PIC16F877A 2020/07/04 21:45:41 (permalink)
    0
    yrdevram
          I am facing same error in my code, can you share how can fix it.

    That probably means you are not using a PIC16F877A.
    What PIC are you actually using?
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    yrdevram
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2020/03/15 21:52:40
    • Location: 0
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2020/07/04 21:49:27 (permalink)
    0
    ric
    yrdevram
          I am facing same error in my code, can you share how can fix it.

    That probably means you are not using a PIC16F877A.
    What PIC are you actually using?
     
     


     
    using PIC18F46k22 in MPLAB X
    #11
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: GLCD Interfacing XC8 PIC16F877A 2020/07/04 21:52:48 (permalink)
    0
    So you're asking about a different PIC, which you did not reveal, and I now see from the other topic you created at https://www.microchip.com/forums/m1146546.aspx
    you are not even asking about an error with a CONFIG line.
    It was not a good idea to hijack THIS thread, just because it got a similar error message, particularly without revealing your code that triggered it.
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    yrdevram
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2020/03/15 21:52:40
    • Location: 0
    • Status: offline
    Re: GLCD Interfacing XC8 PIC16F877A 2020/07/04 22:20:06 (permalink)
    +1 (1)
    ric
    So you're asking about a different PIC, which you did not reveal, and I now see from the other topic you created at https://www.microchip.com/forums/m1146546.aspx
    you are not even asking about an error with a CONFIG line.
    It was not a good idea to hijack THIS thread, just because it got a similar error message, particularly without revealing your code that triggered it.
     
     


    hey,
    sorry for this.
     
    #13
    Jump to:
    © 2020 APG vNext Commercial Version 4.5