Looking for sample ADC code for only AN7 as ADC output and rest AN0-4 as GPIO inputs

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Looking for sample ADC code for only AN7 as ADC output and rest AN0-4 as GPIO inputs

ソリューションへジャンプ
1,715件の閲覧回数
TVNAIDU
Contributor III

I am Looking for sample ADC code to read only AN7 continuosly for 12 times as ADC output and rest AN0-4 as GPIO inputs, select chip using AN0-4 and its output on AN7.

 

AN4   AN3  AN2   AN1 AN0             AN7

0        0       0         0        1                 ADC output

0        0       0         1        0                ADC output

0        0       0         1        1                 ADC output

0        0       1         0        0                 ADC output

 

 

my program able to read only once for first one, after that not getting correct readings, appreciated.

ラベル(1)
0 件の賞賛
返信
1 解決策
855件の閲覧回数
RichTestardi
Senior Contributor II

Hi,

 

You can find a bunch of ADC sample code in the skeleton project at the bottom of:

 

http://www.cpustick.com/downloads.htm

 

Look in sources/adc.[ch] and follow the MCF52233 (I believe) #if's.  You can see how pins are configured in sources.pin.[ch], and you can configure AN7 for analog input while configuring the other AN pins for digital output or whatever.

 

If you're having trouble verifying your hardware is working, you can even load up StickOS and probe the hardware interactively -- it's pretty simple to set output pins or read input pins (even analog input).

 

-- Rich

 

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
856件の閲覧回数
RichTestardi
Senior Contributor II

Hi,

 

You can find a bunch of ADC sample code in the skeleton project at the bottom of:

 

http://www.cpustick.com/downloads.htm

 

Look in sources/adc.[ch] and follow the MCF52233 (I believe) #if's.  You can see how pins are configured in sources.pin.[ch], and you can configure AN7 for analog input while configuring the other AN pins for digital output or whatever.

 

If you're having trouble verifying your hardware is working, you can even load up StickOS and probe the hardware interactively -- it's pretty simple to set output pins or read input pins (even analog input).

 

-- Rich

 

0 件の賞賛
返信