Activity 1.2.8 Emergency Stop (VEX®) Introduction An emergency stop, e-stop, is a feature that many machines have to enhance safety by providing a system to rapidly stop a machine. The emergency stop feature can be activated remotely when the machine is operated from a remote location. The most common configuration is a clearly marked button located within a safe area close to the machine. This button can be pressed by a human to stop the machine in an emergency. In this activity you will apply a multitask program to provide an emergency stop for an operation. Equipment Computer with ROBOTC software CIM VEX® testbed PLTW ROBOTC template Activity 1.2.7 Multitasking Emergency Stop presentation Procedure 1. Form groups of four and acquire your group’s CIM VEX® Kit under your teacher’s direction. 2. Connect the CIM VEX® testbed Cortex to the computer. CIM VEX® Testbed 3. View the Activity 1.2.7 Multitasking Emergency Stop presentation to understand multitask programming. 4. Open the PLTW ROBOTC template. Click File, Save As, , and then select the folder that your teacher designated, and name the file A1_2_7_eStop. © 2013 Project Lead The Way, Inc. Computer Integrated Manufacturing Activity 1.2.8 Emergency Stop (VEX®) – Page 1 5. In this activity the emergency stop task runs concurrently and ends all tasks if the e-stop button is pushed. If an ultrasonic sensor reports a value of 10 inches or less then both motors run at quarter power. Otherwise both motors turn at full power. 6. Confirm that the Motors and Sensors Setup window reflects the inputs and outputs to be used. Note that additional motors and sensors that are physically attached may be configured; however, these are not required to be configured. Click OK to close the window. Cortex Wiring Diagram 7. Use the program as the main body of the program. task e_stop() { while(true) { if(SensorValue(e_stopBtn) == 1) { stopAllTasks(); // ends the program and all tasks including task main. } wait1Msec(10); // prevents the current task from using majority of available CPU capacity } } task main() © 2013 Project Lead The Way, Inc. Computer Integrated Manufacturing Activity 1.2.8 Emergency Stop (VEX®) – Page 2 { startTask(e_stop); simultaneously // initiates the e-stop task which will run while(true) { if(SensorValue(sonar) <= 10) { motor[rightMotor] = 32; motor[leftMotor] = -32; } else { motor[rightMotor] = 127; motor[leftMotor] = -127; } wait1Msec(10); majority of available CPU capacity // prevents the current task from using } } 8. Save the program, power on the Cortex, compile, and download the program. If you have any errors, check with your instructor to troubleshoot your program. 9. Test the program and troubleshoot until the expected behavior has occurred. Save the program. 10. Describe the behaviors observed. 11. Document what this program could look like as pseudocode simple behaviors. 12. Modify the program to use the limit switch connected to digital input 1. 13. Follow your teacher’s direction and either print the programs or submit it electronically with this activity. Conclusion 1. Describe any challenges that you encountered while developing the program. 2. Describe applications for which an emergency stop could be used. © 2013 Project Lead The Way, Inc. Computer Integrated Manufacturing Activity 1.2.8 Emergency Stop (VEX®) – Page 3