ISPSoft User Manual

ISPSoft User Manual ISPSoft User Manual

02.09.2014 Views

Chapter 11 Structured Text 11.4 Example of a Structured Text 11.4.1 Explanation The example is about the control of a tower light. A tricolor light and a buzzer are used. The control mechanisms for various device statuses are listed below. If more than one device status appears, the device status which is given precedence over the others is displayed. Light State code Device status Red light Yellow light Green light Buzzer Precedence 4 The device is malfunctions. ON OFF OFF Flash Highest 3 The device malfunctions. (The buzzer is turned off.) Flash OFF OFF OFF 2 The device is operating. OFF OFF ON OFF 1 The work is done. OFF Flash OFF OFF 0 The device is idling. OFF ON OFF OFF Lowest 11.4.2 Planning Hardware In this example, the AH500 series CPU module AHCPU530-EN, the digital I/O module AH16AP11R-5A, and the four-slot main backplane AHBP04M1-5A are used. The table below is an I/O allocation table. Type ID Description Digital output Y0.0 Red light Digital output Y0.1 Yellow light Digital output Y0.2 Green light Digital output Y0.3 Buzzer 11.4.3 Planning a Program (1) If the flag ERROR is ON, and the flag BUZZER_OFF is OFF, the state code will be 4. (2) If the flag ERROR is ON, and the flag BUZZER_OFF is ON, the state code will be 3. (3) If the flag ERROR is OFF, and the flag RUNNING is ON, the state code will be 2. (4) If the flags ERROR and RUNNING are OFF, and the flag COMPLETE is ON, the state code will be 1. (5) If the flags ERROR, RUNNING, and COMPLETE are OFF, the state code will be 0. (6) Every state code corresponds to a light. The control of the tricolor light has many practical applications, and the tricolor light can be displayed in various ways. Considering that a program can be expanded and reused, a function block is created. 11.4.4 Creating a Program Start ISPSoft, and then create a new project. The hardware configuration in this example is the same as the hardware configuration in chapter 4. 11-25

ISPSoft User Manual Please refer to chapter 4, and complete the hardware configuration. Create a POU of the program type and a POU of the function block type in the project management area. The programming language used to create the POU of the program type and the POU of the function block type are structured texts. 11-26

Chapter 11 Structured Text<br />

11.4 Example of a Structured Text<br />

11.4.1 Explanation<br />

The example is about the control of a tower light. A tricolor light and a buzzer are used. The control<br />

mechanisms for various device statuses are listed below. If more than one device status appears,<br />

the device status which is given precedence over the others is displayed.<br />

Light<br />

State<br />

code<br />

Device status<br />

Red<br />

light<br />

Yellow<br />

light<br />

Green<br />

light<br />

Buzzer Precedence<br />

4 The device is malfunctions. ON OFF OFF Flash Highest<br />

3<br />

The device malfunctions.<br />

(The buzzer is turned off.)<br />

Flash OFF OFF OFF<br />

2 The device is operating. OFF OFF ON OFF<br />

1 The work is done. OFF Flash OFF OFF<br />

0 The device is idling. OFF ON OFF OFF Lowest<br />

11.4.2 Planning Hardware<br />

In this example, the AH500 series CPU module AHCPU530-EN, the digital I/O module<br />

AH16AP11R-5A, and the four-slot main backplane AHBP04M1-5A are used. The table below is an<br />

I/O allocation table.<br />

Type ID Description<br />

Digital output Y0.0 Red light<br />

Digital output Y0.1 Yellow light<br />

Digital output Y0.2 Green light<br />

Digital output Y0.3 Buzzer<br />

11.4.3 Planning a Program<br />

(1) If the flag ERROR is ON, and the flag BUZZER_OFF is OFF, the state code will be 4.<br />

(2) If the flag ERROR is ON, and the flag BUZZER_OFF is ON, the state code will be 3.<br />

(3) If the flag ERROR is OFF, and the flag RUNNING is ON, the state code will be 2.<br />

(4) If the flags ERROR and RUNNING are OFF, and the flag COMPLETE is ON, the state code<br />

will be 1.<br />

(5) If the flags ERROR, RUNNING, and COMPLETE are OFF, the state code will be 0.<br />

(6) Every state code corresponds to a light. The control of the tricolor light has many practical<br />

applications, and the tricolor light can be displayed in various ways. Considering that a<br />

program can be expanded and reused, a function block is created.<br />

11.4.4 Creating a Program<br />

Start <strong>ISPSoft</strong>, and then create a new project.<br />

The hardware configuration in this example is the same as the hardware configuration in chapter 4.<br />

11-25

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

Saved successfully!

Ooh no, something went wrong!