I am using a K40 Tower System with MQX4.0 CW10.3 and cannot get the ADC to do differential mode.
I used PE to set it up. ADC1, Differential, input-> PGA1_DP/ADC1_DP0/ADC0_DP3 and negatice ->PGA1_DM/ADC1_DM0/ADC0_DM3, Conversion time : 9.615385 µs, High voltage reference Vrefh_1_2V, Low voltage reference Vrefl_1_2V
My code from the example PE stuff builds and runs but all I get is 56891 to 56897, no matter what I put on the input lines ADC1_DP0 & ADC1_DM0.
Here is the code:
void main_task(uint_32 initial_data)
{
uint_16 atodValue;
MyADCPtr = AD1_Init((LDD_TUserData *)NULL); /* Initialize the device */
printf("\n\n-------------- Begin TJs Differential ADC example --------------\n\n");
while (TRUE)
{
_time_delay(5);
SampleGroup[0].ChannelIdx = 0U; /* Create one-sample group */
Error = AD1_CreateSampleGroup(MyADCPtr, (LDD_ADC_TSample *)SampleGroup, SAMPLE_GROUP_SIZE); /* Set created sample group */
Error = AD1_StartSingleMeasurement(MyADCPtr); /* Start continuous measurement */
//_time_delay(2); //while (!AD1_GetMeasurementCompleteStatus(MyADCPtr)) {}; /* Wait for conversion completeness */
while (ADC1_SC2 & 0x080);
Error = AD1_GetMeasuredValues(MyADCPtr, (LDD_TData *)MeasuredValues); /* Read measured values */
printf("%5d,\n ", *MeasuredValues);
}
printf("\ndone!\n");
_task_block();
}
Any help or ideas is much appreciated.
Thanks and cheers,
Tom
Solved! Go to Solution.
Never mind, there is something goofy about how the ADCO_DP0 & DM0 run out to the tower card A27 & A28. I soldered wires right to the main board and all is good.
Also, PE Rocks!
Cheers,
Tom
I'm back onto this differential A/D stuff Monday. Anyone with any experience doing differential with a Kinetis Tower System. I'm just trying to help out an analog dude so he can test performance, it just needs it to work.
Cheers!
Never mind, there is something goofy about how the ADCO_DP0 & DM0 run out to the tower card A27 & A28. I soldered wires right to the main board and all is good.
Also, PE Rocks!
Cheers,
Tom
G R E A T !
:smileygrin: