Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Continuous scan for fast timer interrupt


TomWind Mar 22, 2019 03:47 PM

Hello, 

I have two sensors of 220Hz and I need timing even more fast/precise than that. I am writing my first CRBasic program, how do I continuously scan? The instruction I've seen is Scan/Next Scan but the fastest scan is in milliseconds. I would like something which continuously scans as fast as the processor can run so I can pick up the edges. I am using the instruction TimerInput to read the digital PWM from my sensors. Or is TimerInput implemented with interrupts?


JDavis Mar 26, 2019 01:47 PM

TimerInput is handled by a coprocessor. So, it can measure frequencies faster than your scan rate.


TomWind Mar 27, 2019 02:03 PM

Hi JDavis

Thanks for your response, that makes sense. A followup question I have, which is related, is the repetition of the TimerInput instruction.

The way I envision TimerInput working is it running continuously: at every edge the time is written to storage. For my application this should be 220 edges/second, running and writing data for hours.

However, the documentation doesn't indicate this. The way I interpret the documentation is that the 'Dest' parameter is a 1D array, meaning only one measurement is written to it, once, then the instruction is terminated.

How do I get this instruction to write continuously to a 2D array? I don't think I can do it by running lots of scans and repeating every scan, because scans are every 1mS but this has to run more frequently than that.

Many thanks

Log in or register to post/reply in the forum.