PulseIn function
- arthuki
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
23 Oct 2016 20:27 #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 or Create an account to join the conversation.
- andypugh
- Away
- Moderator
Less
More
- Posts: 23558
- Thank you received: 4858
23 Oct 2016 21:36 #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 or Create an account to join the conversation.
- arthuki
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
23 Oct 2016 21:42 #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 or Create an account to join the conversation.
- andypugh
- Away
- Moderator
Less
More
- Posts: 23558
- Thank you received: 4858
23 Oct 2016 21:59 #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 or Create an account to join the conversation.
- arthuki
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
24 Oct 2016 22:13 #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 or Create an account to join the conversation.
- andypugh
- Away
- Moderator
Less
More
- Posts: 23558
- Thank you received: 4858
25 Oct 2016 10:25 #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 or Create an account to join the conversation.
- arthuki
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
25 Oct 2016 18:29 #82051
by arthuki
Replied by arthuki on topic PulseIn function
Yeah, maybe.
Thank you anyway Andypugh
Thank you anyway Andypugh
Please Log in or Create an account to join the conversation.
Time to create page: 0.075 seconds