Re: 用C語言練習APP001 ADC
|
||||
---|---|---|---|---|
初級會員
|
感謝兩位前輩的指導...
讓我可以把問題順利解決~~~ 十分感謝~~~
發表於: 2007/5/14 10:46
|
|||
|
Re: 用C語言練習APP001 ADC
|
||||
---|---|---|---|---|
資深會員
|
你用的 OpenADC 的參數
是pic18f452的參數 和 pic18f4520 有點不一樣, 且該函式需有3個引數 請打開 adc.h 來研究一下就知道了 兩個方式 1. 使用pic18f452 IC 並改用p18f452.h 18f452i.lkr 2. 使用pic18f4520 IC 並修改OpenADC 函數的參數
發表於: 2007/5/12 21:32
|
|||
|
用C語言練習APP001 ADC
|
||||
---|---|---|---|---|
初級會員
|
各位前輩
最近想轉成C語言的寫法...可是在自學時遇到了些問題~ 在W401的課程中有一個是ADC的範例~ 在OpenADC那一部份不太了解~ OpenADC( ADC_FOSC_32 & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF ); 而且在那一部份的編譯也出現了問題...邊譯後會出現下列的錯誤~ D:\W401 Answer\Ans3-1\ex3-1.c:31:Error [1105] symbol 'ADC_1ANA_0REF' has not been defined D:\W401 Answer\Ans3-1\ex3-1.c:31:Error [1203] too few arguments in function call 請問我在程式的部份有那些問題呢?? 下列附上範例程式..使用IC為18F4520 #include <p18f4520.h> #include <adc.h> void InitializeAD(void); void main(void) { TRISD=0; // Set PORTD for LED output InitializeAD( ); // Initial A/D module while(1) { ConvertADC(); // Convert A/D while(BusyADC( )); // Waiting A/D until done PORTD=ADRESH; // Put A/D result on LEDs } } void InitializeAD(void) { OpenADC( ADC_FOSC_32 & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF ); } 麻煩各位前輩幫忙解答..謝謝~
發表於: 2007/5/12 17:09
|
|||
|