Go to Post I don't think FIRST is the reason for following rules, being respectful, etc. We should do that anyway. - Dan Zollman [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-03-2007, 22:50
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Cool pulsing digital out pins, not as fast as pwms

Anyone know a code for pulsing digital out pins? sort of like pwm signals....when the on time is constant but the off time can be adjusted? I am inputing an anolog signal so it controls the length of the off pulses...
  #2   Spotlight this post!  
Unread 29-03-2007, 22:58
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: pulsing digital out pins, not as fast as pwms

You may want to look into Kevin Watson's PWM replacement code.
http://www.chiefdelphi.com/forums/sh...ad.php?t=51802
__________________
Eric Haskins KC9JVH
  #3   Spotlight this post!  
Unread 29-03-2007, 23:11
The Lucas's Avatar
The Lucas The Lucas is offline
CaMOElot, it is a silly place
AKA: My First Name is really "The" (or Brian)
FRC #0365 (The Miracle Workerz); FRC#1495 (AGR); FRC#4342 (Demon)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Dela-Where?
Posts: 1,564
The Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond repute
Send a message via AIM to The Lucas
Re: pulsing digital out pins, not as fast as pwms

what kind of time scale do you need (ie how long on and off)? There are really 2 methods I can think of:
Timers and interrupts (using this Kevin code as base)
User controlled custom PWMs (using this Kevin code as base)

There is always good code at Kevin's Repository.
Depending on your application one of these options is better. Can you explain your application more precisely?

NOTE: the interrupt code is old (last processor) but still decent for copying the the timers interrupt and initialization code
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"
  #4   Spotlight this post!  
Unread 01-04-2007, 17:26
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Re: pulsing digital out pins, not as fast as pwms

Those codes are complicated,..need more time to learn that stuff hahaa.
  #5   Spotlight this post!  
Unread 01-04-2007, 18:45
SgtMillhouse648's Avatar
SgtMillhouse648 SgtMillhouse648 is offline
Registered User
AKA: Malhon Godwin
FRC #0648 (QC Elite)
Team Role: Engineer
 
Join Date: Apr 2006
Rookie Year: 2005
Location: Davenport, IA
Posts: 153
SgtMillhouse648 has a spectacular aura aboutSgtMillhouse648 has a spectacular aura about
Send a message via MSN to SgtMillhouse648
Re: pulsing digital out pins, not as fast as pwms

i dont know if you could do it on a loop count basis, have it increment a counter each time through the loop, and then once it is within a certain range set a digout equal to one? something like

if(counter < 5)
{
counter = counter + 1;
rcdigout01 = 0;
}
elseif(5 <= counter <= 7)
{
counter = counter + 1;
rcdigout01 = 1;
}
else
{
counter = 0
rcdigout01 = 0
}


will this work? I know we did a thing like this when we were working on a delay in our camera search routine to make it pause in between movements

Malhon
__________________
2007-
Midwest Regional-
Regional Finalists with 1000 and 447
Rockwell Automation Inspiration in Control Award
Regional Woodie Flowers - Ed Wegscheid



  #6   Spotlight this post!  
Unread 02-04-2007, 18:52
ericand's Avatar
ericand ericand is offline
Registered User
AKA: Eric Anderson
FRC #3765 (Terrabots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: St. Paul, MN
Posts: 148
ericand is a jewel in the roughericand is a jewel in the roughericand is a jewel in the rough
Re: pulsing digital out pins, not as fast as pwms

Quote:
Originally Posted by Generalx5 View Post
Anyone know a code for pulsing digital out pins? sort of like pwm signals....when the on time is constant but the off time can be adjusted? I am inputing an anolog signal so it controls the length of the off pulses...
When are you reading the analog signal? How are you reading it?

If you are reading the analog signal using the default get_analog_value()
continuously as you try to pulse the digital I/O pins, you may be getting into trouble due to the delays that the get_analog... puts in while it waits for the A/D conversion. You can eliminate most of the delay by using Kevin's A/D converter which uses the A/D conversion interrupt and a timer to run the conversion continuously in the background.

If you are only checking the analog value once in a while, then using Kevin's A/D code would not be of as much benefit.
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PWMs not outputting in Autonomous 937Programmers Programming 15 08-02-2007 21:25
pic: Pins Pins and more pins CD47-Bot Extra Discussion 26 04-09-2005 23:07
Inversion of the digital IO pins ConKbot of Doom Programming 5 25-02-2005 12:41
digital inputs not valid just after initialization? WizardOfAz Programming 2 26-01-2004 13:21
Drill Motors: Pins IN or Pins OUT Caleb Fulton Motors 28 03-02-2003 14:19


All times are GMT -5. The time now is 05:51.

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