1. In trying to get a simple ADC function to work using adc and PE typical example code, the code doesn't compile. One variable doesn't seem to be defined.
If someone has a working PE example of a single channel conversion that would be great.
2. For a simple DAC example using CW and PE, when trying to execute
Error = dim_voltage_SetValue(MyDACDataPtr, 0xffff); which is basically sending a value to the DAC output, the debugger goes to:
PE_ISR(Cpu_Interrupt)
{
/* This code can be changed using the CPU component property "Build Options / Unhandled int code" */
PE_DEBUGHALT();
what causes this, and if its an unhandled interrupt how do I find out what caused it?
Regarding ADC. I also used the typical example code and had no trouble compiling it.
Here's my code, it's almost the same as the example code. I only altered it to work with a static sample group (here group 1).
AD1_TResultData MeasuredValue[SAMPLE_GROUP_SIZE];
LDD_TDeviceData *MyADCPtr;
LDD_TError Error;
MyADCPtr = AD1_Init((LDD_TUserData *)NULL); /* Initialize the device */
Error = AD1_SelectSampleGroup(MyADCPtr, 1U); | |
Error = AD1_StartSingleMeasurement(MyADCPtr); // Start continuous measurement | |
while (!AD1_GetMeasurementCompleteStatus(MyADCPtr)) {}; // Wait for conversion completeness | |
Error = AD1_GetMeasuredValues(MyADCPtr, (LDD_TData *)MeasuredValue); // Read measured values | |
FsrReadings[1] = MeasuredValue[0]; |
Thanks filipsobczak,
I can now compile. So the input is ADC0_DP0 which is PTE20 on the FRDMKL board, but the value never changes, its always 0x5ac, whether I tie the pin to P3V3 [3v] or GND. What did you set the reference to? What might I be missing? In addition I tied VREFH to P3V3 on FRDMKL board but VREFL isn't pinned out.
Thanks btw.
I'm afraid I can't help you anymore. My voltage referrence pins are VREFH and VREFL. And for further notice ADC0_DP0 is a differential channel. In single ended mode the PTE20 ADC input channel is ADC0_SE0.