Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   How to read a pulse? (http://www.chiefdelphi.com/forums/showthread.php?t=114362)

enrique 25-02-2013 17:36

How to read a pulse?
 
I would like to know how to read a pulse width with the digital sidecar DIO. Any one know how to do this?

Ether 25-02-2013 17:44

Re: How to read a pulse?
 
Quote:

Originally Posted by enrique (Post 1240282)
I would like to know how to read a pulse width with the digital sidecar DIO. Any one know how to do this?

Can you give a bit more detail about why you want to do this, what type of sensor you are getting the signal from, what is the range of widths you want to measure, and what is the period of the pulses ? It has a bearing on the answer.



enrique 01-03-2013 23:56

Re: How to read a pulse?
 
3 Attachment(s)
ok here is the code and the spec. I threw something together using timers, but I was wondering if there is a better way. This is basically using PWM.

Ether 02-03-2013 00:50

Re: How to read a pulse?
 
Quote:

Originally Posted by enrique (Post 1242243)
ok here is the code and the spec. I threw something together using timers, but I was wondering if there is a better way. This is basically using PWM.

Try opening the "PDF" file you attached.



enrique 02-03-2013 09:46

Re: How to read a pulse?
 
1 Attachment(s)
Guess its corrupt. Here it is again.

Ether 02-03-2013 10:25

Re: How to read a pulse?
 
Quote:

Originally Posted by enrique (Post 1242317)
Guess its corrupt. Here it is again.

What are you trying to use this for ?

Please give some details about what you want to accomplish.



enrique 02-03-2013 10:32

Re: How to read a pulse?
 
One application is to see if something is there. That works good with this code. But I would like to use it to see frisbees going by and knowing if they are backwards or not. There is a problem with using that code for distance. For example if I put "Wait(0.05);", then it changes my values.

Ether 02-03-2013 10:47

Re: How to read a pulse?
 
Quote:

Originally Posted by enrique (Post 1242333)
One application is to see if something is there. That works good with this code. But I would like to use it to see frisbees going by and knowing if they are backwards or not. There is a problem with using that code for distance. For example if I put "Wait(0.05);", then it changes my values.

Can you be just a bit more articulate? I could guess what you mean, but I'd probably guess wrong.



Kevin Sevcik 02-03-2013 10:56

Re: How to read a pulse?
 
If I'm reading that datasheet correctly (it's hard to be certain of that), then your sensor there is just a simple proximity sensor. It will only switch on when an object is in detection range, and off when it's not. There's no pulsing or anything to indicate the actual distance of the object. Atleast, I don't see any indication of that, for all that it talks about triangulation. Do you have some way of measuring the output to confirm that it's giving you a PWM signal and not just off-on?

enrique 03-03-2013 22:15

Re: How to read a pulse?
 
I'm using it as proximity now. I love the size! I have a few of these. If I print the "Get" function then i get a number that goes up and down according to distance from the sensor. However, the values change according to how long the loop takes. So if I add a "wait" to the teleop loop, the values from the sensor change because I'm taking too long to read the pulses to accurately measure the off time.


All times are GMT -5. The time now is 12:41.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi