I have a project with a LM555 timer and need to calculate how much time it takes for an input to go from LOW to HIGH and then to LOW again.
Basically, I want to know the period of a square wave generated by the LM555 timer.
I did it with Arduino using the function Pulseln. But I need to do this using a Beaglebone and programming in C++ (Using QtCreator).
Is there a way to “open” the function PulseIn so I know what it does? Moreover, do you guys have any piece of code that might help me?
Thank you in advance.
I think , there is no direct substitute to pulseIn()
you can catch the timing using two methods
Polling → under Linux application environment “mmap()” the GPIO Registers ,Set the MUX register to input mode & start polling the Input status .
Interrupt → under linux , mmap the gpio registers , Enable Falling/edge detect interrupt ( refer the datasheet for base address), subscribe to that interrupt number “request_irg()”… Caclulate the time difference between 2 low/high interrupts… use clock_gettime()
Note : Polling method eats your CPU Cycles…
Under any OS environment ,1ms latency is guaranteed, so you might not be able to get the exact timing if the pulse width is less than 1ms/1khz … (exception is hardware based time stamping)
So if you want the exact value , you have to use baremetal coding … but no QT
In oscilloscope, they use High speed ADC (1Gs/s) & FPGA for buffering … Linux UI interacts with FPGA…