Introduction to the SLC-500 Discrete Input Interrupt
The SLC-500 Discrete Input Interrupt allows you to execute a routine when certain bits on a module become true or false. This allows for high speed processing of certain logic under specific conditions. For example, if the operator presses an E-Stop. The E-stop should directly take your equipment to a safe state. However, you might decide to take other actions in logic.
The DII feature of the 5/03 and higher will typically monitor an input module. We configure the DII feature in the S2 Status file.
In this case, we’ll just have a simple ADD instruction in the DII routine. An integer file increments when the DII executes.
Create your Subroutine
Before we start, create a new routine. Right-click “Program Files” to create the new routine. For example, I’m creating file 7, which is named DII. You must be Offline to create this file.

Next, I’ll add the logic to our subroutine. As I have said, we’ll just use a simple ADD instruction to verify the routine executes.

Configure the SLC-500 Discrete Input Interrupt
At this point, open the S2 Status file. Click the DII tab. We’ll leave the preset on 0 (immediate mode). When the entire bit pattern of the bits specified in the mask equals the compare value, the DII executes. Obviously another option is to enter a preset (counter mode). In that case, a certain bit pattern must happen several times before the DII will execute.

Obviously, the file we created is file #7. The slot # of the input module I’m monitoring is 1. Set the bit mask to reflect the bits you wish to monitor. This is a hexadecimal value. Obviously, if we want to monitor only bit 0, the bit mask will be 1h. It’s important to realize, we can only use bits 0 to 7 in the DII. Finally, set the Compare Value. The compare value describes which value to look for on each bit. Again, this is a hexadecimal value. By setting the compare value to 1h, I’m looking for the 0 to 1 transition. This 0 to 1 transition applies only to bit 0 in this case.
Download and test your work
Once we download and test our work, we can see that each time bit 0 goes high, the DII executes.

For more information, visit the Category page for the SLC-500!
— Ricky Bryce