Types of variables used in Huichuan PLC programming
In Huichuan PLC programming, the variety of variables is quite rich, similar to other brands of PLCs, generally including soft components, custom variables, and system variables.
Soft components typically include: bit soft components X/Y/M/S/B, and sub soft components D/R/W.

From this, it is not difficult to see that the types of soft components are quite similar to those of Mitsubishi (X/Y/M/L/B/F). Below we will look at the specific types, ranges, points, and descriptions of soft components:

From the table, it can be summarized that bit soft components are all of BOOL type, used for BOOL type input/output instructions or output parameters.
As for the hardware points of the PLC itself, they are represented by X and Y for input and output respectively.
As ordinary auxiliary relays, M components total 8000 from 0-7999, and after M8000, similar to Mitsubishi, they are also used for special functions, such as the M8000 program running flag in Huichuan.

Word soft components
The commonly used types of word soft components in Huichuan PLC are shown in the table below:

Since the functional range of word soft components is fixed, the serial number for power-off retention cannot be changed.
Word soft components can also be used as integers or floating-point numbers. When used as integers, it is necessary to decide whether to use a single word or double word based on the instruction. However, when used as floating-point numbers, it must occupy 2 words. Below are a few examples:

Special soft components
In Huichuan PLC programming, there are some special usage soft components:


Among them, K/H/E are numeral representation symbols. This is the same as the usage in other PLCs. For example, floating-point numbers:

Variables
Variables refer to a class of identifiers that do not have a specific storage address, apart from the conventional X/Y/M/D, etc. This is similar to the DB data blocks we create in Siemens PLC. Although there is no specific storage address, the data type structure must comply with the general data types of variables. That is, the named variables must still be BOOL/INT/REAL/BYTE, etc.

When defining custom variables, attention must be paid to the scope of variable usage. Global variables or local variables.
Global variables: Can be used in all programs, effective state.
Local variables: Only valid within their own program block.
The above two usages are similar to global and local variables in Siemens PLC. Similarly, local variables are quite similar to the usage of FB blocks in Mitsubishi PLC.
Custom variable naming rules:
· Can only consist of “_, letters, numbers, Chinese characters” and cannot start with “_, numbers”.
· Cannot have the same name as “soft component forms, constants, standard data types, instructions, subroutine names, interrupt subroutine names”.
· Cannot be keywords such as “ARRAY, TRUE, FALSE, ON, OFF, NULL”.