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 */
}
解決済! 解決策の投稿を見る。
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------
How can I set timer in interrupt for 10m sec
hi KDN
I am afraid this mc9s12xhz chip doesn't support FreeCntr component.
Please use TimerInt component to set 10ms interrupt
can this help?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
If I run API periodic interrupt timer my Input capture mode not work
This FreeCntr component is shared with input capture mode time , I need separate timer
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.