74 #if defined(HAS_NZ_ADC)
79 #define CONVERT_MV_TO_10BIT_ADC_VALUE(mv) ((WORD) ( (((float)mv)/((float)ADC_REF_MV)) * 1023.0) )
83 #ifndef ADC_FILTER_STAGES
84 #define ADC_FILTER_STAGES 4
88 #ifndef nzINT_PRIORITY_ADC1
89 #define nzINT_PRIORITY_ADC1 4
93 #define ADC_MAX_CHAN ADC_MAX_CHAN_BRD
97 #ifndef ADC_CHANNEL_MASK_LOW
98 #define ADC_CHANNEL_MASK_LOW ADC_CHANNEL_MASK_LOW_BRD
102 #ifndef ADC_CHANNEL_MASK_HIGH
103 #define ADC_CHANNEL_MASK_HIGH ADC_CHANNEL_MASK_HIGH_BRD
110 typedef struct __attribute__((aligned(2), packed))
118 unsigned int bDataValid : 1;
119 unsigned int bFill : 15;
134 WORD adcFilter[ADC_FILTER_STAGES][ADC_MAX_CHAN];
136 WORD conversionCount;
141 #ifndef THIS_IS_NZ_ANALOG_C
142 extern ADC_INFO adcInfo;
185 void adcOpenExtra(DWORD adcChannels, BYTE conversionClock, BYTE sampleTime);
202 #define adcOpen(adcChannels) adcOpenExtra(adcChannels, 64, 31)
211 #define adcStart() {_AD1IF = 0; _ASAM = 1;}
235 WORD adcReadChanForIndex(BYTE index);
252 #define adcReadChan8BitForIndex(index) ((BYTE)(adcReadChanForIndex(index)>>2))
265 WORD adcReadChan(BYTE ch);
278 #define adcReadChan8Bit(ch) ((BYTE)(adcReadChan(ch)>>2))
291 WORD adcReadChanMvForIndex(BYTE ch);
304 WORD adcReadChanMv(BYTE ch);
321 WORD adcConvertChan(BYTE ch, BYTE times);
343 WORD adcConvertChanForIndex(BYTE index, BYTE times);
360 WORD adcConvertChanMv(BYTE ch, BYTE times);
382 WORD adcConvertChanMvForIndex(BYTE index, BYTE times);
388 #define adcIntEnable() (_AD1IE = 1)
394 #define adcIntDisable() (_AD1IE = 0)
399 #define adcGetConversionCount() (adcInfo.conversionCount)
405 #define adcGetFilterStages() (ADC_FILTER_STAGES)
407 #endif //#if defined(HAS_NZ_ADC)
408 #endif //#ifndef NZ_ANALOG_H