PLC Data Registers
In Structured Text programs, PLC data registers can be used directly. Data registers can be used on the right or left side of an expression. Additionally, they can be used in functions. It is similar to PLC data registers, but there is a prefix between the data register type and address, which indicates a BOOL and WORD.
PLC Data Registers
| Item | Description |
|---|---|
| None | 1-bit data register |
| X | 1-bit data register |
| W | WORD (16-bit) data register |
PLC Data Registers Example
| Example | Result |
|---|---|
| MX00 := 1 | The value of M0.0 is 1 (turns M0.0 ON) |
| MX01 := 1 | The value of M0.1 is 1 (turns M0.1 ON) |
| DW100 := 100 | The value of D100 is 100 |
| DW101 := 0X100 | The value of D101 is 0x100 (Hexadecimal) |
Data register mapping:
- X, Y, M, L, K, F: None, X, W
- T, C, S: None, X
- D: X, W
- Z, TC, TS, CC, CS: W
Variables
A variable is a string made up of the accessible characters in a Structured Text program. There are two types of variables: Local Variable and Global Variable.
Local Variables are used within one Structured Text program. Global Variables can be used by any Structured Text program.
When registering Global Variables, it is possible to designate a specific PLC data register. Designating a specific PLC data register is known as memory allocation. If a PLC data register is not designated, internal memory will be allocated automatically.
Naming Rules
- Characters allows: alphanumeric
- Reserved WORDs cannot be used.
- Maximum length of 32 bytes.
- Variables are NOT case-sensitive
Variable Data Types
| Name (Reserved) | Data Type | Bit Size |
|---|---|---|
| SINT | Short Integer | 8 |
| INT | Interger | 16 |
| DINT | Double Integer | 32 |
| USINT | Unsigned Short Integer | 8 |
| UINT | Unsigned Integer | 16 |
| UDINT | Unsigned Double Integer | 32 |
| REAL | Float/Real Number | 32 |
| BOOL | Boolean | 1 |
| BYTE | Bit string length of 8 | 8 |
| WORD | Bit string length of 16 | 16 |
| DWORD | Bit string length of 32 | 32 |
| ARRAY | Array | – |
| STRUCT | Struct | – |
