Hi
I'm trying to use the LCD functions provided by 24H/dsPIC peripheral library from Microchip, using C30.
I know how to use C30 for making code from scratch, but when I try to link this library, it seems that something is not working.
I tried to add the files libp24hj12gp202-coff.a and libp24hj12gp202-elf to my project tree in the folder "library files". Nothing.
I tried to put the xlcd.h (header for the LCD functions/types) and all sources (C) in my project, and build. Nothing.
This is a simple example taken from the library's documentation.
#define _RD10
#include <p24hxxxx.h>
#include "xlcd.h"
char *buffer;
char data ;
char mesg1[] = {'H','A','R','D','W','A','R','E','\0'};
char mesg2[] = {'P','E','R','I','P','H','E','R','A','L',' ', 'L','I','B',' ','\0'};
int main(void)
{
// Set 8bit interface and two line display
OpenXLCD(EIGHT_BIT & TWO_LINE & SEG1_50_SEG51_100 & COM1_COM16);
// Wait till LCD controller is busy
while(BusyXLCD());
// Turn on the display
WriteCmdXLCD(DON & CURSOR_ON & BLINK_OFF);
buffer = mesg1;
PutsXLCD(buffer);
while(BusyXLCD());
// Set DDRam address to 0x40 to dispaly data in the second line
SetDDRamAddr(0x40);
while(BusyXLCD());
buffer = mesg2;
PutsXLCD(buffer);
while(BusyXLCD());
return 0;
}
What I get is,
D:\PIC\LCD Test2\lcd.c:23: warning: implicit declaration of function 'PutsXLCD'
lcd.o(.text+0x4): In function `main':
D:\PIC\LCD Test2\lcd.c:15: undefined reference to `OpenXLCD'
lcd.o(.text+0x6)
:\PIC\LCD Test2\lcd.c:18: undefined reference to `BusyXLCD'
lcd.o(.text+0xe)
:\PIC\LCD Test2\lcd.c:21: undefined reference to `WriteCmdXLCD'
lcd.o(.text+0x16)
:\PIC\LCD Test2\lcd.c:23: undefined reference to `PutsXLCD'
lcd.o(.text+0x18)
:\PIC\LCD Test2\lcd.c:25: undefined reference to `BusyXLCD'
lcd.o(.text+0x20)
:\PIC\LCD Test2\lcd.c:28: undefined reference to `SetDDRamAddr'
lcd.o(.text+0x22)
:\PIC\LCD Test2\lcd.c:30: undefined reference to `BusyXLCD'
lcd.o(.text+0x2e)
:\PIC\LCD Test2\lcd.c:33: undefined reference to `PutsXLCD'
lcd.o(.text+0x30)
:\PIC\LCD Test2\lcd.c:35: undefined reference to `BusyXLCD'
Link step failed.
Any help out there?
thanks
I'm trying to use the LCD functions provided by 24H/dsPIC peripheral library from Microchip, using C30.
I know how to use C30 for making code from scratch, but when I try to link this library, it seems that something is not working.
I tried to add the files libp24hj12gp202-coff.a and libp24hj12gp202-elf to my project tree in the folder "library files". Nothing.
I tried to put the xlcd.h (header for the LCD functions/types) and all sources (C) in my project, and build. Nothing.
This is a simple example taken from the library's documentation.
#define _RD10
#include <p24hxxxx.h>
#include "xlcd.h"
char *buffer;
char data ;
char mesg1[] = {'H','A','R','D','W','A','R','E','\0'};
char mesg2[] = {'P','E','R','I','P','H','E','R','A','L',' ', 'L','I','B',' ','\0'};
int main(void)
{
// Set 8bit interface and two line display
OpenXLCD(EIGHT_BIT & TWO_LINE & SEG1_50_SEG51_100 & COM1_COM16);
// Wait till LCD controller is busy
while(BusyXLCD());
// Turn on the display
WriteCmdXLCD(DON & CURSOR_ON & BLINK_OFF);
buffer = mesg1;
PutsXLCD(buffer);
while(BusyXLCD());
// Set DDRam address to 0x40 to dispaly data in the second line
SetDDRamAddr(0x40);
while(BusyXLCD());
buffer = mesg2;
PutsXLCD(buffer);
while(BusyXLCD());
return 0;
}
What I get is,
D:\PIC\LCD Test2\lcd.c:23: warning: implicit declaration of function 'PutsXLCD'
lcd.o(.text+0x4): In function `main':
D:\PIC\LCD Test2\lcd.c:15: undefined reference to `OpenXLCD'
lcd.o(.text+0x6)
lcd.o(.text+0xe)
lcd.o(.text+0x16)
lcd.o(.text+0x18)
lcd.o(.text+0x20)
lcd.o(.text+0x22)
lcd.o(.text+0x2e)
lcd.o(.text+0x30)
Link step failed.
Any help out there?
thanks