7.5.2 Sub-Program # 1

If the sub-program #1 is programmed, it is executed once at the beginning of the first scan (before main program execution). Therefore, the sub-program #1 can be used to set the initial value into the registers. The sub-program #1 is called the initial program.

The figure below shows the first scan operation.

RUN mode

1st scan

transition

 

 

 

 

 

 

 

 

 

I/O

Timer Sub#1

Main program

 

 

 

 

 

 

 

 

 

 

 

Time

 

 

 

 

 

 

 

2nd scan

Mode I/O Timer Main program

The end of the sub-program #1 is recognized by the END instruction.

7.5.3Timer Interrupt Program

The timer interrupt is the highest priority task. It is executed cyclically with a user specified interval, while suspend- ing other operation. The operations interval is set in the system information. (5 to 1000 ms, 5 ms units).

1 scan

Scan

1 scan

1 scan

1 scan

Timer interrupt

Timer interrupt interval

Time

Timer interrupt interval

The end of the timer interrupt is recognized by the IRET instruction.

7.5.4 I/O Interrupt Program

The I/O interrupt program is also the highest priority task. It is executed immediately when the interrupt factor is generated, while suspending other operations.

The following 2 types I/O interrupt programs are supported in the V200 CPU.

(1)I/O interrupt #1

The I/O interrupt #1 is used with the high speed counter function. When the count value reaches the preset value, etc., the I/O interrupt #1 is activated immediately with suspending other operation. The end of the I/O interrupt #1 is recognized by the IRET instruction.

(2)I/O interrupt #2

The I/O interrupt #2 is also used with the high speed counter function.

If an interrupt factor is generated while other interrupt program is executing (including the timer interrupt), the inter- rupt factor is hold. Then it will be activated after finishing the other interrupt program execution.

If two or more interrupt factors are generated at the same time, the priority is as follows: Timer > I/O #1 > I/O #2

Page 112

Page 120
Image 120
Toshiba V200 user manual Sub-Program #, Timer Interrupt Program, 4 I/O Interrupt Program