There is not a graceful way of doing this with the current CTRIO. It is a feature we added to the CTRIO2 that is very near official release. Unfortunately, that doesn't help you at this time. Here is what you will have to do to get this to work with the current CTRIO.
- Run the Dynamic Position Profile.
- SET Suspend whenever your e-stop occurs.
- Use a System Command to Read your Output Position.
- RESET Enable Output. (This keeps the following Suspend Output from turning the Output back ON yet.
- RESET Suspend Output.
- SET Enable Output. (This will zero out the Output Position as you stated).
- Use a System Command to Write back the Output Position you read above.
- TOGGLE the Goto Position bit.
The problem here is if your stepper motor cannot handle the sudden accel back when you were RESETTING Suspend Output, is it also intolerable to the sudden stop caused by SETTING Suspend Output? Because SETTING Suspend Output causes instant decel; it doesn't ramp down to zero speed. Thus this method may not work if the decel causes slippage on the machine's position.