• AVR Freaks

Hot!PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd

Author
btommo
Starting Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2017/07/07 02:59:33
  • Location: 0
  • Status: online
2019/04/22 10:13:50 (permalink)
0

PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd

Hi,
 
I'm having an issue with the Plib xlcd library for PIC18 devices. below is my code;
 
/* PIC18F45K22 LED Volt Meter V1.00 
 *
 * In this project LCD display is connected to PORTb in 4-bit mode, Input PORT RA0(AN0)is used as
 * analogue input for input voltage to be measured.
 *
 * Voltage to be measured is applied to RA0. Microcontroller read analogue
 * voltage and converts it to digital then displays on LCD to indicate voltage.
 *
 * Analogue input range is 0V to 5V.
 *
 * File: main.c
 * Author: Btommo
 * PIC: PIC18F45K22
 * OSC: 8MHz internal oscillator
 * Created on 22 April 2019
 *
 * RB0 - D4
 * RB1 - D5
 * RB2 - D6
 * RB3 - D7
 * RB4 - E
 * RB5 - R/S
 * RB6 - RW
 *
 * RA0 - Analogue input AN0
*/
#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
#include <stdint.h>
#include "mcc_generated_files/mcc.h"
#include "xlcd2.h"
#include "delays2.h"

//__EEPROM_DATA(0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
/******************************************************************************/
/*CONFIGURATION */
/******************************************************************************/
// PIC18F45K22 Configuration Bit Settings

// 'C' source line config statements



// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#define _XTAL_FREQ 8000000 //oscillator frequency for delay_ms()







/******************************************************************************/
/* User Global Variable Declaration */
/******************************************************************************/

uint8_t dly_cnt1; //seconds delay counters
uint8_t dly_cnt2;
unsigned long Vin,mV;
char op[10];





/******************************************************************************/
/* Main Program */
/******************************************************************************/

void initialise()
{
   SYSTEM_Initialize();//initialize system;pins,osc,peripherals i.e adc,TMR0 etc
   
}



void DLYS(unsigned char s)
{
    dly_cnt2 = 0;
    while(dly_cnt2 < s/1) //seconds
    {
        dly_cnt1 = 0;
        while(dly_cnt1 < 1000/8)
        {
            TMR0 = 0;
            while(TMR0 < 8000/32)
            ;
            ++dly_cnt1;
        }
        ++dly_cnt2;
    }
    
}

void DelayFor18TCY(void) //created 18 cycle delay for xlcd library
{
    Nop(); Nop(); Nop(); Nop();
    Nop(); Nop(); Nop(); Nop();
    Nop(); Nop(); Nop(); Nop();
    Nop(); Nop();
    return;
}



void DelayPORXLCD(void) //created 15ms delay for xlcd library
{
    __delay_ms(15);
    return;
}

void DelayXLCD(void) //created 5ms delay for xlcd library
{
    __delay_ms(5);
}

void LCD_Clear() //clear screen
{
    while(BusyXLCD());
    WriteCmdXLCD(0x01);
}

void LCD_Move(unsigned char row, unsigned char column)
{
    char ddaddr = (40*(row-1))+ column;
    while(BusyXLCD());
    SetDDRamAddr(ddaddr);
}

void main()
{
    initialise();
    DLYS(1);
    OpenXLCD(FOUR_BIT & LINES_5X7); //configure LCD in 4-bit mode in multi disp
    while(BusyXLCD()); //wait if LCD is busy
    WriteCmdXLCD(0x06); //move cursor right
    putrsXLCD("VOLTMETER"); //display VOLTMETER on LCD
    DLYS(2); //delay 2 seconds
    LCD_Clear(); //clear LCD
      
   //MAIN LOOP
      
   while(1)
    {
       LCD_Clear(); //Clear LCD
       Vin = ADC_GetConversion(0); //read ADC CH0 and store results
       mV = (Vin*5000)>>10; //mV = (Vin*5000)/1024 (10-bit)
       LCD_Move(1,1); //move to row 1 column 1
       putrsXLCD("mV ="); //display mV = on LCD
       mV = (Vin*5000)>>10; //mV = (Vin*5000)/1024 (10-bit)
       itoa(op,mV,10); //convert mV into ASCII string
       
       
       //display result on LCB
       LCD_Move(1,6);
       putsXLCD(op);
       DLYS(1);
    }
    return;
}


    

 
Below is the error I am getting;
 

CLEAN SUCCESSFUL (total time: 24ms)
make -f nbproject/Makefile-PIC18F45K22.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
make -f nbproject/Makefile-PIC18F45K22.mk dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.01.X.production.hex
make[2]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/memory.p1 mcc_generated_files/memory.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/adc.p1 mcc_generated_files/adc.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/ccp5.p1 mcc_generated_files/ccp5.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/main.p1 main.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/busyxlcd2.p1 busyxlcd2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/putrxlcd2.p1 putrxlcd2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/openxlcd2.p1 openxlcd2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/putsxlcd2.p1 putsxlcd2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/readaddr2.p1 readaddr2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/readdata2.p1 readdata2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/setcgram2.p1 setcgram2.c
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/setdgram2.p1 setdgram2.c
delays2.h:33:31: warning: (171) wrong number of preprocessor macro arguments for "Delay1KTCYx" (1 instead of 0)
delays2.h:33:13: error: (194) ")" expected
delays2.h:33:19: error: (984) type redeclared
delays2.h:33:19: error: (1098) conflicting declarations for variable "_delay" (delays2.h:33)
(908) exit status = 1
make[2]: *** [build/PIC18F45K22/production/main.p1] Error 1
make[2]: *** Waiting for unfinished jobs....
nbproject/Makefile-PIC18F45K22.mk:273: recipe for target 'build/PIC18F45K22/production/main.p1' failed
delays2.h:33:31: warning: (171) wrong number of preprocessor macro arguments for "Delay1KTCYx" (1 instead of 0)
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/wcmdxlcd2.p1 wcmdxlcd2.c
readaddr2.c:38:23: warning: (373) implicit signed to unsigned conversion
readaddr2.c:47:19: warning: (373) implicit signed to unsigned conversion
readaddr2.c:52:19: warning: (373) implicit signed to unsigned conversion
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/writdata2.p1 writdata2.c
delays2.h:33:13: error: (194) ")" expected
delays2.h:33:19: error: (984) type redeclared
delays2.h:33:19: error: (1098) conflicting declarations for variable "_delay" (delays2.h:33)
setcgram2.c:35:44: warning: (373) implicit signed to unsigned conversion
setcgram2.c:48:23: warning: (373) implicit signed to unsigned conversion
(908) exit status = 1
make[2]: *** [build/PIC18F45K22/production/openxlcd2.p1] Error 1
nbproject/Makefile-PIC18F45K22.mk:287: recipe for target 'build/PIC18F45K22/production/openxlcd2.p1' failed
readdata2.c:39:23: warning: (373) implicit signed to unsigned conversion
readdata2.c:48:19: warning: (373) implicit signed to unsigned conversion
setdgram2.c:34:45: warning: (373) implicit signed to unsigned conversion
setdgram2.c:47:23: warning: (373) implicit signed to unsigned conversion
wcmdxlcd2.c:34:23: warning: (373) implicit signed to unsigned conversion
wcmdxlcd2.c:47:18: warning: (373) implicit signed to unsigned conversion
writdata2.c:37:26: warning: (373) implicit signed to unsigned conversion
writdata2.c:50:21: warning: (373) implicit signed to unsigned conversion
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
nbproject/Makefile-PIC18F45K22.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 2s)

 
I've been playing with this code all day and got to this point, the delays2.h file is a clone of delays.h I put into the project folder, same with xlcd.h, I did add#define Delay1KTCYx() _delay(10000) into delays2.h file, the source code for this is below;
 
#ifndef __DELAYS_H
#define __DELAYS_H

/* C18 cycle-count delay routines. */

/* Delay of exactly 1 Tcy */
#define Delay1TCY() _delay(1)

/* Delay of exactly 10 Tcy */
#define Delay10TCY() _delay(10)

#define Delay1KTCYx() _delay(10000)

/* Delay1TCYx */
void Delay1TCYx(unsigned char);

/* Delay10TCYx
 * Delay multiples of 10 Tcy
 * Passing 0 (zero) results in a delay of 2560 cycles.
 */
void Delay10TCYx(unsigned char);

/* Delay100TCYx
 * Delay multiples of 100 Tcy
 * Passing 0 (zero) results in a delay of 25,600 cycles.
 */
void Delay100TCYx(unsigned char);

/* Delay1KTCYx
 * Delay multiples of 1000 Tcy
 * Passing 0 (zero) results in a delay of 256,000 cycles.
 */
void Delay1KTCYx(unsigned char);

/* Delay10KTCYx
 * Delay multiples of 10,000 Tcy
 * Passing 0 (zero) results in a delay of 2,560,000 cycles.
 */
void Delay10KTCYx(unsigned char);

#endif

 
Any help would be appreciated.
#1

19 Replies Related Threads

    katela
    Super Member
    • Total Posts : 1225
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 10:32:11 (permalink)
    +1 (1)
    Which version of the XC8 compiler are you using? Are you also using MCC?
    What the purpose of these :
    #include "xlcd2.h"
    #include "delays2.h"
    If you want to use XLCD library, make sure to use an older version of XC8 compiler, earlier than v2x and install separately the plib and link them.

    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
    #2
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 10:37:48 (permalink)
    0
    Hi Katela, 
     
    I'm using  2.05 but have put the header and source files in the appropriated place but also but copies of them in the projects folder so xlcd2.h is a copy of xlcd.h from the PLIB folder of an older version of the compiler as it seemed transferable, I'm also using C90 legacy mode, there's been many errors today with the XLCD source files not seeing the header file so made copies and put them in the projects folder.
     
    I did use MCC to generate config as well as setup the ports, I/Os and analogue input.
    post edited by btommo - 2019/04/22 10:40:19
    #3
    jack@kksound
    code tags!
    • Total Posts : 3183
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 10:44:29 (permalink)
    +1 (1)
    My suggestion: Always start with the first indicated error (it's a warning in this case but fix it first :
    delays2.h:33:31: warning: (171) wrong number of preprocessor macro arguments for "Delay1KTCYx" (1 instead of 0) )
    and recompile. Fix a single error starting with the first, then recompile, it is the only practical way to work through the issues as an error can result in many following errors that will go away when the initial error is corrected.
    #4
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 10:50:37 (permalink)
    0
    Please see new result below;
     

    CLEAN SUCCESSFUL (total time: 40ms)
    make -f nbproject/Makefile-PIC18F45K22.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
    make -f nbproject/Makefile-PIC18F45K22.mk dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.01.X.production.hex
    make[2]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/memory.p1 mcc_generated_files/memory.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/adc.p1 mcc_generated_files/adc.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/mcc_generated_files/ccp5.p1 mcc_generated_files/ccp5.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/main.p1 main.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/busyxlcd2.p1 busyxlcd2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/openxlcd2.p1 openxlcd2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/putrxlcd2.p1 putrxlcd2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/putsxlcd2.p1 putsxlcd2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/readaddr2.p1 readaddr2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/readdata2.p1 readdata2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/setcgram2.p1 setcgram2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/setdgram2.p1 setdgram2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/writdata2.p1 writdata2.c
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_PIC18F45K22=PIC18F45K22 -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/PIC18F45K22/production/wcmdxlcd2.p1 wcmdxlcd2.c
    main.c:128:35: warning: (373) implicit signed to unsigned conversion
    setdgram2.c:34:45: warning: (373) implicit signed to unsigned conversion
    setdgram2.c:47:23: warning: (373) implicit signed to unsigned conversion
    readaddr2.c:38:23: warning: (373) implicit signed to unsigned conversion
    readaddr2.c:47:19: warning: (373) implicit signed to unsigned conversion
    readaddr2.c:52:19: warning: (373) implicit signed to unsigned conversion
    readdata2.c:39:23: warning: (373) implicit signed to unsigned conversion
    readdata2.c:48:19: warning: (373) implicit signed to unsigned conversion
    setcgram2.c:35:44: warning: (373) implicit signed to unsigned conversion
    setcgram2.c:48:23: warning: (373) implicit signed to unsigned conversion
    writdata2.c:37:26: warning: (373) implicit signed to unsigned conversion
    writdata2.c:50:21: warning: (373) implicit signed to unsigned conversion
    wcmdxlcd2.c:34:23: warning: (373) implicit signed to unsigned conversion
    wcmdxlcd2.c:47:18: warning: (373) implicit signed to unsigned conversion
    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K22 -Wl,-Map=dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.01.X.production.map -DXPRJ_PIC18F45K22=PIC18F45K22 -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -mc90lib -std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/PIC18F45K22/production/memoryfile.xml -o dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.01.X.production.elf build/PIC18F45K22/production/mcc_generated_files/memory.p1 build/PIC18F45K22/production/mcc_generated_files/adc.p1 build/PIC18F45K22/production/mcc_generated_files/device_config.p1 build/PIC18F45K22/production/mcc_generated_files/mcc.p1 build/PIC18F45K22/production/mcc_generated_files/pin_manager.p1 build/PIC18F45K22/production/mcc_generated_files/ccp5.p1 build/PIC18F45K22/production/mcc_generated_files/tmr0.p1 build/PIC18F45K22/production/main.p1 build/PIC18F45K22/production/busyxlcd2.p1 build/PIC18F45K22/production/openxlcd2.p1 build/PIC18F45K22/production/putrxlcd2.p1 build/PIC18F45K22/production/putsxlcd2.p1 build/PIC18F45K22/production/readaddr2.p1 build/PIC18F45K22/production/readdata2.p1 build/PIC18F45K22/production/setcgram2.p1 build/PIC18F45K22/production/setdgram2.p1 build/PIC18F45K22/production/wcmdxlcd2.p1 build/PIC18F45K22/production/writdata2.p1
    Non line specific message::: advisory: (1492) using updated 32-bit floating-point libraries; improved accuracy might increase code size
    mcc_generated_files/memory.c:59:: warning: (520) function "_FLASH_ReadByte" is never called
    mcc_generated_files/memory.c:70:: warning: (520) function "_FLASH_ReadWord" is never called
    mcc_generated_files/memory.c:75:: warning: (520) function "_FLASH_WriteByte" is never called
    mcc_generated_files/memory.c:94:: warning: (520) function "_FLASH_WriteBlock" is never called
    mcc_generated_files/memory.c:153:: warning: (520) function "_FLASH_EraseBlock" is never called
    mcc_generated_files/memory.c:176:: warning: (520) function "_DATAEE_WriteByte" is never called
    mcc_generated_files/memory.c:198:: warning: (520) function "_DATAEE_ReadByte" is never called
    mcc_generated_files/memory.c:209:: warning: (520) function "_MEMORY_Tasks" is never called
    mcc_generated_files/adc.c:81:: warning: (520) function "_ADC_SelectChannel" is never called
    mcc_generated_files/adc.c:89:: warning: (520) function "_ADC_StartConversion" is never called
    mcc_generated_files/adc.c:96:: warning: (520) function "_ADC_IsConversionDone" is never called
    mcc_generated_files/adc.c:102:: warning: (520) function "_ADC_GetConversionResult" is never called
    mcc_generated_files/adc.c:128:: warning: (520) function "_ADC_TemperatureAcquisitionDelay" is never called
    mcc_generated_files/pin_manager.c:100:: warning: (520) function "_PIN_MANAGER_IOC" is never called
    mcc_generated_files/tmr0.c:87:: warning: (520) function "_TMR0_StartTimer" is never called
    mcc_generated_files/tmr0.c:93:: warning: (520) function "_TMR0_StopTimer" is never called
    mcc_generated_files/tmr0.c:99:: warning: (520) function "_TMR0_ReadTimer" is never called
    mcc_generated_files/tmr0.c:109:: warning: (520) function "_TMR0_WriteTimer" is never called
    mcc_generated_files/tmr0.c:115:: warning: (520) function "_TMR0_Reload" is never called
    mcc_generated_files/tmr0.c:122:: warning: (520) function "_TMR0_HasOverflowOccured" is never called
    main.c:115:: warning: (520) function "_DelayXLCD" is never called
    readaddr2.c:16:: warning: (520) function "_ReadAddrXLCD" is never called
    readdata2.c:16:: warning: (520) function "_ReadDataXLCD" is never called
    setcgram2.c:14:: warning: (520) function "_SetCGRamAddr" is never called
    mcc_generated_files/memory.c:84:: warning: (1498) pointer (FLASH_WriteByte@flashRdBufPtr) in expression may have no targets
    mcc_generated_files/memory.c:88:: warning: (1498) pointer (FLASH_WriteByte@flashRdBufPtr) in expression may have no targets
    :0:: error: (499) undefined symbol:
     _Delay10KTCYx(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.01.X.production.o)
    (908) exit status = 1
    nbproject/Makefile-PIC18F45K22.mk:373: recipe for target 'dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.01.X.production.hex' failed
    make[2]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
    nbproject/Makefile-PIC18F45K22.mk:90: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.01.X'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
    make[2]: *** [dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.01.X.production.hex] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2

    BUILD FAILED (exit value 2, total time: 4s)

     
    Below is updated delay2.h;
     
    #ifndef __DELAYS_H
    #define __DELAYS_H

    /* C18 cycle-count delay routines. */

    /* Delay of exactly 1 Tcy */
    #define Delay1TCY() _delay(1)

    /* Delay of exactly 10 Tcy */
    #define Delay10TCY() _delay(10)

    #define Delay10KTCY() _delay(10000)

    /* Delay1TCYx */
    void Delay1TCYx(unsigned char);

    /* Delay10TCYx
     * Delay multiples of 10 Tcy
     * Passing 0 (zero) results in a delay of 2560 cycles.
     */
    void Delay10TCYx(unsigned char);

    /* Delay100TCYx
     * Delay multiples of 100 Tcy
     * Passing 0 (zero) results in a delay of 25,600 cycles.
     */
    void Delay100TCYx(unsigned char);

    /* Delay1KTCYx
     * Delay multiples of 1000 Tcy
     * Passing 0 (zero) results in a delay of 256,000 cycles.
     */
    void Delay1KTCYx(unsigned char);

    /* Delay10KTCYx
     * Delay multiples of 10,000 Tcy
     * Passing 0 (zero) results in a delay of 2,560,000 cycles.
     */
    void Delay10KTCYx(unsigned char);

    #endif

    #5
    jack@kksound
    code tags!
    • Total Posts : 3183
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 11:54:11 (permalink)
    +1 (1)
    The reporting of an "undefined symbol" in this manner:

    :0:: error: (499) undefined symbol:
     _Delay10KTCYx(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.01.X.production.o)

    with no prior warning stating "function declared implicit int" usually indicates the prototype for a function is found (here in the delays2.h file) but the code for the function is not found (here should be in the delays2.c file). Either you did not change the name from delays.c to delays2.c OR you did not copy it to the correct directory OR your did not include it in the sources folder of the project.
    #6
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 11:57:58 (permalink)
    0
    Apologies for the double post but thought I would update. I reinstalled xc8 2.05 and also installed the peripheral libraries for PIC18 to the compilers folder and redone some of the code, please see below code and result from build;
     
    /* PIC18F45K22 LED Volt Meter V1.00 
     *
     * In this project LCD display is connected to PORTb in 4-bit mode, Input PORT RA0(AN0)is used as
     * analogue input for input voltage to be measured.
     *
     * Voltage to be measured is applied to RA0. Microcontroller read analogue
     * voltage and converts it to digital then displays on LCD to indicate voltage.
     *
     * Analogue input range is 0V to 5V.
     *
     * File: main.c
     * Author: Btommo
     * PIC: PIC18F45K22
     * OSC: 8MHz internal oscillator
     * Created on 22 April 2019
     *
     * RB0 - D4
     * RB1 - D5
     * RB2 - D6
     * RB3 - D7
     * RB4 - E
     * RB5 - R/S
     * RB6 - RW
     *
     * RA0 - Analogue input AN0
    */
    #include <stdio.h>
    #include <stdlib.h>
    #include <plib/delays.h>
    #include <xc.h>
    #include <stdint.h>
    #include <plib/xlcd.h>
    #include "mcc_generated_files/mcc.h"



    //__EEPROM_DATA(0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
    /******************************************************************************/
    /*CONFIGURATION */
    /******************************************************************************/
    // PIC18F45K22 Configuration Bit Settings

    // 'C' source line config statements



    // #pragma config statements should precede project file includes.
    // Use project enums instead of #define for ON and OFF.
    #define _XTAL_FREQ 8000000 //oscillator frequency for delay_ms()







    /******************************************************************************/
    /* User Global Variable Declaration */
    /******************************************************************************/

    uint8_t dly_cnt1; //seconds delay counters
    uint8_t dly_cnt2;
    unsigned long Vin,mV;
    char op[10];





    /******************************************************************************/
    /* Main Program */
    /******************************************************************************/

    void initialise()
    {
       SYSTEM_Initialize();//initialize system;pins,osc,peripherals i.e adc,TMR0 etc
       
    }



    void DLYS(unsigned char s)
    {
        dly_cnt2 = 0;
        while(dly_cnt2 < s/1) //seconds
        {
            dly_cnt1 = 0;
            while(dly_cnt1 < 1000/8)
            {
                TMR0 = 0;
                while(TMR0 < 8000/32)
                ;
                ++dly_cnt1;
            }
            ++dly_cnt2;
        }
        
    }

    void DelayFor18TCY(void) //created 18 cycle delay for xlcd library
    {
        Nop(); Nop(); Nop(); Nop();
        Nop(); Nop(); Nop(); Nop();
        Nop(); Nop(); Nop(); Nop();
        Nop(); Nop();
        return;
    }


    void DelayPORXLCD(void) //created 15ms delay for xlcd library
    {
        __delay_ms(15);
        return;
    }

    void DelayXLCD(void) //created 5ms delay for xlcd library
    {
        __delay_ms(5);
    }

    void LCD_Clear() //clear screen
    {
        while(BusyXLCD());
        WriteCmdXLCD(0x01);
    }

    void LCD_Move(unsigned char row, unsigned char column)
    {
        char ddaddr = (40*(row-1))+ column;
        while(BusyXLCD());
        SetDDRamAddr(ddaddr);
    }

    void main()
    {
        initialise();
        DLYS(1);
        OpenXLCD(FOUR_BIT & LINES_5X7); //configure LCD in 4-bit mode in multi disp
        while(BusyXLCD()); //wait if LCD is busy
        WriteCmdXLCD(0x06); //move cursor right
        putrsXLCD("VOLTMETER"); //display VOLTMETER on LCD
        DLYS(2); //delay 2 seconds
        LCD_Clear(); //clear LCD
          
       //MAIN LOOP
          
       while(1)
        {
           LCD_Clear(); //Clear LCD
           Vin = ADC_GetConversion(0); //read ADC CH0 and store results
           mV = (Vin*5000)>>10; //mV = (Vin*5000)/1024 (10-bit)
           LCD_Move(1,1); //move to row 1 column 1
           putrsXLCD("mV ="); //display mV = on LCD
           mV = (Vin*5000)>>10; //mV = (Vin*5000)/1024 (10-bit)
           itoa(op,mV,10); //convert mV into ASCII string
           
           
           //display result on LCB
           LCD_Move(1,6);
           putsXLCD(op);
           DLYS(1);
        }
        return;
    }


        


    CLEAN SUCCESSFUL (total time: 19ms)
    make -f nbproject/Makefile-PIC18F45K22.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    make -f nbproject/Makefile-PIC18F45K22.mk dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.00.X.production.hex
    make[2]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/memory.p1 mcc_generated_files/memory.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/adc.p1 mcc_generated_files/adc.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/ccp5.p1 mcc_generated_files/ccp5.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/main.p1 main.c
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --chip=18F45K22 -G -mdist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.00.X.production.map -DXPRJ_PIC18F45K22=PIC18F45K22 --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" --memorysummary dist/PIC18F45K22/production/memoryfile.xml -odist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.00.X.production.elf build/PIC18F45K22/production/mcc_generated_files/memory.p1 build/PIC18F45K22/production/mcc_generated_files/adc.p1 build/PIC18F45K22/production/mcc_generated_files/device_config.p1 build/PIC18F45K22/production/mcc_generated_files/mcc.p1 build/PIC18F45K22/production/mcc_generated_files/pin_manager.p1 build/PIC18F45K22/production/mcc_generated_files/ccp5.p1 build/PIC18F45K22/production/mcc_generated_files/tmr0.p1 build/PIC18F45K22/production/main.p1
    Microchip MPLAB XC8 C Compiler (Free Mode) V1.34
    Build date: Feb 16 2015
    Part Support Version: 1.34
    Copyright (C) 2015 Microchip Technology Inc.
    License type: Node Configuration

    :: warning: (1273) Omniscient Code Generation not available in Free mode
    mcc_generated_files/memory.c:59: warning: (520) function "_FLASH_ReadByte" is never called
    mcc_generated_files/memory.c:70: warning: (520) function "_FLASH_ReadWord" is never called
    mcc_generated_files/memory.c:75: warning: (520) function "_FLASH_WriteByte" is never called
    mcc_generated_files/memory.c:94: warning: (520) function "_FLASH_WriteBlock" is never called
    mcc_generated_files/memory.c:153: warning: (520) function "_FLASH_EraseBlock" is never called
    mcc_generated_files/memory.c:176: warning: (520) function "_DATAEE_WriteByte" is never called
    mcc_generated_files/memory.c:198: warning: (520) function "_DATAEE_ReadByte" is never called
    mcc_generated_files/memory.c:209: warning: (520) function "_MEMORY_Tasks" is never called
    mcc_generated_files/adc.c:81: warning: (520) function "_ADC_SelectChannel" is never called
    mcc_generated_files/adc.c:89: warning: (520) function "_ADC_StartConversion" is never called
    mcc_generated_files/adc.c:96: warning: (520) function "_ADC_IsConversionDone" is never called
    mcc_generated_files/adc.c:102: warning: (520) function "_ADC_GetConversionResult" is never called
    mcc_generated_files/adc.c:128: warning: (520) function "_ADC_TemperatureAcquisitionDelay" is never called
    mcc_generated_files/pin_manager.c:100: warning: (520) function "_PIN_MANAGER_IOC" is never called
    mcc_generated_files/tmr0.c:87: warning: (520) function "_TMR0_StartTimer" is never called
    mcc_generated_files/tmr0.c:93: warning: (520) function "_TMR0_StopTimer" is never called
    mcc_generated_files/tmr0.c:99: warning: (520) function "_TMR0_ReadTimer" is never called
    mcc_generated_files/tmr0.c:109: warning: (520) function "_TMR0_WriteTimer" is never called
    mcc_generated_files/tmr0.c:115: warning: (520) function "_TMR0_Reload" is never called
    mcc_generated_files/tmr0.c:122: warning: (520) function "_TMR0_HasOverflowOccured" is never called
    main.c:100: warning: (520) function "_DelayFor18TCY" is never called
    main.c:109: warning: (520) function "_DelayFor10KTCY" is never called
    main.c:116: warning: (520) function "_DelayPORXLCD" is never called
    main.c:122: warning: (520) function "_DelayXLCD" is never called
    mcc_generated_files/memory.c:61: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:62: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:63: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:77: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:78: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:96: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:104: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:108: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:119: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:120: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:121: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:157: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:158: warning: (752) conversion to shorter data type
    mcc_generated_files/memory.c:159: warning: (752) conversion to shorter data type
    main.c:135: warning: (752) conversion to shorter data type
    main.c:144: warning: (752) conversion to shorter data type
    main.c:161: warning: (752) conversion to shorter data type
    :0: error: (500) undefined symbols:
     _SetDDRamAddr(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _WriteCmdXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _putrsXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _OpenXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _BusyXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _putsXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj)
    (908) exit status = 1
    nbproject/Makefile-PIC18F45K22.mk:243: recipe for target 'dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.00.X.production.hex' failed
    make[2]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    nbproject/Makefile-PIC18F45K22.mk:90: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    make[2]: *** [dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.00.X.production.hex] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

    BUILD FAILED (exit value 2, total time: 3s)

     
    There is the error;
     
    :0: error: (500) undefined symbols:
     _SetDDRamAddr(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _WriteCmdXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _putrsXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _OpenXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _BusyXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj) _putsXLCD(dist/PIC18F45K22/production\Pic18F45K22_LCD_VOLT_METERV1.00.X.production.obj)
    (908) exit status = 1

     
    When I click on the functions listed in the main source file they seem to know where the functions are but states they are undefined in the result.
     
    I added the XLCD source files to the project and tried compiling each individually, below is the result, same for each source file;
     

    CLEAN SUCCESSFUL (total time: 103ms)
    make: *** No rule to make target 'build/PIC18F45K22/production/_ext/347128057/setcgram.p1'. Stop.

    BUILD FAILED (exit value 2, total time: 205ms)

    post edited by btommo - 2019/04/22 12:16:57
    #7
    jack@kksound
    code tags!
    • Total Posts : 3183
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 13:27:14 (permalink)
    +1 (1)
    Did you also add the corresponding xxxxx.h header files? Not just copy them but add them to the project under Header Files?
    #8
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 13:53:16 (permalink)
    0
    new result from adding delays.h and xlcd.h header file to project;
     

    CLEAN SUCCESSFUL (total time: 12ms)
    make -f nbproject/Makefile-PIC18F45K22.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    make -f nbproject/Makefile-PIC18F45K22.mk dist/PIC18F45K22/production/Pic18F45K22_LCD_VOLT_METERV1.00.X.production.hex
    make[2]: Entering directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/memory.p1 mcc_generated_files/memory.c 
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/adc.p1 mcc_generated_files/adc.c 
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c 
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c 
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c 
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/ccp5.p1 mcc_generated_files/ccp5.c 
    make[2]: *** No rule to make target '../../../../../Program Files \(x86\)/Microchip/xc8/v2.05/sources/pic18/plib/XLCD/busyxlcd.c', needed by 'build/PIC18F45K22/production/_ext/347128057/busyxlcd.p1'. Stop.
    make[2]: *** Waiting for unfinished jobs....
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c 
    "C:\Program Files (x86)\Microchip\xc8\v1.34\bin\xc8.exe" --pass1 --chip=18F45K22 -Q -G --double=32 --float=32 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_PIC18F45K22=PIC18F45K22 --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -mwarn=-2 -obuild/PIC18F45K22/production/main.p1 main.c 
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    make[2]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    nbproject/Makefile-PIC18F45K22.mk:90: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/Users/Btommo/Documents/MPLAB programs/Pic18F45K22_LCD_VOLT_METERV1.00.X'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

    BUILD FAILED (exit value 2, total time: 1s)

     
    delays.h doesn't seem to have source files from installing the peripheral library.
    #9
    jack@kksound
    code tags!
    • Total Posts : 3183
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 14:00:24 (permalink)
    +1 (1)
    This file  '../../../../../Program Files \(x86\)/Microchip/xc8/v2.05/sources/pic18/plib/XLCD/busyxlcd.c' is missing or at least the compiler could not find it. This what it syas in the error message "make[2]: *** No rule to make target ".
    #10
    katela
    Super Member
    • Total Posts : 1225
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 14:01:56 (permalink)
    +1 (1)
    If the only reason to use plib is because of the Xlcd library, then I don't think it worth it all this effort. You can configure the rest of the peripherals with MCC as you have done so and the LCD you can use many other libraries without having to install plib, because under v2.05 it's gonna be a lot of pain unless it's part of the learning exercise.
    You can easily use the lcd library supplied with PICDEM 2 Plus source code with MCC.
    Also explained here: ADC and LCD with MPLAB Code Configurator.

    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
    #11
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/22 14:05:06 (permalink)
    0
    The file has been added though, that's the confusing part, anything else that could cause this?
     
    I'll look into that tomorrow Katela as It is getting late, the main reason was that I have a HD44780 and am following a book to better myself and improving on concepts it provides as I want to be able to do much more than I currently do.
    post edited by btommo - 2019/04/22 14:12:37

    Attached Image(s)

    #12
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/24 12:46:46 (permalink)
    0
    Thank Katela, I seem to have something that can finally build OK :) I'm going to try on hardware tomorrow.
     
    I do have to ask though, what Pin on the LCD is RB7 LCD_PWR connected to? (may be a simple question but wasn't clear)
    post edited by btommo - 2019/04/24 13:39:47
    #13
    qhb
    Superb Member
    • Total Posts : 9939
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/24 13:42:49 (permalink)
    0
    If you have control of the power to the LCD, then the LCD_PWR pin should control that circuit.
    i.e. it is INDIRECTLY connected to VDD.
     
    #14
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/24 13:49:25 (permalink)
    0
    So through controlling an electronic switch for example? so can be unused if the LCD is to be powered constantly. from the initialisation of the LCD routine in the source file I see that it's just set to a '1'/high and that seems to be the only call for it.
    #15
    katela
    Super Member
    • Total Posts : 1225
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/24 14:56:18 (permalink)
    +2 (2)
    Yes, It needed if you want to control the power of the LCD from the code just as explained above.
    You can ignore it and connect your LCD directly to VCC.
    Here is the circuit diagram of the board:
     

    Attached Image(s)


    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
    #16
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/28 14:29:28 (permalink)
    0
    Thanks Katela, I've written some code and the program is mostly working but there a slight issue I am having problems with, when first powered up the display shows what is to be expected, but when the micro is reset the display doesn't seem to clear and the characters are all jumbled to begin with but I take it that is what the PWR pin is for.
    /* PIC18F45K22 LCD Volt Meter V2.00 
     *
     * In this project LCD display is connected to PORTb in 4-bit mode, Input PORT RA0(AN0)is used as
     * analogue input for input voltage to be measured.
     *
     * Voltage to be measured is applied to RA0. Microcontroller read analogue
     * voltage and converts it to digital then displays on LCD to indicate voltage.
     *
     * Analogue input range is 0V to 5V.
     *
     * File: main.c
     * Author: Btommo
     * PIC: PIC18F45K22
     * OSC: 8MHz internal oscillator
     * Created on 22 April 2019
     *
     * RB0 - D4
     * RB1 - D5
     * RB2 - D6
     * RB3 - D7
     * RB4 - R/S
     * RB5 - E
     * RB6 - RW
     * RB7 - LCD_PWR (not used)
     *
     * RA0 - Analogue input AN0
    */
    #include <stdio.h>
    #include <stdlib.h>
    #include <xc.h>
    #include <stdint.h>
    #include "mcc_generated_files/mcc.h"
    #include "lcd.h"



    //__EEPROM_DATA(0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
    /******************************************************************************/
    /*CONFIGURATION */
    /******************************************************************************/
    // PIC18F45K22 Configuration Bit Settings

    // 'C' source line config statements



    // #pragma config statements should precede project file includes.
    // Use project enums instead of #define for ON and OFF.
    #define _XTAL_FREQ 8000000 //oscillator frequency for delay_ms()







    /******************************************************************************/
    /* User Global Variable Declaration */
    /******************************************************************************/

    uint8_t dly_cnt1; //seconds delay counters
    uint8_t dly_cnt2;
    uint16_t convertedValue = 0;
    char Buffer[20];
    char op[10];
    float voltage, mv;





    /******************************************************************************/
    /* Main Program */
    /******************************************************************************/

    void initialise()
    {
       SYSTEM_Initialize();//initialize system;pins,osc,peripherals i.e adc,TMR0 etc
       LCD_Initialize();
    }



    void DLYS(unsigned char s)
    {
        dly_cnt2 = 0;
        while(dly_cnt2 < s/1) //seconds
        {
            dly_cnt1 = 0;
            while(dly_cnt1 < 1000/8)
            {
                TMR0 = 0;
                while(TMR0 < 8000/32)
                ;
                ++dly_cnt1;
            }
            ++dly_cnt2;
        }
        
    }







    void main()
    {
        initialise();
        DisplayClr();
        DLYS(1);
        cursor_off();
                           //clear LCD
        DLYS(1);
        LCDGoto(0,0);
        DisplayClr();
        LCDPutStr("ADC with MCC"); //display string
        LCDGoto(0,1); //go to first column second line
        LCDPutStr("Turn POT on AN0"); //display string
        DLYS(2);
        DisplayClr(); //clear display
          
       //MAIN LOOP
          
       while(1)
        {
           convertedValue = 0;
           convertedValue = ADC_GetConversion(0);
           voltage = (convertedValue*5.0)/1024; //conver ADC value into voltage
           mv = (convertedValue*5000.0)/1024; //conver ADC value into millivolts
           LCDPutStr("Voltage ="); //displaye "voltage = on screen
           sprintf(Buffer, "%.4g", voltage);//convert float voltage to string round
                                            //round to 3 decimal places
           LCDPutStr(Buffer); //display voltage on screen
           LCDGoto(14,0);
           LCDPutStr("V"); //clear after comma
           LCDGoto(0,1);
           LCDPutStr("mV ="); //displaye "voltage = on screen
           itoa(op,mv,10);
           LCDGoto(5,1);
           LCDPutStr(op); //display voltage on screen
           LCDGoto(10,1);
           LCDPutStr("mV"); //clear after comma
           __delay_ms(200);
           LCDGoto(0,0); //go to first line
        }
        return;
    }


        

     
    edit: It took me all day to post as kept getting "Access Denied" message.
    post edited by btommo - 2019/04/28 14:31:57
    #17
    katela
    Super Member
    • Total Posts : 1225
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/28 14:46:55 (permalink)
    0
    can you post your configuration bits as well?

    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
    #18
    qhb
    Superb Member
    • Total Posts : 9939
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/04/28 15:31:31 (permalink)
    +1 (1)
    btommo
    Thanks Katela, I've written some code and the program is mostly working but there a slight issue I am having problems with, when first powered up the display shows what is to be expected, but when the micro is reset the display doesn't seem to clear and the characters are all jumbled to begin with but I take it that is what the PWR pin is for.

    That usually indicates that the LCD is being used in 4-bit mode, and that the initialise function is not correctly getting the display back into 4 bit mode from an unknown state.
    It IS possible to do this without toggling the power to the LCD.
    Do you have the code for the LCD initialise function to show us?
     
    #19
    btommo
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2017/07/07 02:59:33
    • Location: 0
    • Status: online
    Re: PIC18F45K22 Issue using MPLAB XC8 Plib Library xlcd 2019/05/02 09:42:55 (permalink)
    0
    please see attached files, it wouldn't let me post the code directly to the forum
    post edited by btommo - 2019/05/02 09:47:46
    #20
    Jump to:
    © 2019 APG vNext Commercial Version 4.5