Activate Output Based On HSC/Shaft Encoder Target Value Regardless PLC Scan Time with Vision PLCs
Ofir Levi
Feb-1st, 2018 8:13

In order to have fast response with a Vision PLC that Regardless of PLC Scan time, you will have to use the "Interrupt routines".

 

Interrupt routines cause:

  • A program to stop immediately, whenever the interrupt is activated, even if the program is in the middle of scanning a net in another subroutine.

  • A jump to the Interrupt subroutine. An Interrupt subroutine must have the exact name shown in the examples below.

  • When the interrupt routine is finished, the program returns to where it was interrupted, and continues from that point until the next Interrupt arrives.

One of the interrupt routines we have is the interrupt HSC.

This function is called according to the current value of a high-speed counter. The program stops immediately and executes the subroutine when the Counter Value reaches the Counter Target Value.

The interrupt function is included in the program by naming a subroutine _Interrupt x,x . These subroutines must be named in accordance with your Hardware Configuration as:

 

·         _Interrupt HSC 0,1

·         _Interrupt HSC 2,3

·         _Interrupt HSC 4,5

 

When the interrupt routine is finished, the program returns to where it was interrupted, and continues from that point until the next Interrupt arrives.Let's take for example HSC 0,1. You'll have to do the following:

1.       Go to Hardware Configuration --> Go to the Snap-in related to your project --> click on the High Speed Inputs (Reload) --> Configure the I(0,1).

           a.      MI14 is the current value of the counter.

           b.      MI15 is the target you wish to set.

           c.      MB26 is the Reload event when the target reaches.

           d.      MB28 is the bit which enables the reloading of the HSC. 

(The operands addresses are just an example).

2.       Add a new subroutine and rename it to "_Interrupt HSC 0,1".

3.       Click on the "_Interrupt HSC 0,1".

4.       Add the logic to the interrupt routine. Here for example the interrupt will set output 17:


Was this article helpful?
4 out of 4 found this helpful