View Single Post
  #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.