View Single Post
  #8   Spotlight this post!  
Unread 06-08-2010, 16:10
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,392
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Delay10KTCYx in C18

The problem is that the buttons go from approximately 0 to ~255 and it's the approximate part that is the issue.

Try:
Code:
if (signal < 20){  
  pwm02=127;
  pwm03=127;
}
The other button would be
Code:
if (signal > 235){
  pwm02=127;  
  pwm03=127; 
}
While it's supposed to be zero, there are analog components in the circuit, and they could be adding just a little resistance to the circuit to make it not be exactly zero. You could print the value of signal out to see what it really is.

The 18.5 ms has to do with how long it takes the control signals from the transmitter to get to the master CPU. The signals from the transmitters are PWM with a fixed length channel. On my wiki there is the following note that I've copied from someone named Tinkerman.

Quote:
The measured separation pulse (high pulse) is a fixed 400usec long. Pushing the stick up shortens the channel's "low" pulse about 400usec.

Pushing the stick down lengthens the pulse about 420usec.

No deflection on the stick gives a 1.12msec low pulse (for a total of 1.52msec from the beginning of the separation pulse.)

Every five counts of channel trim adjusts the pulse length 6usec. Minus trim values shorten the "low" pulse time. The top button (chans. 5 and 6) shortens the "low" pulse time 560usec and the bottom button lengthens the "low" pulse 560usec. Each packet of 6 channels repeats roughly every 18.5msec.
Edited: I found Tinkerman's orginal article and there are links in it that may be useful.

http://www.vexfan.com/viewtopic.php?t=227
__________________
Foster - VEX Delaware - 17 teams -- Chief Roboteer STEMRobotics.org
2010 - Mentor of the Year - VEX Clean Sweep World Championship
2006-2016, a decade of doing VEX, time really flies while having fun
Downingtown Area Robotics Web site and VEXMen Team Site come see what we can do for you.

Last edited by Foster : 06-08-2010 at 16:14. Reason: Add links to the orginal article