Thread: Rookie help
View Single Post
  #6   Spotlight this post!  
Unread 20-12-2004, 16:43
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,883
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: Rookie help

Variable declarations must be at the very beginning of a routine. I noted that above in an edit after my original post. Sorry about that.
Quote:
Originally Posted by doyler
Code:
/*******************************************************************************
* FUNCTION NAME: Process_Data_From_Master_uP
* PURPOSE: Executes every 17ms when it gets new data from the master 
* microprocessor.
* CALLED FROM: main.c
* ARGUMENTS: none
* RETURNS: void
*******************************************************************************/
void Process_Data_From_Master_uP(void)
{
static unsigned char servo1=0;
static unsigned char counter=0;
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
 
Default_Routine(); /* Optional. See below. */
 
/* Add your own code here. */
 
if (counter < 20) // about one 1/3 second in the slow loop
counter++;
else
{
counter = 0;
if (servo1 < 255)
	 servo1++; // servo1 will slowly step through each of it’s positions
else
	 servo1 = 0; // servo1 will quickly reset to the zero position
}
pwm03 = servo1;
 
printf("PWM OUT 7 = %d, PWM OUT 8 = %d\n",(int)pwm07,(int)pwm08); /* printf EXAMPLE */
 
Putdata(&txdata); /* DO NOT CHANGE! */
}
(sorry if i am being annoying, im just new at this)
You're not annoying. I like to help you get started.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 21-12-2004 at 16:40. Reason: Fixed incorrect comment. Slow loop = 59/sec in EDU 38 in FRC