Autostop - Digital signal

Hi All

I have a 6600 on a track which pours foam into 4 different presses. I have a "Start_Pouring" signal and a "Stop_Pouring" which interfaces to a chemical system and tells it when to pour foam and stop pouring foam. When an operator breaks the light guard Auto stop ossd signals are lost and the robot stops. However the chemical system still keeps pouring its set amount. I would like to write some code to set "stop_Pouring"  if AS = 0.

Does anyone know if there is a way of doing this? Where do you write code that is being scanned for status change all the time? Would you write it in Main? 

I know in Siemens PLC it would be written in OB1.

Many Thanks in advance