How can I enable and disable Input capture mode in code warrior software using this function below generated by Processor expert

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

How can I enable and disable Input capture mode in code warrior software using this function below generated by Processor expert

ソリューションへジャンプ
3,364件の閲覧回数
kdn
Contributor III

byte Cap1_Enable(void)

{

  if (!EnUser) {                       /* Is the device disabled by user? */

    EnUser = TRUE;                     /* If yes then set the flag "device enabled" */

  /* TFLG1: C7F=0,C6F=0,C5F=0,C4F=0,C3F=0,C2F=0,C1F=0,C0F=1 */

    TFLG1 = 0x01U;                     /* Reset interrupt request flag */

    TIE_C0I = 1U;                      /* Enable interrupt */

    TFLG2_TOF = 1U;                    /* Reset overflow interrupt request flag */

    TSCR2_TOI = 1U;                    /* Enable overflow interrupt */

  /* TCTL4: EDG0B=1,EDG0A=1 */

    TCTL4 |= 0x03U;                    /* Enable capture function */

  }

  return ERR_OK;                       /* OK */

}

 

 

/*

** ===================================================================

**     Method      :  Cap1_Disable (component Capture)

**

**     Description :

**         This method disables the component - it stops the capture. No

**         events will be generated.

**     Parameters  : None

**     Returns     :

**         ---             - Error code, possible codes:

**                           ERR_OK - OK

**                           ERR_SPEED - This device does not work in

**                           the active speed mode

** ===================================================================

*/

byte Cap1_Disable(void)

{

  if (EnUser) {                        /* Is the device enabled by user? */

    EnUser = FALSE;                    /* If yes then set the flag "device disabled" */

    TIE_C0I = 0U;                      /* Disable interrupt */

    TSCR2_TOI = 0U;                    /* Disable overflow interrupt */

  /* TCTL4: EDG0B=0,EDG0A=0 */

    TCTL4 &= (uint8_t)~(uint8_t)0x03U; /* Disable capture function */

  }

  return ERR_OK;                       /* OK */

}

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
2,885件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi KDN,

I am not sure if i understand your question.

when you add Capture component to a project,  Capture mode is enabled by default.

when you want disable capture mode, you can execute

Cap1_Disable()

in your code .

when you want enable it again, you execute

Cap1_Enable()

does it make sense?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
6 返答(返信)
2,886件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi KDN,

I am not sure if i understand your question.

when you add Capture component to a project,  Capture mode is enabled by default.

when you want disable capture mode, you can execute

Cap1_Disable()

in your code .

when you want enable it again, you execute

Cap1_Enable()

does it make sense?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,888件の閲覧回数
kdn
Contributor III

How can I set timer in interrupt for 10m sec

10-07-2015.png

0 件の賞賛
返信
2,888件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

hi KDN

I am afraid this mc9s12xhz chip doesn't support FreeCntr component.

Please use TimerInt component to set 10ms interrupt

2015-07-11_0-24-30.png

can this help?

Have a great day,

Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,890件の閲覧回数
kdn
Contributor III

If I run API periodic interrupt timer my Input capture mode not work

0 件の賞賛
返信
2,890件の閲覧回数
kdn
Contributor III

This FreeCntr component is shared with input capture mode time , I need separate timer

0 件の賞賛
返信
2,890件の閲覧回数
kdn
Contributor III

I have connected 3 PWM channel On input capture pin for reading duty cycle of signal, I want to read them one by one in interrupt mode.

0 件の賞賛
返信