I'm using kl46z and kinetis design studio to measure two adc channels but it's not working. I just added 2 channels on the processor expert.
I'm using the code below.
static uint8_t value[AD1_CHANNEL_COUNT];
(void)AD1_Measure(TRUE);
AD1_GetValue8(&value[0]);
AD1_GetValue8(&value[1]);
Can someone help me? Thanks.
Solved! Go to Solution.
Hello Perin,
When read the result , please write :
AD1_GetValue8((byte*)value);
For in the function of "byte AD2_GetValue8(byte *Values)" , it has include read the two channel result :
/* ===================================================================*/
byte AD2_GetValue8(byte *Values)
{
if (OutFlg != 0x03U) { /* Is output flag set? */
return ERR_NOTAVAIL; /* If no then error */
}
Values[0] = (byte)((byte)(AD2_OutV[0] >> 8U)); /* Save measured values to the output buffer */
Values[1] = (byte)((byte)(AD2_OutV[1] >> 8U)); /* Save measured values to the output buffer */
return ERR_OK; /* OK */
}
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Perin,
When read the result , please write :
AD1_GetValue8((byte*)value);
For in the function of "byte AD2_GetValue8(byte *Values)" , it has include read the two channel result :
/* ===================================================================*/
byte AD2_GetValue8(byte *Values)
{
if (OutFlg != 0x03U) { /* Is output flag set? */
return ERR_NOTAVAIL; /* If no then error */
}
Values[0] = (byte)((byte)(AD2_OutV[0] >> 8U)); /* Save measured values to the output buffer */
Values[1] = (byte)((byte)(AD2_OutV[1] >> 8U)); /* Save measured values to the output buffer */
return ERR_OK; /* OK */
}
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------