|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
sample limit switch code???
anyone got one???
![]() we need it to program our arm |
|
#2
|
||||
|
||||
|
Re: sample limit switch code???
Im pretty sure the default code already has PWMs and relay outputs that are programmed to stop if certain digital input pins are pulled low by an external switch.
From the top of my head, I think relay out 8 is tied to digital input 16? intended to be used with the compressor and the pressure limit switch? - that would be a good example of how to start. |
|
#3
|
||||
|
||||
|
Re: sample limit switch code???
we are trying to use limit switch as interrupts... and when the arm hits the switch, it will stop moving, that's our plan
![]() |
|
#4
|
||||
|
||||
|
Re: sample limit switch code???
then you would probably need a single-edge based interrupt pin to determine when the circuit goes from open to closed.
|
|
#5
|
||||
|
||||
|
Re: sample limit switch code???
it would be much simpler to have the line of code that is controlling the motor also look at the limit switch on a digital input pin, instead of using interrupts
this is not really an interrupt application, because you are controlling the motor output on every loop of your code anyway, there is no reason to interrupt the loop when the switch closes - the victors and spikes dont respond that fast. besides, contact switches bounce when they open and close - which means, instead of simply going from 0 to 1, they go 0000111110011011010101111111111 - so for every switch closure you will see maybe 20 to 100 interrupts within several milliseconds. |
|
#6
|
|||||
|
|||||
|
Re: sample limit switch code???
Quote:
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); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Inserting Naviagation code into Default code? | actorindp | Programming | 3 | 28-01-2004 18:12 |
| Some EDURobotics Problems | squide | Robotics Education and Curriculum | 9 | 20-01-2004 10:27 |
| I am wondering........... | geo | Technical Discussion | 10 | 15-04-2002 13:17 |
| Need help with 255 Variable | Joseph F | Programming | 18 | 26-02-2002 14:49 |
| Error found in programming for the pump and pressure switch | sjharobotics | Programming | 4 | 06-02-2002 17:46 |