View Single Post
  #9   Spotlight this post!  
Unread 06-08-2010, 16:17
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,795
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Delay10KTCYx in C18

In addition to what Foster covered...

if statement comparisons need double equal signs (==).
A single equal sign doesn't compare, it changes the value.
So
if (signal=0)
changes the value of signal to zero, then evaluates
if(0)
which will always be False.

The correct way is:
if (signal==0) {
The 18.5ms is more of a design choice for how often transmission packets are sent. Through the years FIRST has had some variation in packet rates, for instance, the predecessor of the Vex controller used a packet rate of 17ms, and the larger version used for FRC at that time had a rate of 26.2ms.
Whenever you use something like this as a crude timer you'll have to investigate and determine what transmission rate was used.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 06-08-2010 at 16:31.