No announcement yet.

Visi-Genie library for CCS

  • Filter
  • Time
  • Show
Clear All
new posts

  • Visi-Genie library for CCS


    After some weeks trying to program my PIC to show data in the uLCD-70D, I can't do it.

    In some places, people said that it can be that the library is not compatible with CCS. Has someone know if this library is compatible with that Compiler, or if he/she had a modified library to it?

    I download the library from that link:


  • #2
    Hi Alex,

    Has someone know if this library is compatible with that Compiler,
    This has not been tested in the CCS compiler as what you have mentioned. Have you tried the XC8 compiler instead? The library works with the XC8 compiler.

    Best Regards,


  • #3
    Hi John,

    Yes I tried this. I put here the program for you can see if there is some type of error. And the error that it returns to me when I compile the program.

    #include <pic18f4585.h>
    #include <xc.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>

    #include "fuses.h"
    #include "visi_genie.h"

    #define _XTAL_FREQ 16000000

    int gaugeAddVal = 100;
    int gaugeVal = 0;

    bool genieBegin();
    uint16_t genieWriteObject(uint16_t object, uint16_t index, uint16_t data);
    uint8_t genieWriteContrast(uint16_t value);
    extern unsigned long _millis(void);
    extern uint16_t _genieGetByteCount(void);
    extern uint8_t _genieGetByte(void);
    extern uint8_t _geniePeekByte(void);
    extern void _geniePutByte(uint8_t);

    void main(void)
    //Configura UART a 9600 baudios
    TRISCbits.RC6 = 0; // Pin RC6 como salida digital para TX.
    TXSTAbits.TX9 = 0; // Modo-8bits.
    TXSTAbits.TXEN = 1; // Habilita Transmisión.
    TXSTAbits.SYNC = 0; // Modo-Asíncrono.
    TXSTAbits.BRGH = 1; // Modo-Alta Velocidad de Baudios.
    BAUDCONbits.BRG16 = 0; // Baudios modo-8bits.
    RCSTAbits.SPEN = 1; // Hbilita el Módulo SSP como UART.
    SPBRG = (unsigned char) (((_XTAL_FREQ / 9600) / 16) - 1); //baudios = 9600


    TRISAbits.RA0 = 0; //Salida
    PORTAbits.RA0 = 0;
    PORTAbits.RA0 = 1;


    genieWriteObject(GENIE_OBJ_GAUGE, 0, gaugeVal);
    genieWriteObject(GENIE_OBJ_LED_DIGITS, 3, gaugeVal);

    gaugeVal = gaugeVal + gaugeAddVal;
    if (gaugeVal == 8000) gaugeAddVal = -100;
    if (gaugeVal == 0) gaugeAddVal = 100;

    display.c:36:: warning: (1518) direct function call made with an incomplete prototype (genieBegin)
    :0:: error: (500) undefined symbols:
    _genieWriteContrast(dist/default/production\DISPLAY_MPLAB.production.o) _genieWriteObject(dist/default/production\DISPLAY_MPLAB.production.o) _genieBegin(dist/default/production\DISPLAY_MPLAB.production.o)


    • #4
      Hi Alex,

      Thank you for your reply.

      As mentioned on your previous thread: Communication with PIC18F4585

      These are the functions that you will need to set up.
      extern unsigned long millis(void);
      extern uint16_t genieGetByteCount(void);
      extern uint8_t genieGetByte(void);
      extern uint8_t geniePeekByte(void);
      extern void geniePutByte(uint8_t);
      You should use your own routine for these functions as there are different device configurations to follow.
      As an example, the extern void geniePutByte(uint8_t) could be like this:
      void geniePutByte(uint8_t c) {
      UART_Write(c); // This function comes from the link below, please check it out.
      For setting the serial, you may find this website to be of help: Using UART of PIC Microcontroller – MPLAB XC8

      Aside from the serial communication, you also need to set up your timing routine. On the C library, millis() function was used, however, this is not available for you to use. You need to create your own timing routine according to the device you are using (e.g. setting register, interrupts, etc.) That is the case for setting the functions above (including millis). You may consider looking further in the PIC datasheet to check how can you implement this on your own.

      Here is another link which you may use:
      Using Timers in MPLAB® X with MCC

      Best Regards,