View Single Post
  #9   Spotlight this post!  
Unread 14-03-2005, 22:05
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
Re: Reversing controls?

Quote:
Originally Posted by xchezhd

I'm trying to use the min function on digital_in14 to limit the reverse on PWM11. The motor is activated by the p3_sw_trig.

Exactly how do I use it? just call it every loop in process_data_from_local_io

==> xchezhd
...hmmm I suppose you are refering to:
void Limit_Switch_Min(unsigned char switch_state, unsigned char *input_value); ... in UserRoutines.c

so I'd try something like:
/* set up a temp char variable */
unsigned char lnTemp ;

/* with your input switch wired "normally open", rc_dig_in14 is normally pulled hi...ie 1 or the enum OPEN. So, closing the switch will set it 0, or CLOSED. Then if pwm11 is < 127, Limit_Switch_Min will set it back to 127
*/
lnTemp = pwm11 ;
Limit_Switch_Min(rc_dig_in14, &lnTemp) ;
pwm11 = lnTemp ;

We didn't use this function, and, in fact, chose to wire our limit switches, normally closed. That way, they return 0 or false all of the time and 1 or true, when tripped....just a matter of taste, really...

so looking at it our way:
if (rc_dig_in14)
{
if ( pwm11 < 127)
pwm11 = 127 ;
}

...hope that helps,
Eric
__________________

Don't PANIC!
S. P. A. M.

Last edited by EricS-Team180 : 14-03-2005 at 22:07.