- Posts: 4
- Thank you received: 0
PulseIn function
10 years 1 week ago #81971
by arthuki
PulseIn function was created by arthuki
Hey everyone,
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 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.
Please Log in to join the conversation.
10 years 1 week ago #81974
by andypugh
Replied by andypugh on topic PulseIn function
This seems rather off-topic for the LinuxCNC forums.
But:
The Arduino code is here:
github.com/arduino/Arduino/blob/master/h...wiring_pulse.cpp#L30
But I doubt that it will really translate easily to BBB as I anticipate it uses a hardware timer in the microprocessor.
What time resolution do you need?
I can imagine ways to do this with LinuxCNC HAL, but it's a rather heavyweight package just to measure a pulse.
(Unless you are already using LinuxCNC and this timing needs to be done in a LinuxCNC context)
But:
The Arduino code is here:
github.com/arduino/Arduino/blob/master/h...wiring_pulse.cpp#L30
But I doubt that it will really translate easily to BBB as I anticipate it uses a hardware timer in the microprocessor.
What time resolution do you need?
I can imagine ways to do this with LinuxCNC HAL, but it's a rather heavyweight package just to measure a pulse.
(Unless you are already using LinuxCNC and this timing needs to be done in a LinuxCNC context)
Please Log in to join the conversation.
10 years 1 week ago #81975
by arthuki
Replied by arthuki on topic PulseIn function
Andypugh, thank you for the answer.
I need a resolution of about a few microseconds.
I have tried translating the code from arduino to C++ but as you said, it uses many of other arduino "built-in" functions.
I need a resolution of about a few microseconds.
I have tried translating the code from arduino to C++ but as you said, it uses many of other arduino "built-in" functions.
Please Log in to join the conversation.
10 years 1 week ago #81976
by andypugh
Replied by andypugh on topic PulseIn function
You might be able to do it with the Beaglebone PRU, but I think that the only expertise with that is on the Machinekit project. You could try asking there?
Please Log in to join the conversation.
10 years 6 days ago #82015
by arthuki
Replied by arthuki on topic PulseIn function
Thank you all for the great answers. I believe that the best way will be through PRU. But I was thinking, what if I used PWM reading libraries (black lib for example) on this square wave?
Any thoughts?
Any thoughts?
Please Log in to join the conversation.
10 years 5 days ago #82032
by andypugh
Replied by andypugh on topic PulseIn function
I really think you are asking in the wrong place, to be honest.
Please Log in to join the conversation.
Time to create page: 0.288 seconds
