02.09.2014 Views

ISPSoft User Manual

ISPSoft User Manual

ISPSoft User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5 Program Organization Units and Tasks<br />

• Hardware configuration<br />

In this example, the CPU module AHCPU530-EN, the digital I/O module AH16AP11R-5A, and the<br />

four-slot main backplane AHBP04M1-5A are used. (The hardware configuration here is the same<br />

as the hardware configuration in chapter 4.)<br />

• Planning a program<br />

In this example, a timed interrupt is triggered every 25 milliseconds, and time intervals are<br />

measured through a program. In the figure below, Timed Interruption (0) is triggered every 25<br />

milliseconds, and the value in the 32-bit register (D1, D0) increases by one whenever Timed<br />

Interruption (0) is triggered. As long as the PLC keeps running, Timed Interruption (0) is<br />

triggered every 25 milliseconds, and the value in the 32-bit register (D1, D0) increases by one<br />

whenever Timed Interruption (0) is triggered. <strong>User</strong>s can calculate the time for which the PLC has<br />

run by reading the value in (D1, D0). For example, if the value in (D1, D0) is 10, the time for which<br />

the PLC has run is 250 milliseconds (10x25 ms).<br />

After the START button is pressed, the present value in (D1, D0) will be transferred to (D3, D2),<br />

and the value in (D1, D0) will increase. After the present value in (D1, D0) is transferred to (D3,<br />

D2), the value in (D3, D2) will remain unchanged. <strong>User</strong>s can calculate the time which has elapsed<br />

since the START button was pressed by subtracting the value in (D3, D2) from the value in (D1,<br />

D0). The value gotten is stored in (D5, D4).<br />

Time when the START button is pressed<br />

Time having elapsed since the<br />

START button was pressed<br />

Time for which the PLC has run<br />

A timed interrupt in an AH500 CPU module is illustrated with the example in this section. The<br />

instructions TKON and TKOFF are also illustrated with the example in this section. Five POUs are<br />

created. The functions of the POUs are described below.<br />

POU name<br />

Function<br />

The value in the 32-bit register (D1, D0) increases by one every 25<br />

INT_Timer<br />

milliseconds. (The POU is assigned to Timed Interruption (0).)<br />

Reset the flags M0 and M1, transfer the value 0 to the 32-bit registers (D1,<br />

D0), (D3, D2), (D5, D4), and (D7, D6), and enable the interrupt.<br />

Initialize During the first scan cycle, Cyclic (0) to which the POUs are assigned is<br />

enabled, and Cyclic (1) to which Initialize is assigned is disabled. As a<br />

result, Initialize is only executed during the first cycle.<br />

Control<br />

Time_CHK<br />

Signal<br />

When X0.0 is turned form OFF to ON, the operation flag M0 is set to ON,<br />

and the value in (D1, D0) is transferred to (D3, D2). When X0.1 is turned<br />

from OFF to ON, or when an overflow occurs, the operation flag M0 is reset.<br />

<strong>User</strong>s can calculate the time which has elapsed since the START button<br />

was pressed by subtracting the value in (D3, D2) from the value in (D1, D0).<br />

The value gotten is stored in (D5, D4). If the value gotten is less than 0, the<br />

overflow flag M1 is set to ON.<br />

If the time which has elapsed is more than 30 seconds (25 ms x1200), or the<br />

overflow flag M1 is ON, the alarm Y0.0 will be set to ON.<br />

*. Please refer to AH500 Operation <strong>Manual</strong> and AH500 Programming <strong>Manual</strong> for more information about the<br />

interrupts in an AH500 series CPU module and the related applied instructions.<br />

• Creating the program<br />

Please create a project for AHCPU530-EN.<br />

5-35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!