Problems with adc multiple channels using processor expert

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems with adc multiple channels using processor expert

Jump to solution
860 Views
maikonperin
Contributor I

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.

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
603 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
604 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply