I'm using frdm-k64 board.i want to read adc input from ADC0_DM0/ADC1_DM3 pin.
is there any example code for the diffential mode analog reading?
For differential mode you just need to set ADC_SC1A_DIFF in addition to the channel reference in ADCx_SC1A.
However differential input between ADC0_DM0 and ADC1_DM3 pin is not possible - it can only be between ADC0_DM0 and ADC0_DP0orADC1_DM3/ADC1_DP3
Complete Kinetis solutions, training and support: http://www.utasker.com/kinetis.html
Unfortunately, there is no driver example for the K64 with ADC differential mode. However, you could use the SDK driver example called "adc16_interrupt" and modify it so it can have the differential mode; for that you just have to change the ADC0 channel to the one corresponding to the ADC0_DM0 & ADC0_DP0 (Channel 0):
#define DEMO_ADC16_USER_CHANNEL 0U /* ADC0_DM0 / DP0 */
Also, as Mark just said in his answer, you also have to set the ADC_SC1A_DIFF; for that, in the same driver example just set to true the "enableDifferentialConversion" from the channel configuration:
#if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE adc16ChannelConfigStruct.enableDifferentialConversion = true;#endif /* FSL_FEATURE_ADC16_HAS_DIFF_MODE */
In order to check if this works, check the ADC0_DM0 and ADC0_DP0 from the FRDM-K64:
I hope this information can help you.
Differential mode works from (1^N-1) /2 , means from minus to plus half range.
there should be a possibility to make it unsigned differential mode
Can some one tell how to do it in the sdk?
Retrieving data ...