Go to Post Free hugs are excellent things. - Eugenia Gabrielov [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-11-2008, 00:22
team1203 4life's Avatar
team1203 4life team1203 4life is offline
President
FRC #1203 (Pandemonium)
Team Role: Mentor
 
Join Date: May 2007
Rookie Year: 2006
Location: west babylon
Posts: 65
team1203 4life is a jewel in the roughteam1203 4life is a jewel in the roughteam1203 4life is a jewel in the rough
Send a message via AIM to team1203 4life
help plez

ok this is my first try at programing i have been a mechanic for the past three years and this year i am going to do both program and build but i need to know how to program a limit switch and in what file should i put the peace of code in
__________________
if it is on one of my posts it is propbly spelt wrong


Why drive around somthing when you can drive through it
  #2   Spotlight this post!  
Unread 10-11-2008, 00:47
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
Re: help plez

which system are you using?

Im going to assume first off that your using the old control system from IFI and not the cRIO, and that your using the default code.

limit switches are automatically programmed, they use the digital_io ports on the rc. Look in user_routines.c twords the bottom you'll see a block that will look something like this...

Code:
  /*---------- PWM outputs Limited by Limit Switches  ------------------------*/
  
  Limit_Switch_Max(rc_dig_in05, &pwm03);
  Limit_Switch_Min(rc_dig_in06, &pwm03);
  Limit_Switch_Max(rc_dig_in07, &pwm04);
  Limit_Switch_Min(rc_dig_in08, &pwm04);
  Limit_Switch_Max(rc_dig_in09, &pwm09);
  Limit_Switch_Min(rc_dig_in10, &pwm09);
  Limit_Switch_Max(rc_dig_in11, &pwm10);
  Limit_Switch_Min(rc_dig_in12, &pwm10);
  Limit_Switch_Max(rc_dig_in13, &pwm11);
  Limit_Switch_Min(rc_dig_in14, &pwm11);
  Limit_Switch_Max(rc_dig_in15, &pwm12);
  Limit_Switch_Min(rc_dig_in16, &pwm12);
each one corresponds to a dig_io port on the RC, you'll notice that for each motor [pwm port] there are two dig_io ports used. If you are just using one limit switch and one motor you just need to use one of the ports, but if you were using 2 limit switches and one motor you would use 2 ports both of which would have to be controlling the pwm port that the motor is on.

does that make sence? feel free to ask more questions
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
  #3   Spotlight this post!  
Unread 10-11-2008, 00:56
team1203 4life's Avatar
team1203 4life team1203 4life is offline
President
FRC #1203 (Pandemonium)
Team Role: Mentor
 
Join Date: May 2007
Rookie Year: 2006
Location: west babylon
Posts: 65
team1203 4life is a jewel in the roughteam1203 4life is a jewel in the roughteam1203 4life is a jewel in the rough
Send a message via AIM to team1203 4life
Re: help plez

is that where i put the if statment
also what about relays they dont go to a pwm port
__________________
if it is on one of my posts it is propbly spelt wrong


Why drive around somthing when you can drive through it

Last edited by team1203 4life : 10-11-2008 at 01:10.
  #4   Spotlight this post!  
Unread 10-11-2008, 06:02
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
Re: help plez

Well for relays you would just change the pwm value on one of the dig_io ports to the relay port [ex. 'Limit_Switch_Max(rc_dig_in05, &relay1_fwd);']

Now for if statements we would have to know exactly what your doing with the limit switch, because if you are just using it to stop or start a motor the you don't have to have if statements. But if your doing something else with it, like telling it when it gets switched to start a sensor of some kind or wanting to have it only stay switched for say 10 seconds then reverse the motor you could add if statements here if you wanted to in order to achieve what ever your task is.
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Frame - Help Help Help... nmihailidis Programming 2 04-03-2007 14:44
section 'InterruptVectorLow' type is non-overlay (was: HELP HELP HELP!!!!!) naor52 Programming 14 24-02-2007 01:19
Help: How do we get a teacher to help? (was: Help) ChaosAlchimey General Forum 13 21-01-2007 11:57
Plez help me Wacko324 Control System 8 26-01-2004 20:24


All times are GMT -5. The time now is 19:31.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi