Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic18f43k22 adc error

Status
Not open for further replies.

bhan1992

Member level 1
Member level 1
Joined
Feb 25, 2012
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,511
i try to build the code below but it gives me the following errors. i checked that 'ADC_8ANA_0REF' is in the 'adc.h' header.

Code:
#include <p18f43k22.h>
#include <adc.h>
#include <delays.h>
#include <stdlib.h>
#include <timers.h>
#include <salvo.h>
#undef OSC

void main (void)
{
	TRISB = 0;

	OSCreateTask(slow_beep, OSTCBP(1), 7);
	OSCreateTask(medium_beep, OSTCBP(2), 7);
	OSCreateTask(fast_beep, OSTCBP(3), 7);

	OpenTimer0 (TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_1);
	WriteTimer0(55536);
	INTCONbits.GIE = 1;

	OpenADC (ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_2_TAD & ADC_8ANA_0REF, ADC_CH0 & ADC_INT_OFF);
	PORTB = 1;		//initialisation 0.7 second beep
	Delay10KTCYx(10);	
	PORTB = 0;

	while(1)
	{
	SetChanADC(ADC_CH0);
	ConvertADC();
	while(BusyADC());
	result = ReadADC();
	OSSched();
	OS_Delay(10,main)	//delay0.1 second
	}
	CloseADC();
}

Error [1105] symbol 'ADC_8ANA_0REF' has not been defined
Error [1203] too few arguments in function call
 

Hi,

You'll probably need to look into adc.h for how OpenADC() is declared and the ADC_' macros are defined for the '4620. The number of parameters and proper combination of ADC_' masks are likely to be accounted for in the fact that the '4620 has three ADCON' registers, not two.

Best regards,
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top