使用QTMER 脉冲输出功能脉冲数多发问题

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

使用QTMER 脉冲输出功能脉冲数多发问题

64,634 Views
798821723
Contributor I
大家好,我按手册46.7.5.12章的脉冲输出功能 Pulse-Output Mode,按照例程编写代码,用官方的开发板测试,能够发送脉冲,但是我用逻辑分析仪查看脉冲数有时正确,有时会多发一个,不知是什么问题。 请大家指点谢谢。
0 Kudos
Reply
26 Replies

7,027 Views
stefanct
Contributor IV

Hi,

have you ever figured out what the underlying problem was? I have a very similar situation on an RT1020 but I am not using Keil.

0 Kudos
Reply

61,280 Views
798821723
Contributor I

7B2415983990D2CE30F5E4277823E5BB.jpg7A0A71D6C762B86B60239444F5CD1639.jpg

0 Kudos
Reply

61,289 Views
798821723
Contributor I

void PulseChxStream_Init(TMR_Type *TIMx,IRQn_Type IRQn,uint32_t Plusefreq,uint16_t PluseData,uint8_t TimChanel,uint8_t OutChanel,uint16_t OutMode)
{
TIMx->CHANNEL[OutChanel].CTRL&=~TMR_CTRL_CM_MASK; /* 复位计数器 */
TIMx->CHANNEL[TimChanel].CTRL&=~TMR_CTRL_CM_MASK; /* 复位定时器 */
//选择IP_bus_clk / 16作为定时器3的时钟源
/* TMR3_CTRL:CM = 0,PCS = 0x0C,SCS = 0,ONCE = 0,LENGTH = 1,DIR = 0,COINIT = 0,OUTMODE = 3 */
// TMR3->CHANNEL[1].COMP1=CLOCK_GetFreq(kCLOCK_IpgClk)/128/Plusefreq; /* (16 * 37500)/ 60e6 = 0.01秒 */
if(Plusefreq<10000)
{
TIMx->CHANNEL[TimChanel].CTRL=0x1E23; /* 设置模式 */
TIMx->CHANNEL[TimChanel].COMP1=IpFreq/128/(Plusefreq);
}
else
{
TIMx->CHANNEL[TimChanel].CTRL=0x1023; /* 设置模式 */
TIMx->CHANNEL[TimChanel].COMP1=IpFreq/1/(Plusefreq);
}
/* TMR3_SCTRL:TCF = 0,TCFIE = 0,TOF = 0,TOFIE = 0,IEF = 0,IEFIE = 0,IPS = 0,INPUT = 0,
功能说明
Capture_Mode = 0,MSTR = 0,EEOF = 0,VAL = 0,FORCE = 0,OPS = 0,OEN = 0
*/
TIMx->CHANNEL[TimChanel].SCTRL=0x00;
TIMx->CHANNEL[TimChanel].LOAD=0x00; /* 重置加载寄存器 */
/* TMR3_CSCTRL: DBG_EN=0,FAULT=0,ALT_LOAD=0,ROC=0,TCI=0,UP=0,OFLAG=0,
TCF2EN=0,TCF1EN=0,TCF2=0,TCF1=0,CL2=0,CL1=0 */
TIMx->CHANNEL[TimChanel].CSCTRL=0x00; /* 设置比较器控制寄存器 */
// 定时器3的输出是该定时器的时钟源。
/* TMR1_CTRL: CM=0,PCS=7,SCS=0,ONCE=1,LENGTH=1,DIR=0,COINIT=0,OUTMODE=7 */
TIMx->CHANNEL[OutChanel].CTRL=OutMode; /* 0x0A67 设置模式 TMR3的定时器1作为通道0的时钟源 */
/* TMR1_SCTRL: TCF=0,TCFIE=0,TOF=0,TOFIE=0,IEF=0,IEFIE=0,IPS=0,INPUT=0,
Capture_Mode=0,MSTR=0,EEOF=0,VAL=0,FORCE=0,OPS=0,OEN=1 */
TIMx->CHANNEL[OutChanel].SCTRL=0x0001;
TIMx->CHANNEL[OutChanel].CNTR=0x00; /* 重置计数器寄存器 */
TIMx->CHANNEL[OutChanel].LOAD=0x00; /* 重置加载寄存器 */
TIMx->CHANNEL[OutChanel].COMP1=PluseData; /* 设置比较1个寄存器 输出的脉冲数*/
// 设置为在最后一个脉冲之后中断
/* TMR1_CSCTRL: DBG_EN=0,FAULT=0,ALT_LOAD=0,ROC=0,TCI=0,UP=0,OFLAG=0,
TCF2EN=0,TCF1EN=1,TCF2=0,TCF1=0,CL2=0,CL1=0 */
TIMx->CHANNEL[OutChanel].CSCTRL=0x40; /* 设置比较器控制寄存器 */
// 最后,启动计数器运行
TIMx->CHANNEL[TimChanel].CNTR=0; /* 重置计数器 */
/*设置中断优先级,*/
set_IRQn_Priority(IRQn,Group4_PreemptPriority_6, Group4_SubPriority_0);
/*开启中断 */
EnableIRQ(IRQn);

TIMx->CHANNEL[TimChanel].CTRL|=(2<<13); /* 运行源时钟计数器 */
TIMx->CHANNEL[OutChanel].CTRL|=(2<<13); /* 运行计数器 */
}

测试重复调用并发送脉冲,还是会多发。不知什么原因?

大家可以测试一下。

0 Kudos
Reply

61,274 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

你所说的多发现象是每次都会发生吗?还是存在固定的比率或发生次序呢?

Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

61,270 Views
798821723
Contributor I

您好,这种现象不是有规律的发生,有时会发送数量正确,有时就连续发送多次都错误(总是多发1个)。

还有时会发送一次数量是对的,再发一次数量多一个,这样交替。

但是,每次复位芯片后第一次发送数量是对的,在发送一次就不对了。

0 Kudos
Reply

61,268 Views
798821723
Contributor I

我是想用这种方式来控制步进电机做角度控制,如果发送的脉冲数量不正确肯定会影响电机转动角度的精度。

我反复测试,感觉是 QTMER通道0在计数比较后没有及时的关闭输出,造成输出通道多发送了一个脉冲。

感觉还是芯片硬件上的问题,我的程序是严格按照手册的示例来做的。您也可以用1052-EVK实际测试一下。

如果你有代码示例,发我,我来用逻辑分析仪测试。

                                     谢谢!

0 Kudos
Reply

61,260 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

请分享完整的代码工程,我用MIMXRT1050 板子测试一下,看看能否复现问题。

Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

61,233 Views
798821723
Contributor I

分析仪测量GPIO2的Pin6

0 Kudos
Reply

61,232 Views
798821723
Contributor I

使用的KEIL5.27开发环境

Tags (1)
0 Kudos
Reply

61,223 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
我根据你分享的代码,修改SDK库中evkbimxrt1050_qtmr_timer代码来实现Pulse-Output Mode,测试下来功能是正常的。
PWM 输出脚为GPIO_AD_B1_00, MIMXRT1050中J23-6.

jeremyzhou_0-1616056266688.png


附件是我的代码。

Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

61,183 Views
798821723
Contributor I

您使用的是KEIL吗?我的是KEIL5.27,怎么打不开您的功能文件呢?

0 Kudos
Reply

61,176 Views
798821723
Contributor I

/*
* Copyright 2017-2020 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*******************************************************************************
* Includes
******************************************************************************/
#include "fsl_debug_console.h"
#include "board.h"

#include "bsp_tmr.h"
//#include "fsl_qtmr.h"

#include "pin_mux.h"
#include "clock_config.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/* The QTMR instance/channel used for board */
#define BOARD_QTMR_BASEADDR TMR3
#define BOARD_FIRST_QTMR_CHANNEL kQTMR_Channel_0
#define BOARD_SECOND_QTMR_CHANNEL kQTMR_Channel_1
#define QTMR_ClockCounterOutput kQTMR_ClockCounter0Output


/* Interrupt number and interrupt handler for the QTMR instance used */
#define QTMR_IRQ_ID TMR3_IRQn
#define QTMR_IRQ_HANDLER TMR3_IRQHandler

/* QTMR Clock source divider for Ipg clock source, the value of two macros below should be aligned. */
#define QTMR_PRIMARY_SOURCE (kQTMR_ClockDivide_128)
#define QTMR_CLOCK_SOURCE_DIVIDER (128U)
/* The frequency of the source clock after divided. */
#define QTMR_SOURCE_CLOCK (CLOCK_GetFreq(kCLOCK_IpgClk) / QTMR_CLOCK_SOURCE_DIVIDER)

/*******************************************************************************
* Prototypes
******************************************************************************/

/*******************************************************************************
* Variables
******************************************************************************/

volatile bool qtmrIsrFlag = false;

/*******************************************************************************
* Code
******************************************************************************/
void QTMR_IRQ_HANDLER(void)
{
/* Clear interrupt flag.*/
QTMR_ClearStatusFlags(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, kQTMR_CompareFlag);

qtmrIsrFlag = true;
}

 

/*!
* @brief Main function
*/
int main(void)
{
uint32_t i = 0;
qtmr_config_t qtmrConfig;

gpio_pin_config_t gpt_config;

gpt_config.direction = kGPIO_DigitalOutput;
gpt_config.outputLogic = 0;
gpt_config.interruptMode = kGPIO_NoIntmode;


/* Board pin, clock, debug console init */
BOARD_ConfigMPU();
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();

GPIO_PinInit(GPIO1, 16, &gpt_config);

QTMR_GetDefaultConfig(&qtmrConfig);

/* Initial the input channel. */
qtmrConfig.primarySource = QTMR_PRIMARY_SOURCE;
QTMR_Init(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, &qtmrConfig);

IpFreq=CLOCK_GetFreq(kCLOCK_IpgClk);
//PlsueCh0Init();
PulseChxStream_Init(TMR3,TMR3_IRQn,100000,4,1,0,0x0A67);
for(i=0;i<100000000;i++);

PulseChxStream_Init(TMR3,TMR3_IRQn,100000,4,1,0,0x0A67);
for(i=0;i<100000000;i++);

PulseChxStream_Init(TMR3,TMR3_IRQn,100000,4,1,0,0x0A67);
for(i=0;i<100000000;i++);

PulseChxStream_Init(TMR3,TMR3_IRQn,100000,4,1,0,0x0A67);

while (1)
{
}
}

我把您的代码移植到qtmr_timer的例程里替换掉源文件,编译下载到板卡仿真,用逻辑分析仪抓取不到波形

0 Kudos
Reply

61,162 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
我使用的是MCUXpreeso IDE,因为我的输出是在GPIO_AD_B1_00, MIMXRT1050中J23-6,所以需要对其进行相关的引脚初始化,对应代码在BOARD_InitPins()函数中。
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

61,159 Views
798821723
Contributor I

您有没有发送后在仿真状态下用软件复位在次发送呢?我用KEIL软件复位后再次执行代码就会发送不正确的脉冲数了,给板卡上电后第一次运行代码才能正常发送正确的脉冲数量。

另外你是否方便用keil做一下测试呢?或者看一下我发您的KEIL例程,用这个例程测试一下。

0 Kudos
Reply

61,175 Views
798821723
Contributor I

引脚是J23的6

0 Kudos
Reply

61,174 Views
798821723
Contributor I

板卡IMXRT1050-EVKB

0 Kudos
Reply

61,168 Views
798821723
Contributor I

仿真时不出波形,板卡手动复位能抓到波形,但是波形也不对,脉冲数量也不对。

0 Kudos
Reply

61,114 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

你这个波形是使用我分享的例程测测试出来的吗?如果不是,请直接下载我的工程用MCUXpresso IDE测试。

Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

61,167 Views
798821723
Contributor I

我发现代码下载到板卡每次按下板卡复位按键逻辑分析仪能抓到波形,每次按下后抓的波形和数量都是正确的,但是在keil调试状态用软件上的复位后在运行时用逻辑分析仪抓到的脉冲数量就会多一个,您可以试一下。看看什么原因。

0 Kudos
Reply

61,157 Views
798821723
Contributor I
 
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1245184%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3EProblems%20with%20the%20QTMER%20Pulse%20Output%20Function%20Pulse%20Count%20Multiple%20Issues%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245184%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3EHi%20all%2C%20I%20am%20following%20the%20pulse%20output%20function%20in%20chapter%2046.7.5.12%20of%20the%20manual%20Pulse-Output%20Mode%2C%20wrote%20the%20code%20according%20to%20the%20routine%2C%20tested%20it%20with%20the%20official%20development%20board%2C%20it%20is%20able%20to%20send%20pulses%2C%20but%20when%20I%20check%20the%20number%20of%20pulses%20with%20the%20logic%20analyzer%20sometimes%20it%20is%20correct%2C%20sometimes%20it%20sends%20one%20more%2C%20I%20don't%20know%20what%20is%20the%20problem.%20I%20don't%20know%20what%20is%20the%20problem.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2157466%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2157466%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3Ehave%20you%20ever%20figured%20out%20what%20the%20underlying%20problem%20was%3F%20I%20have%20a%20very%20similar%20situation%20on%20an%20RT1020%20but%20I%20am%20not%20using%20Keil.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1249374%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1249374%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHi.%3C%2FP%3E%0A%3CP%3EDid%20you%20test%20this%20waveform%20using%20the%20routine%20test%20I%20shared%3F%20If%20not%2C%20please%20download%20my%20project%20directly%20and%20test%20it%20with%20MCUXpresso%20IDE.%3C%2FP%3E%0A%3CP%3EHave%20a%20great%20day%2C%20%3CBR%20%2F%3ETIC%3C%2FP%3E%0A%3CP%3E-------------------------------------------------------------------------------%20%3CBR%20%2F%3ENote%3A%20%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22%20Mark%20Correct%20%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%20%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20Please%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%20%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248556%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248556%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHave%20you%20ever%20sent%20the%20code%20and%20then%20reset%20it%20with%20the%20software%20in%20emulation%20before%20sending%20it%20again%3F%20When%20I%20run%20the%20code%20again%20after%20a%20software%20reset%20with%20KEIL%20it%20sends%20an%20incorrect%20number%20of%20pulses%2C%20the%20first%20time%20I%20run%20the%20code%20after%20powering%20up%20the%20board%20it%20sends%20the%20correct%20number%20of%20pulses.%3C%2FP%3E%3CP%3EAlso%20is%20it%20convenient%20for%20you%20to%20do%20a%20test%20with%20keil%3F%20Or%20take%20a%20look%20at%20the%20KEIL%20routine%20I%20sent%20you%20and%20test%20it%20with%20that.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248543%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248543%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%20%3CBR%20%2F%3EI%20am%20using%20MCUXpreeso%20IDE%2C%20because%20my%20output%20is%20in%20GPIO_AD_B1_00%2C%20J23-6%20in%20MIMXRT1050%2C%20so%20I%20need%20to%20initialize%20its%20related%20pins%2C%20the%20corresponding%20code%20is%20in%20BOARD_InitPins()%20function.%20%3CBR%20%2F%3EHave%20a%20great%20day%2C%20%3CBR%20%2F%3ETIC%3C%2FP%3E%0A%3CP%3E-------------------------------------------------------------------------------%20%3CBR%20%2F%3ENote%3A%20%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22%20Mark%20Correct%20%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%20%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20Please%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%20%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248125%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248125%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20found%20that%20the%20code%20downloaded%20to%20the%20board%20every%20time%20I%20press%20the%20board%20reset%20button%20the%20logic%20analyzer%20can%20catch%20the%20waveform%2C%20every%20time%20I%20press%20it%20the%20waveform%20and%20the%20number%20of%20pulses%20caught%20are%20correct%2C%20but%20in%20the%20keil%20debug%20state%20with%20the%20reset%20on%20the%20software%20at%20runtime%20with%20the%20logic%20analyzer%20the%20number%20of%20pulses%20caught%20will%20be%20one%20more%2C%20you%20can%20try%20it.%20You%20can%20try%20it%20and%20see%20what%20is%20the%20reason.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248119%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248119%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20can't%20get%20a%20waveform%20in%20the%20simulation%2C%20and%20I%20can%20catch%20the%20waveform%20with%20a%20manual%20reset%20of%20the%20board%2C%20but%20the%20waveform%20is%20also%20not%20correct%2C%20and%20the%20number%20of%20pulses%20is%20also%20not%20correct.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248112%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248112%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EBoard%20IMXRT1050-EVKB%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248109%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248109%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20pins%20are%20J23's%206%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248107%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248107%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%2F*%3CBR%20%2F%3E*%20Copyright%202017-2020%20NXP%3CBR%20%2F%3E*%20All%20rights%20reserved.%3CBR%20%2F%3E*%3CBR%20%2F%3E*%20SPDX-License-Identifier%3A%20BSD-3-Clause%3CBR%20%2F%3E*%2F%3C%2FP%3E%3CP%3E%2F*******************************************************************************%3CBR%20%2F%3E*%20Includes%3CBR%20%2F%3E******************************************************************************%2F%3CBR%20%2F%3E%23include%20%22fsl_debug_console.h%22%3CBR%20%2F%3E%23include%20%22board.h%22%3C%2FP%3E%3CP%3E%23include%20%22bsp_tmr.h%22%3CBR%20%2F%3E%2F%2F%23include%20%22fsl_qtmr.h%22%3C%2FP%3E%3CP%3E%23include%20%22pin_mux.h%22%3CBR%20%2F%3E%23include%20%22clock_config.h%22%3CBR%20%2F%3E%2F*******************************************************************************%3CBR%20%2F%3E*%20Definitions%3CBR%20%2F%3E******************************************************************************%2F%3CBR%20%2F%3E%2F*%20The%20QTMR%20instance%2Fchannel%20used%20for%20board%20*%2F%3CBR%20%2F%3E%23define%20BOARD_QTMR_BASEADDR%20TMR3%3CBR%20%2F%3E%23define%20BOARD_FIRST_QTMR_CHANNEL%20kQTMR_Channel_0%3CBR%20%2F%3E%23define%20BOARD_SECOND_QTMR_CHANNEL%20kQTMR_Channel_1%3CBR%20%2F%3E%23define%20QTMR_ClockCounterOutput%20kQTMR_ClockCounter0Output%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%2F*%20Interrupt%20number%20and%20interrupt%20handler%20for%20the%20QTMR%20instance%20used%20*%2F%3CBR%20%2F%3E%23define%20QTMR_IRQ_ID%20TMR3_IRQn%3CBR%20%2F%3E%23define%20QTMR_IRQ_HANDLER%20TMR3_IRQHandler%3C%2FP%3E%3CP%3E%2F*%20QTMR%20Clock%20source%20divider%20for%20Ipg%20clock%20source%2C%20the%20value%20of%20two%20macros%20below%20should%20be%20aligned.%20*%2F%3CBR%20%2F%3E%23define%20QTMR_PRIMARY_SOURCE%20(kQTMR_ClockDivide_128)%3CBR%20%2F%3E%23define%20QTMR_CLOCK_SOURCE_DIVIDER%20(128U)%3CBR%20%2F%3E%2F*%20The%20frequency%20of%20the%20source%20clock%20after%20divided.%20*%2F%3CBR%20%2F%3E%23define%20QTMR_SOURCE_CLOCK%20(CLOCK_GetFreq(kCLOCK_IpgClk)%20%2F%20QTMR_CLOCK_SOURCE_DIVIDER)%3C%2FP%3E%3CP%3E%2F*******************************************************************************%3CBR%20%2F%3E*%20Prototypes%3CBR%20%2F%3E******************************************************************************%2F%3C%2FP%3E%3CP%3E%2F*******************************************************************************%3CBR%20%2F%3E*%20Variables%3CBR%20%2F%3E******************************************************************************%2F%3C%2FP%3E%3CP%3Evolatile%20bool%20qtmrIsrFlag%20%3D%20false%3B%3C%2FP%3E%3CP%3E%2F*******************************************************************************%3CBR%20%2F%3E*%20Code%3CBR%20%2F%3E******************************************************************************%2F%3CBR%20%2F%3Evoid%20QTMR_IRQ_HANDLER(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%2F*%20Clear%20interrupt%20flag.*%2F%3CBR%20%2F%3EQTMR_ClearStatusFlags(BOARD_QTMR_BASEADDR%2C%20BOARD_SECOND_QTMR_CHANNEL%2C%20kQTMR_CompareFlag)%3B%3C%2FP%3E%3CP%3EqtmrIsrFlag%20%3D%20true%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%2F*!%3CBR%20%2F%3E*%20%40brief%20Main%20function%3CBR%20%2F%3E*%2F%3CBR%20%2F%3Eint%20main(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Euint32_t%20i%20%3D%200%3B%3CBR%20%2F%3Eqtmr_config_t%20qtmrConfig%3B%3C%2FP%3E%3CP%3Egpio_pin_config_t%20gpt_config%3B%3C%2FP%3E%3CP%3Egpt_config.direction%20%3D%20kGPIO_DigitalOutput%3B%3CBR%20%2F%3Egpt_config.outputLogic%20%3D%200%3B%3CBR%20%2F%3Egpt_config.interruptMode%20%3D%20kGPIO_NoIntmode%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%2F*%20Board%20pin%2C%20clock%2C%20debug%20console%20init%20*%2F%3CBR%20%2F%3EBOARD_ConfigMPU()%3B%3CBR%20%2F%3EBOARD_InitPins()%3B%3CBR%20%2F%3EBOARD_BootClockRUN()%3B%3CBR%20%2F%3EBOARD_InitDebugConsole()%3B%3C%2FP%3E%3CP%3EGPIO_PinInit(GPIO1%2C%2016%2C%20%26amp%3Bgpt_config)%3B%3C%2FP%3E%3CP%3EQTMR_GetDefaultConfig(%26amp%3BqtmrConfig)%3B%3C%2FP%3E%3CP%3E%2F*%20Initial%20the%20input%20channel.%20*%2F%3CBR%20%2F%3EqtmrConfig.primarySource%20%3D%20QTMR_PRIMARY_SOURCE%3B%3CBR%20%2F%3EQTMR_Init(BOARD_QTMR_BASEADDR%2C%20BOARD_SECOND_QTMR_CHANNEL%2C%20%26amp%3BqtmrConfig)%3B%3C%2FP%3E%3CP%3EIpFreq%3DCLOCK_GetFreq(kCLOCK_IpgClk)%3B%3CBR%20%2F%3E%2F%2FPlsueCh0Init()%3B%3CBR%20%2F%3EPulseChxStream_Init(TMR3%2CTMR3_IRQn%2C100000%2C4%2C1%2C0%2C0x0A67)%3B%3CBR%20%2F%3Efor(i%3D0%3Bi%26lt%3B100000000%3Bi%2B%2B)%3B%3C%2FP%3E%3CP%3EPulseChxStream_Init(TMR3%2CTMR3_IRQn%2C100000%2C4%2C1%2C0%2C0x0A67)%3B%3CBR%20%2F%3Efor(i%3D0%3Bi%26lt%3B100000000%3Bi%2B%2B)%3B%3C%2FP%3E%3CP%3EPulseChxStream_Init(TMR3%2CTMR3_IRQn%2C100000%2C4%2C1%2C0%2C0x0A67)%3B%3CBR%20%2F%3Efor(i%3D0%3Bi%26lt%3B100000000%3Bi%2B%2B)%3B%3C%2FP%3E%3CP%3EPulseChxStream_Init(TMR3%2CTMR3_IRQn%2C100000%2C4%2C1%2C0%2C0x0A67)%3B%3C%2FP%3E%3CP%3Ewhile%20(1)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%E6%88%91%E6%8A%8A%E6%82%A8%E7%9A%84%E4%BB%A3%E7%A0%81%E7%A7%BB%E6%A4%8D%E5%88%B0qtmr_timer%E7%9A%84%E4%BE%8B%E7%A8%8B%E9%87%8C%E6%9B%BF%E6%8D%A2%E6%8E%89%E6%BA%90%E6%96%87%E4%BB%B6%EF%BC%8C%E7%BC%96%E8%AF%91%E4%B8%8B%E8%BD%BD%E5%88%B0%E6%9D%BF%E5%8D%A1%E4%BB%BF%E7%9C%9F%EF%BC%8C%E7%94%A8%E9%80%BB%E8%BE%91%E5%88%86%E6%9E%90%E4%BB%AA%E6%8A%93%E5%8F%96%E4%B8%8D%E5%88%B0%E6%B3%A2%E5%BD%A2%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1248104%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1248104%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EAre%20you%20using%20KEIL%3F%20I%20have%20KEIL%205.27%2C%20how%20come%20I%20can't%20open%20your%20function%20file%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247962%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247962%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%20%3CBR%20%2F%3EI%20modified%20evkbimxrt1050_qtmr_timer%20code%20in%20SDK%20library%20to%20implement%20Pulse-Output%20Mode%20according%20to%20the%20code%20you%20shared%2C%20and%20the%20function%20is%20normal%20under%20test.%20%3CBR%20%2F%3EPWM%20output%20pin%20is%20GPIO_AD_B1_00%2C%20J23-6%20in%20MIMXRT1050.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jeremyzhou_0-1616056266688.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jeremyzhou_0-1616056266688.png%22%20style%3D%22width%3A%20381px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F140015iFA1B5EC05CEA8DC1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jeremyzhou_0-1616056266688.png%22%20alt%3D%22jeremyzhou_0-1616056266688.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAttached%20is%20my%20code.%3C%2FP%3E%0A%3CP%3EHave%20a%20great%20day%2C%20%3CBR%20%2F%3ETIC%3C%2FP%3E%0A%3CP%3E-------------------------------------------------------------------------------%20%3CBR%20%2F%3ENote%3A%20%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22%20Mark%20Correct%20%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%20%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20Please%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%20%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247805%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247805%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EKEIL%205.27%20development%20environment%20used%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247800%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247800%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20analyzer%20measures%20Pin6%20of%20GPIO2%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247752%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247752%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHi.%3C%2FP%3E%0A%3CP%3EPlease%20share%20the%20complete%20code%20project%20and%20I'll%20test%20it%20with%20a%20MIMXRT1050%20board%20to%20see%20if%20I%20can%20reproduce%20the%20problem.%3C%2FP%3E%0A%3CP%3EHave%20a%20great%20day%2C%20%3CBR%20%2F%3ETIC%3C%2FP%3E%0A%3CP%3E-------------------------------------------------------------------------------%20%3CBR%20%2F%3ENote%3A%20%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22%20Mark%20Correct%20%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%20%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20Please%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%20%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247133%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247133%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20trying%20to%20control%20the%20stepper%20motor%20in%20this%20way%20to%20do%20angle%20control%2C%20if%20the%20number%20of%20pulses%20sent%20is%20not%20correct%20it%20will%20definitely%20affect%20the%20accuracy%20of%20the%20motor%20rotation%20angle.%3C%2FP%3E%3CP%3EI've%20tested%20this%20over%20and%20over%20again%2C%20and%20I%20feel%20that%20QTMER%20channel%200%20is%20not%20turning%20off%20the%20output%20in%20time%20after%20the%20counting%20comparison%2C%20causing%20the%20output%20channel%20to%20send%20an%20extra%20pulse.%3C%2FP%3E%3CP%3EIt%20feels%20like%20it's%20still%20a%20problem%20with%20the%20chip's%20hardware%2C%20and%20my%20program%20follows%20the%20manual's%20examples%20to%20the%20letter.%20You%20can%20also%20use%201052-EVK%20to%20actually%20test%20it.%3C%2FP%3E%3CP%3EIf%20you%20have%20a%20code%20example%2C%20send%20it%20to%20me%20and%20I'll%20test%20it%20with%20a%20logic%20analyzer.%3C%2FP%3E%3CP%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247125%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247125%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%20this%20is%20not%20a%20regular%20occurrence%2C%20sometimes%20the%20correct%20number%20is%20sent%2C%20sometimes%20it's%20just%20wrong%20for%20several%20times%20in%20a%20row%20(always%201%20more).%3C%2FP%3E%3CP%3EThere%20will%20also%20be%20times%20when%20you%20will%20send%20the%20right%20quantity%20once%2C%20and%20then%20send%20it%20again%20with%20one%20more%20quantity%2C%20and%20so%20on%20alternately.%3C%2FP%3E%3CP%3EHowever%2C%20each%20time%20you%20reset%20the%20chip%20the%20first%20time%20you%20send%20the%20quantity%20is%20correct%2C%20after%20sending%20it%20once%20it%20is%20not%20correct.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1247061%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1247061%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHi.%3C%2FP%3E%0A%3CP%3EDo%20the%20multiple%20discoveries%20you%20are%20talking%20about%20happen%20every%20time%3F%20Or%20is%20there%20a%20fixed%20rate%20or%20order%20of%20occurrence%3F%3C%2FP%3E%0A%3CP%3EHave%20a%20great%20day%2C%20%3CBR%20%2F%3ETIC%3C%2FP%3E%0A%3CP%3E-------------------------------------------------------------------------------%20%3CBR%20%2F%3ENote%3A%20%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22%20Mark%20Correct%20%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%20%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20Please%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%20%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245327%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245327%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20set%20LENGTH%3D0%20to%20read%20the%20value%20in%20the%20CNTR%20after%20the%20send%20is%20complete%2C%20LENGTH%3D1%20would%20have%20the%20CNTR%20preloaded%20with%20the%20new%20value%20as%20soon%20as%20the%20counting%20is%20complete%2C%20so%20that%20the%20value%20would%20not%20be%20read.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245323%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245323%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%3A%20After%20I%20set%20LENGTH%3D1%20the%20count%20is%20still%20incorrect%2C%20sometimes%20it%20sends%201%20more%20pulse%2C%20and%20repeated%20tests%20the%20pulse%20will%20only%20send%20more%20and%20not%20less.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245300%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245300%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3EThank%20you%20for%20your%20interest%20in%20NXP%20Semiconductor%20products%20and%20for%20the%20opportunity%20to%20serve%20you.%3CBR%20%2F%3EAfter%20going%20through%20your%20demo%20code%2C%20it's%20basic%20as%20same%20as%20the%20code%20in%20the%20RM%20(as%20the%20figures%20show).%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jeremyzhou_1-1615775707524.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jeremyzhou_1-1615775707524.png%22%20style%3D%22width%3A%20357px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F139567iE6F84F3CC7B498BF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jeremyzhou_1-1615775707524.png%22%20alt%3D%22jeremyzhou_1-1615775707524.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CBR%20%2F%3EAnd%20I%20find%20that%20the%20below%20code%20is%20inconsistent%20with%20the%20comment%2C%20so%20please%20check%20it%20carefully.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%2F%2F%20%E5%AE%9A%E6%97%B6%E5%99%A83%E7%9A%84%E8%BE%93%E5%87%BA%E6%98%AF%E8%AF%A5%E5%AE%9A%E6%97%B6%E5%99%A8%E7%9A%84%E6%97%B6%E9%92%9F%E6%BA%90%E3%80%82%0A%2F*%20TMR1_CTRL%3A%20CM%3D0%2CPCS%3D7%2CSCS%3D0%2CONCE%3D1%2CLENGTH%3D1%2CDIR%3D0%2CCOINIT%3D0%2COUTMODE%3D7%20*%2F%0ATIMx-%26gt%3BCHANNEL%5BOutChanel%5D.CTRL%3DOutMode%3B%20%2F*%200x0A47%20%E8%AE%BE%E7%BD%AE%E6%A8%A1%E5%BC%8F%20TMR3%E7%9A%84%E5%AE%9A%E6%97%B6%E5%99%A81%E4%BD%9C%E4%B8%BA%E9%80%9A%E9%81%930%E7%9A%84%E6%97%B6%E9%92%9F%E6%BA%90%20*%2F%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3EHave%20a%20great%20day%2C%3CBR%20%2F%3ETIC%3C%2FP%3E%0A%3CP%3E-------------------------------------------------------------------------------%3CBR%20%2F%3ENote%3A%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22Mark%20Correct%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245187%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245187%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3E47.6.5.12%20Pulse-Output%20Mode%20used%3C%2FP%3E%3CP%3EThis%20routine%20used%3C%2FP%3E%3CP%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.CTRL%20%26amp%3B%3D~TMR_CTRL_CM_MASK%3B%20%2F*%20reset%20counter%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.CTRL%20%26amp%3B%3D~TMR_CTRL_CM_MASK%3B%20%2F*%20reset%20timer%20*%2F%20%3CBR%20%2F%3E%2F%2F%20select%20IP_bus_clk%20%2F%2016%20as%20the%20clock%20source%20for%20Timer%203%20%3CBR%20%2F%3E%2F*%20TMR3_CTRL%3A%20CM%20%3D%200%2C%20PCS%20%3D%200x0C%2C%20SCS%20%3D%200%2C%20ONCE%20%3D%200%2C%20LENGTH%20%3D%201%2C%20DIR%20%3D%200%2C%20COINIT%20%3D%200%2C%20OUTMODE%20%3D%203%20*%2F%20%3CBR%20%2F%3E%2F%2F%20TMR3-%20%26gt%3BCHANNEL%5B1%5D.COMP1%3DCLOCK_GetFreq(kCLOCK_%20IpgClk)%2F128%2FPlusefreq%3B%20%2F*%20(16%20*%2037500)%20%2F%2060e6%20%3D%200.01%20sec%20*%2F%20%3CBR%20%2F%3Eif(Plusefreq%20%26lt%3B10000)%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.CTRL%3D0x1E23%3B%20%2F*%20Set%20mode%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5B%20TimChanel%5D.COMP1%3DIpFreq%2F128%2F(Plusefreq)%3B%20%3CBR%20%2F%3E%7D%20%3CBR%20%2F%3Eelse%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.CTRL%3D0x1023%3B%20%2F*%20set%20mode%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.COMP1%3DIpFreq%2F1%20%2F(Plusefreq)%3B%20%3CBR%20%2F%3E%7D%20%3CBR%20%2F%3E%2F*%20TMR3_SCTRL%3A%20TCF%20%3D%200%2C%20TCFIE%20%3D%200%2C%20TOF%20%3D%200%2C%20TOFIE%20%3D%200%2C%20IEF%20%3D%200%2C%20IEFIE%20%3D%200%2C%20IPS%20%3D%200%2C%20INPUT%20%3D%200%2C%20%3CBR%20%2F%3EFunctional%20Description%20%3CBR%20%2F%3ECapture_Mode%20%3D%200%2C%20MSTR%20%3D%200%2C%20EEOF%20%3D%200%2C%20VAL%20%3D%200%2C%20FORCE%20%3D%200%20%2C%20OPS%20%3D%200%2C%20OEN%20%3D%200%20%3CBR%20%2F%3E*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.SCTRL%3D0x00%3B%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.%20LOAD%3D0x00%3B%20%2F*%20Reset%20load%20register%20*%2F%20%3CBR%20%2F%3E%2F*%20TMR3_CSCTRL%3A%20DBG_EN%3D0%2CFAULT%3D0%2CALT_LOAD%3D0%2CROC%3D0%2CTCI%3D0%2CUP%3D0%2COFLAG%3D0%2C%20%3CBR%20%2F%3ETCF2EN%3D0%2CTCF1EN%3D0%2CTCF2%3D0%2CTCF1%3D0%2CCL2%3D0%2CCL1%3D%200%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.CSCTRL%3D0x00%3B%20%2F*%20Set%20Comparator%20Control%20Register%20*%2F%20%3CBR%20%2F%3E%2F%2F%20The%20output%20of%20Timer%203%20is%20the%20clock%20source%20for%20this%20timer.%20%3CBR%20%2F%3E%2F*%20TMR1_CTRL%3A%20CM%3D0%2CPCS%3D7%2CSCS%3D0%2CONCE%3D1%2CLENGTH%3D1%2CDIR%3D0%2CCOINIT%3D0%2COUTMODE%3D7%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.CTRL%3DOutMode%3B%20%2F*%200x0A47%20Setting%20Mode%20Timer1%20of%20TMR3%20as%20clock%20source%20for%20channel%200%20*%2F%20%3CBR%20%2F%3E%2F*%20TMR1_SCTRL%3A%20TCF%3D0%2CTCFIE%3D0%2CTOF%3D0%2CTOFIE%3D0%2CIEF%3D0%2CIEFIE%3D0%2CIPS%3D0%2CINPUT%3D0%2C%20%3CBR%20%2F%3ECapture_Mode%3D0%2CMSTR%3D0%2CEEOF%3D0%2CVAL%3D0%2CFORCE%3D0%2COPS%3D0%2C%20OEN%3D1%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.SCTRL%3D0x0001%3B%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.CNTR%3D0x00%3B%20%2F*%20Reset%20counter%20register%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.LOAD%3D0x00%3B%20%2F*%20Reset%20Load%20register%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.COMP1%3DPluseData%3B%20%2F*%20Set%20compare%201%20register%20Number%20of%20pulses%20to%20output%20*%2F%20%3CBR%20%2F%3E%2F%2F%20Set%20to%20interrupt%20after%20last%20pulse%20%3CBR%20%2F%3E%2F*%20TMR1_CSCTRL%3A%20DBG_EN%3D0%2CFAULT%3D0%2CALT_LOAD%3D0%2CROC%3D0%2C%20TCI%3D0%2CUP%3D0%2COFLAG%3D0%2C%20%3CBR%20%2F%3ETCF2EN%3D0%2CTCF1EN%3D1%2CTCF2%3D0%2CTCF1%3D0%2CCL2%3D0%2CCL1%3D0%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.CSCTRL%3D0x40%3B%20%2F*%20Set%20Comparator%20Control%20Register%20*%2F%20%3CBR%20%2F%3E%2F%2F%20Finally%2C%20start%20the%20counter%20running%20%3CBR%20%2F%3ETIMx%20-%20%26gt%3BCHANNEL%5BTimChanel%5D.%20CNTR%3D0%3B%20%2F*%20Reset%20counter%20*%2F%20%3CBR%20%2F%3E%2F%2F%20%2F*%20Set%20interrupt%20priority%2C*%2F%20%3CBR%20%2F%3E%2F%2F%20set_IRQn_Priority(IRQn%2CGroup4_PreemptPriority_6%2C%20Group4_SubPriority_0)%3B%20%3CBR%20%2F%3E%2F%2F%20%2F%2F%20%2F*%20Turn%20on%20interrupt%20*%2F%20%3CBR%20%2F%3E%2F%2F%20EnableIRQ(IRQn)%3B%20%3CBR%20%2F%3E%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BOutChanel%5D.CTRL%7C%3D(1%20%26lt%3B%26lt%3B%2013)%3B%20%2F*%20Run%20counter%20*%2F%20%3CBR%20%2F%3ETIMx-%20%26gt%3BCHANNEL%5BTimChanel%5D.CTRL%7C%3D(1%20%26lt%3B%26lt%3B%2013)%3B%20%2F*%20Run%20source%20clock%20counter%20*%2F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EHere's%20the%20routine%20I%20changed.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245186%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245186%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Example%3A%2047.6.5.12.1%20Pulse%20Outputs%20Using%20Two%20Counters%20%2F%2F%20(See%20Processor%20Expert%20PulseStream%20bean.)%20%2F%2F%20This%20example%20generates%20six%2010ms%20pulses%2C%20from%20QT1%20output.%20%2F%2F%20Assuming%20the%20chip%20is%20operating%20at%2060%20MHz.%20%2F%2F%20%2F%2F%20To%20do%20this%2C%20timer%203%20is%20used%20to%20generate%20a%20clock%20with%20a%20period%20of%2010ms.%20%2F%2F%20%2F%2F%20Timer%201%20is%20used%20to%20gate%20these%20clocks%20and%20count%20the%20number%20of%20pulses%20that%20have%20%2F%2F%20been%20generated.%20%2F%2F%20void%20PulseStream_Init(void)%20%7B%20%2F%2F%20Select%20IP_bus_clk%2F16%20as%20the%20clock%20source%20for%20Timer%203%20%2F*%20TMR3_CTRL%3A%20CM%3D0%2CPCS%3D0x0C%2CSCS%3D0%2CONCE%3D0%2CLENGTH%3D1%2CDIR%3D0%2CCOINIT%3D0%2COUTMODE%3D3%20*%2F%20setReg(TMR3_CTRL%2C0x1823)%3B%20%2F*%20Set%20up%20mode%20*%2F%20%2F*%20TMR3_SCTRL%3A%20TCF%3D0%2CTCFIE%3D0%2CTOF%3D0%2CTOFIE%3D0%2CIEF%3D0%2CIEFIE%3D0%2CIPS%3D0%2CINPUT%3D0%2C%20Functional%20Description%20i.MX%20RT1050%20Processor%20Reference%20Manual%2C%20Rev.%201%2C%2003%2F2018%202726%20NXP%20Semiconductors%20Capture_Mode%3D0%2CMSTR%3D0%2CEEOF%3D0%2CVAL%3D0%2CFORCE%3D0%2COPS%3D0%2COEN%3D0%20*%2F%20setReg(TMR3_SCTRL%2C0x00)%3B%20setReg(TMR3_LOAD%2C0x00)%3B%20%2F*%20Reset%20load%20register%20*%2F%20setReg(TMR3_COMP1%2C37500)%3B%20%2F*%20(16%20*%2037500%20)%20%2F%2060e6%20%3D%200.01%20sec%20*%2F%20%2F*%20TMR3_CSCTRL%3A%20DBG_EN%3D0%2CFAULT%3D0%2CALT_LOAD%3D0%2CROC%3D0%2CTCI%3D0%2CUP%3D0%2COFLAG%3D0%2C%20TCF2EN%3D0%2CTCF1EN%3D0%2CTCF2%3D0%2CTCF1%3D0%2CCL2%3D0%2CCL1%3D0%20*%2F%20setReg(TMR3_CSCTRL%2C0x00)%3B%20%2F*%20Set%20up%20comparator%20control%20register%20*%2F%20%2F%2F%20Timer%203%20output%20is%20the%20clock%20source%20for%20this%20timer.%20%2F*%20TMR1_CTRL%3A%20CM%3D0%2CPCS%3D7%2CSCS%3D0%2CONCE%3D1%2CLENGTH%3D1%2CDIR%3D0%2CCOINIT%3D0%2COUTMODE%3D7%20*%2F%20setReg(TMR1_CTRL%2C0x0E67)%3B%20%2F*%20Set%20up%20mode%20*%2F%20%2F*%20TMR1_SCTRL%3A%20TCF%3D0%2CTCFIE%3D0%2CTOF%3D0%2CTOFIE%3D0%2CIEF%3D0%2CIEFIE%3D0%2CIPS%3D0%2CINPUT%3D0%2C%20Capture_Mode%3D0%2CMSTR%3D0%2CEEOF%3D0%2CVAL%3D0%2CFORCE%3D0%2COPS%3D0%2COEN%3D1%20*%2F%20setReg(TMR1_SCTRL%2C0x01)%3B%20setReg(TMR1_CNTR%2C0x00)%3B%20%2F*%20Reset%20counter%20register%20*%2F%20setReg(TMR1_LOAD%2C0x00)%3B%20%2F*%20Reset%20load%20register%20*%2F%20setReg(TMR1_COMP1%2C0x04)%3B%20%2F*%20Set%20up%20compare%201%20register%20*%2F%20%2F%2F%20set%20to%20interrupt%20after%20the%20last%20pulse%20%2F*%20TMR1_CSCTRL%3A%20DBG_EN%3D0%2CFAULT%3D0%2CALT_LOAD%3D0%2CROC%3D0%2CTCI%3D0%2CUP%3D0%2COFLAG%3D0%2C%20TCF2EN%3D0%2CTCF1EN%3D1%2CTCF2%3D0%2CTCF1%3D0%2CCL2%3D0%2CCL1%3D0%20*%2F%20setReg(TMR1_CSCTRL%2C0x40)%3B%20%2F*%20Set%20up%20comparator%20control%20register%20*%2F%20%2F%2F%20Finally%2C%20start%20the%20counters%20running%20setReg(TMR3_CNTR%2C0)%3B%20%2F*%20Reset%20counter%20*%2F%20setRegBitGroup(TMR3_CTRL%2CCM%2C0x01)%3B%20%2F*%20Run%20source%20clock%20counter%20*%2F%20setRegBitGroup(TMR1_CTRL%2CCM%2C0x01)%3B%20%2F*%20Run%20counter%20*%2F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245185%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%E4%BD%BF%E7%94%A8QTMER%20%E8%84%89%E5%86%B2%E8%BE%93%E5%87%BA%E5%8A%9F%E8%83%BD%E8%84%89%E5%86%B2%E6%95%B0%E5%A4%9A%E5%8F%91%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245185%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20need%20to%20send%20the%20exact%20number%20of%20pulses%20to%20control%20the%20stepper%20motor%20to%20rotate%20at%20a%20certain%20angle%2C%20the%20number%20of%20pulses%20sent%20should%20not%20be%20too%20much%20or%20too%20little%20so%20that%20the%20angle%20is%20accurate.%3C%2FP%3E%3CP%3EI%20now%20realize%20the%2010HZ-500KHZ%20frequency%20send%2C%20is%20the%20number%20of%20pulses%20have%20more%20than%20one%20phenomenon%2C%20interrupting%20the%20debugging%20point%20feel%20is%20the%20manual%20routine%20TMR1%20shutdown%20is%20not%20timely%20caused%20by%20more%20than%20one%2C%20monitor%20the%20value%20of%20CNTR%20and%20compare%20the%20value%20of%20the%20register%20is%20the%20same%2C%20there%20is%20a%20head%20nodding%20don't%20know%20what%20the%20problem%20is%2C%20please%20point%20out.%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E