I am tryng to capture tacho signal form a dc fan. But i am not able to capture the respective count of each rising edges.However i understand i need to take first rising edge counter value then 2nd ising edge counter value and then deducted Hiher valiue form Lower count value.
I am very beginner. If anyone please help me with code to capture external signal. Thanks in advance.
Regard's
David
Hi @DavidChang0
To the RT1050 QTMR capture, please refer to our SDK code:
SDK_2_10_0_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\qtmr\inputcapture_outputpwm
This project contains the capture function, you can refer to the code.
SDK code can be downloaded from this link:
Wish it helps you!
If you still have questions about it, please kindly let me know.
Best Regards,
kerry
Hello Kerryzhou
Thank yoou for quick response. I have downloaded the sdk example, but this example doesn't continuously capture the external signal. I can't measure the signal peridod. It's only count the one count value as i need two count value of counter in each rising edge of external signal. Then i can subtract the 1st count value from 2nd count value and through calculation i can get signal period.
So how can i contnaously capture external siganl? Please help. Thanks in advance.
Best Reagrd's
David
Hi @DavidChang0
Of course, you can continuously capture the input wave.
You can see, this code limit just get the timecapt:
while (count < 5 || timeCapt == 0)
{
while (!(qtmrIsrFlag))
{
}
qtmrIsrFlag = false;
count++;
timeCapt = BOARD_QTMR_BASEADDR->CHANNEL[BOARD_QTMR_INPUT_CAPTURE_CHANNEL].CAPT;
}
So, if you want to continuously capture, you can always read the CAPT data after the interrupt happens.
Please read the RM QTMR about the capture at first, you will be more clear about the code, you can modify the code by yourself to meet your own demand.
Best Regards,
Kerry