ISPSoft User Manual
ISPSoft User Manual ISPSoft User Manual
Chapter 6 Symbols • Auto-close Dialog If users unselected the Auto-close Dialog checkbox, the Add Symbol window will not be closed automatically after OK is clicked. Please refer to section 2.3.1 for more information. • Define Global If users select the Define Global checkbox, the symbol declared here will appear in the global symbol table. However, the Define Global checkbox is not in the Add Symbol window for a global symbol. 6.2.3 Using a Symbol Whose Data Type is ARRAY or STRING • Symbol whose data type is ARRAY If users want to use a symbol whose data type is ARRAY in a program, the expression format is Identifier[Index]. Generally speaking, the index is a decimal constant. If the programming language in a project for an AH500 series CPU module is a structured text, the index can be a symbol. The minimum index value must be 0, whether the index is a constant or a symbol. The maximum index value can not be larger than or equal to the number of elements in the array. For example, if the number of elements in an array is 10, the index value must be within the range between 0 and 9. If the index is a symbol, the value of the symbol can not be larger than the number of elements in the array. Otherwise, an error will occur during the operation. If users declare a symbol whose data type is ARRAY, they have to select an array type, and set the size of the array. The number of elements in an array must be within the range between 1 and 2048. A start device address is assigned to a symbol whose data type is ARRAY according to the array type. Please notice that the start device address is assigned to a symbol whose data type is ARRAY can not be an SR device, an SM device, an E device, or an F device. Please refer to section 6.1.4 for more information. Besides, an array is composed of the devices starting from the device assigned by users or the system, and the number of devices in the array conforms to the size of the array. In the figure below, ARRAY[3] OF DWOED in the Type… cell for Ary_0 indicates that the array is composed of 3 elements, and the array type is DWORD. The device address in the Address cell for Ary_0 indicates that the start device address is D0. As a result, the array is composed of D0~D5 (6 word devices). ARRAY[5] OF BOOL in the Type…cell for Ary_1 indicates that the array is composed of 5 elements, and the array type is BOOL. The device address in the Address cell for Ary_1 indicates that the start device address is M0. As a result, the array is composed of M0~M4. 6-13
ISPSoft User Manual When users declare a symbol whose data type is ARRAY, they can set the initial value of the symbol. Please refer to the following example. [1,2,3,4,5] in the Initial Value cell for A_Ary indicates that the initial value of A_Ary[0] is 1, the initial value of A_Ary[1] is 2, the initial value of A_Ary[2] is 3, the initial value of A_Ary[3] is 4, and the initial value of A_Ary[4] is 5. [1,3(0),5] in the Initial Value cell for B_Ary indicates that the initial value of B_Ary[0] is 1, the initial value of B_Ary[1] is 0, the initial value of B_Ary[2] is 0, the initial value of B_Ary[3] is 0, and the initial value of B_Ary[4] is 5. A_Ary B_Ary Element Initial value Element Initial value A_Ary[0] 1 B_Ary[0] 1 A_Ary[1] 2 B_Ary[1] 0 A_Ary[2] 3 B_Ary[2] 0 A_Ary[3] 4 B_Ary[3] 0 A_Ary[4] 5 B_Ary[4] 5 • Symbol whose data type is STRING In ISPSoft, a string is composed of ASCII codes, and the ASCII codes are surrounded by double quotes, e.g. “ABCD”. A symbol whose data type is STRING is generally used with an applied instruction. Please refer to the programming manual for a model for more information. Besides, only AH500 series CPU modules support the symbols whose data types are STRING, and the data type of a symbol of the VAR_INPUT class, the VAR_OUTPUT class, or the VAR_IN_OUT class in a function block can not be STRING. As a result, if users want to process a string in a function block, they can create the string as a global symbol. Please refer to chapter 7 for more information about the usage of function blocks. When users declare a symbol whose data type is STRING, they can specify the maximum size of the string. The number of characters in a string is within the range between 1 and 128, and one character occupies 1 byte. The number of devices assigned to the characters in a string must conform to the size of the string, and one extra byte must be assigned to the ending character in the string. If the last character and the ending character in a string does not occupy the two bytes in a word device, the ending character will be assigned another device. For example, two word devices (four bytes) will be assigned to a string which is composed of three characters, and three word devices (six bytes) will be assigned to a string which is composed of four or five characters. Please refer to the following figure. The number in the parentheses in the Type… cell for a symbol whose data type is STRING indicates the maximum size of the string. Besides, the characters in the Initial Value cell for a symbol whose data type is STRING can not be put in 6-14
- Page 180 and 181: Chapter 5 Program Organization Unit
- Page 182 and 183: Chapter 5 Program Organization Unit
- Page 184 and 185: Chapter 5 Program Organization Unit
- Page 186 and 187: Chapter 5 Program Organization Unit
- Page 188 and 189: Chapter 5 Program Organization Unit
- Page 190 and 191: Chapter 5 Program Organization Unit
- Page 192 and 193: Chapter 5 Program Organization Unit
- Page 194 and 195: Chapter 5 Program Organization Unit
- Page 196 and 197: Chapter 5 Program Organization Unit
- Page 198 and 199: Chapter 5 Program Organization Unit
- Page 200 and 201: Chapter 5 Program Organization Unit
- Page 202 and 203: Chapter 5 Program Organization Unit
- Page 204 and 205: Chapter 5 Program Organization Unit
- Page 206 and 207: Chapter 5 Program Organization Unit
- Page 208 and 209: Chapter 5 Program Organization Unit
- Page 210 and 211: Chapter 5 Program Organization Unit
- Page 212 and 213: Chapter 5 Program Organization Unit
- Page 214 and 215: Chapter 5 Program Organization Unit
- Page 216 and 217: Chapter 5 Program Organization Unit
- Page 218 and 219: Chapter 6 Symbols Table of Contents
- Page 220 and 221: Chapter 6 Symbols • VAR-General s
- Page 222 and 223: Chapter 6 Symbols 6.1.4 Assigning a
- Page 224 and 225: Chapter 6 Symbols Application Examp
- Page 226 and 227: Chapter 6 Symbols • Local symbol
- Page 228 and 229: Chapter 6 Symbols • STRING If the
- Page 232 and 233: Chapter 6 Symbols double quotes, an
- Page 234 and 235: Chapter 6 Symbols *. Before the ini
- Page 236 and 237: Chapter 6 Symbols Select a file whi
- Page 238 and 239: Chapter 6 Symbols Press Alt+ on the
- Page 240 and 241: Chapter 6 Symbols Users can set a d
- Page 242 and 243: Chapter 6 Symbols Double-click RUN_
- Page 244 and 245: Chapter 6 Symbols If users want to
- Page 246 and 247: Chapter 7 Function Block Table of C
- Page 248 and 249: Chapter 7 Function Block 7.1.2 Char
- Page 250 and 251: Chapter 7 Function Block Class VAR_
- Page 252 and 253: Chapter 7 Function Block P_VAR (cal
- Page 254 and 255: Chapter 7 Function Block The princi
- Page 256 and 257: Chapter 7 Function Block *. SM400 i
- Page 258 and 259: Chapter 7 Function Block In view of
- Page 260 and 261: Chapter 7 Function Block itself. As
- Page 262 and 263: Chapter 7 Function Block • DVP se
- Page 264 and 265: Chapter 7 Function Block Function b
- Page 266 and 267: Chapter 7 Function Block HC_POINTER
- Page 268 and 269: Chapter 7 Function Block program in
- Page 270 and 271: Chapter 7 Function Block The functi
- Page 272 and 273: Chapter 7 Function Block Please ref
- Page 274 and 275: Chapter 7 Function Block After the
- Page 276 and 277: Chapter 7 Function Block Open the w
- Page 278 and 279: Chapter 7 Function Block Obviously,
<strong>ISPSoft</strong> <strong>User</strong> <strong>Manual</strong><br />
When users declare a symbol whose data type is ARRAY, they can set the initial value of the<br />
symbol. Please refer to the following example.<br />
[1,2,3,4,5] in the Initial Value cell for A_Ary indicates that the initial value of A_Ary[0] is 1, the<br />
initial value of A_Ary[1] is 2, the initial value of A_Ary[2] is 3, the initial value of A_Ary[3] is 4, and<br />
the initial value of A_Ary[4] is 5. [1,3(0),5] in the Initial Value cell for B_Ary indicates that the<br />
initial value of B_Ary[0] is 1, the initial value of B_Ary[1] is 0, the initial value of B_Ary[2] is 0, the<br />
initial value of B_Ary[3] is 0, and the initial value of B_Ary[4] is 5.<br />
A_Ary<br />
B_Ary<br />
Element Initial value Element Initial value<br />
A_Ary[0] 1 B_Ary[0] 1<br />
A_Ary[1] 2 B_Ary[1] 0<br />
A_Ary[2] 3 B_Ary[2] 0<br />
A_Ary[3] 4 B_Ary[3] 0<br />
A_Ary[4] 5 B_Ary[4] 5<br />
• Symbol whose data type is STRING<br />
In <strong>ISPSoft</strong>, a string is composed of ASCII codes, and the ASCII codes are surrounded by double<br />
quotes, e.g. “ABCD”. A symbol whose data type is STRING is generally used with an applied<br />
instruction. Please refer to the programming manual for a model for more information. Besides,<br />
only AH500 series CPU modules support the symbols whose data types are STRING, and the<br />
data type of a symbol of the VAR_INPUT class, the VAR_OUTPUT class, or the VAR_IN_OUT<br />
class in a function block can not be STRING. As a result, if users want to process a string in a<br />
function block, they can create the string as a global symbol. Please refer to chapter 7 for more<br />
information about the usage of function blocks.<br />
When users declare a symbol whose data type is STRING, they can specify the maximum size of<br />
the string. The number of characters in a string is within the range between 1 and 128, and one<br />
character occupies 1 byte. The number of devices assigned to the characters in a string must<br />
conform to the size of the string, and one extra byte must be assigned to the ending character in<br />
the string. If the last character and the ending character in a string does not occupy the two bytes<br />
in a word device, the ending character will be assigned another device. For example, two word<br />
devices (four bytes) will be assigned to a string which is composed of three characters, and three<br />
word devices (six bytes) will be assigned to a string which is composed of four or five characters.<br />
Please refer to the following figure. The number in the parentheses in the Type… cell for a<br />
symbol whose data type is STRING indicates the maximum size of the string. Besides, the<br />
characters in the Initial Value cell for a symbol whose data type is STRING can not be put in<br />
6-14