Hi-Tech PICC18 Peripheral library problem

Status
Not open for further replies.

sukumar

Junior Member level 3
Joined
Nov 18, 2006
Messages
31
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,464
Hi all,

The following code throws
Error [499] ; 0. undefined symbol: _OpenADC(ADC.obj)

Can anybody help me. i cannot include plib.h properly. Or Pls tell me how to use peripheral library in my code. I am using PIC18F67J50

Code:
#include<htc.h>
#include<plib.h>
#include<stdio.h>
#include "UART.c"

__CONFIG(1,0xF796 & DEBUGDIS);							//XINSTDIS & DEBUGDIS & STVRDIS & PLLDIV10 & WDTDIS & CPUDIV2 & UNPROTECT);
__CONFIG(2,IESODIS & FCMDIS & HSPLL & WDTPS1);

unsigned int Convert_ADC(void);

void main(void)
{
	unsigned int result;
	serial_init();
	OpenADC(ADC_FOSC_2 & ADC_LEFT_JUST & ADC_2_TAD, ADC_CH0 & ADC_INT_OFF & ADC_REF_VDD_VSS, ADC_1ANA);
	while(1)
	{
		result = Convert_ADC();
		printf("%d",result);
	}
}

unsigned int Convert_ADC(void)
{
	unsigned int result;
	ConvertADC();
	while (BusyADC());
	result = ReadADC();
	CloseADC();
	return result;
}

void putch(unsigned char chr)			//Function Called by Printf
{
	Transmit(chr);
}
 

you have to link in the library.

or copy the source code to your project folder.
 

Hi millwood,

Thanks for your reply. I will try to copy the source code.
but how(what is) to link the library. Really i dont know? Any example.

I thought it would be better to link the library.

copying the source code is working now. Thank you very much.
 
Last edited:

Hi millwood,

For linking the library, Just Goto Build Options-->Project-->Linker Tab-->Check the box "Link in peripheral library". It solved my problem.
Thank you very much for ur valuable idea.

---------- Post added at 03:51 AM ---------- Previous post was at 03:21 AM ----------

similar problem faced here,
**broken link removed**
 

that's right. you need to link plib, as specified in the ide manual.

HI-TECH Software Forums: Problem with including peripheral library in Hitech c 18 v 9.63

don't take that place seriously: many of those 'experts" there don't know simple issues like "read-modify-write".
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…