CNC machine semaphore application, using expressions (Expr.txt) – Part 4
In the last part of this tutorial series, we will connect the ExtInOut board with our controller and test the functionality of our Expr.txt file, finally!
Before we continue, I would recommend that you go trough the user manual of ExtInOut board for more info about the hardware requirements and connections.
Of all states, Alarm state is the most “complex”(not really) and for that more interesting, so again just a quick detailed explanation or alarm state behavior. I might add that I added additional requirements:
- Additional evaluation of second and third ExtInOut input (in this case, second input will simulate a pressure sensor, third will be used as a “Error reset” button)
- “NO Pressure” error state event can be triggered in Run state as also in Idle state (while Door error state event can be triggered only during the Run state). To clarify, Alarm state transition condition can from now on be triggered either by door switch or pressure sensor.
- While in Alarm state, dedicated light will toggle with approx 1Hz period
- At Alarm state event, on-screen message will appear, notifying the user of error description (either “Open Door” or “NO Pressure”). Error description message will also be displayed at the status bar.
- At alarm state event, siren sound will activate and notify the user for better alertness
- If user will turn off the machine while Alarm state still being active, then with the next machine start-up, Alarm state will still persist with all of its properties(light toggle, program run blockage etc) and user will need to reset it (if the conditions for reset are met). At launch, status bar will notify the user of last Error description before machine was shutdown.
- User will not be able to start a NC program until Alarm state is cleared (pressure sensor or door switch ok) or previous alarm state has not been reset
Expr.txt file can be downloaded below:
Commentary is added for better explanation and understanding.
Connection of controller, ExtInOut board, input switches and LED’s of semaphore
In my case, I will use a dedicated keypad for input switch simulation and LED’s for semaphore lights. Note that I did not find all suitable colors for my lights, so some of them will the same color.
So, we have three input switches/buttons, connected at:
Input 1 -> Simulates open door switch
Input 2 -> Error reset button
Input 3 -> Simulates pressure sensor
LED’s for indication of active states will be connected to relays:
Relay 1: IDLE state
Relay 2: RUN state
Relay 3: PAUSE state
Relay 4: ALARM state
Relay 5: ESTOP state
Picture of the demo setup:
So, lets test the Expr.txt semaphore application.
I will add some screenshots that will show the behavior of the Expr. txt.
Since no pre-existing error events are present, status bar displays “No error” text.
ExtOut output 1 is activated already at the machine startup, indicating IDLE state:
We start the program, and ExtOut output 2 is activated:
Pause state is activated via M00 command in NC program:
This activates also ExtOut output 3 next to already active output 2:
Error “Door Open” Event:
While in Pause state, I simulate door switch activation which triggers the Door Open alarm state. Siren sound is played trough speakers, program execution is stopped and message is displayed:
ExtOut output 4 starts to toggle:
and status bar displays the error type:
Reset Error before Start program:
While in alarm state, I want to start the program again, but, since the error has not been reset, I receive notification message asking me to reset the error, and the number of alarm (1- Door error, 2- Pressure error):
After using alarm reset button, status bar displays no error:
IDLE state is again reinstated:
Error “NO pressure” Event:
So, I start the program again, and at one point I simulate pressure sensor, siren sound plays, program execution is stopped and software will display the “NO PRESSURE” message:
Status bar displays the error type:
Shutdown and startup of the system:
This time, I did not reset the alarm, but I just shutdown the machine.
At machine startup, I receive the “INIT: Please Reset Error” message. At this point, machine is still in Alarm state.
Status bar notifies me of the last error that was not reset:
Note that pressure error event can be activated in IDLE as also RUN state. This is because, user should be notified right at the machine startup as also in idle state that the air pressure is not present and it should be handled appropriately. Error will not be reset if pressure sensor is still activated(i.e. no pressure detected).
At any point during of any other state, if Estop is triggered, ESTOP state will be activated. Estop does not reset the alarm state, so once the estop is released, alarm state will persist.
Short demonstration video: