Problems with adc multiple channels using processor expert

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems with adc multiple channels using processor expert

ソリューションへジャンプ
801件の閲覧回数
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.

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
544件の閲覧回数
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 件の賞賛
返信
1 返信
545件の閲覧回数
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 件の賞賛
返信