Go to Post "What other program puts these role models on a first name basis with teenagers?" - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-02-2013, 17:36
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 25-02-2013, 17:44
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to read a pulse?

Quote:
Originally Posted by enrique View Post
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.


Reply With Quote
  #3   Spotlight this post!  
Unread 01-03-2013, 23:56
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Re: How to read a pulse?

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.
Attached Files
File Type: cpp GP2Y0D805Z0F.cpp (1.4 KB, 13 views)
File Type: h GP2Y0D805Z0F.h (625 Bytes, 10 views)
File Type: pdf GP2Y0D805Z0F.pdf (59.7 KB, 25 views)
Reply With Quote
  #4   Spotlight this post!  
Unread 02-03-2013, 00:50
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to read a pulse?

Quote:
Originally Posted by enrique View Post
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.


Reply With Quote
  #5   Spotlight this post!  
Unread 02-03-2013, 09:46
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Post Re: How to read a pulse?

Guess its corrupt. Here it is again.
Attached Files
File Type: pdf GP2Y0D805Z0F.pdf (365.3 KB, 15 views)
Reply With Quote
  #6   Spotlight this post!  
Unread 02-03-2013, 10:25
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to read a pulse?

Quote:
Originally Posted by enrique View Post
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.


Reply With Quote
  #7   Spotlight this post!  
Unread 02-03-2013, 10:32
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-03-2013, 10:47
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to read a pulse?

Quote:
Originally Posted by enrique View Post
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.


Reply With Quote
  #9   Spotlight this post!  
Unread 02-03-2013, 10:56
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,587
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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?
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #10   Spotlight this post!  
Unread 03-03-2013, 22:15
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:55.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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