Category Archives: plc program

Time and date data format in SIEMENS S7-300/400 series PLC

Data types are split into basic data types and complex data types. Data formats for time and date have both basic and complex data types.

1. Time of Day and wherein DATE belongs to the basic data types

1.1 DATE is a 16-bit data type in IEC format with a resolution of 1 day;
The format is D#1990-01-01~D#2168-12-31 or DATE#1990-1-1~DATE#2168-12-31;
It can be translated into and from INT type data. D#1990-1-1 corresponds to 1, and for every 1 increase in INT data, the DATE data value is increased by 1 day.

1.2 Time of Day is a 32-bit 24-hour time format with a resolution of 1ms
The format is TOD#00:00:00.000~TOD#23:59:59.999;
It can be translated into and from DINT type data. TOD#00:00:00.000 corresponds to 1, and Dever increases by 1 and the Time of Day time value increases by 1ms.

2. DATE_AND_TIME is a data type match
DATE_AND_TIME includes 8 bytes, the description of each byte is shown in the figure below;
The format is DT#1990-1-1-0:0:0.0 to DT#2089-12-31-23:59:59.999;

How to set multiple dates for Siemens system time

There comes a time setting in the properties of the CPU of Siemens S7-1200 system. When we use it, if there is a relatively high requirement for time, we must give attention to setting the correct parameters, otherwise it will be incorrect.
Pay heed to the choice of time zone. The picture above shows UTC time, ie GMT time, time standard time. If it is Beijing time, please choose UTC+8, 8 hours earlier. If there is daylight saving time, please enable the daylight saving time option and China has cancelled daylight saving time.

After this setting, the CPU goes online and can synchronize the module time to the time the PG/PC. Otherwise it is the factory default date of the PLC.

We can see whether the time and time in the CPU are set correctly by reading the local and system time instructions in the date and time in the extended instruction.

The two instructions are: RD_LOC_T (read local time, ie with time difference) and RD_SYS_T (read system time, ie UTC time)

Siemens PLC data type _ date and time

Date and time data types include:
DATE, date;
TIME_OF_DAY, time (the current time is a few minutes and a few seconds);
LTIME_OF_DAY, time (the current time is a few minutes and a few seconds, a few milliseconds);
DATE_AND_TIME, date + time, BCD code transferred, to milliseconds;
LDT, date + time, unsigned integer, to nanoseconds;
DTL, date + time, structure, to nanoseconds.

LDT and DTL actually express the same content, but the way they are expressed is different.

The range and precision of LDT and DTL are the same. DTL uses a structure to express it. There is also an expression of the day of the week, which is calculated according to the year, month and day.

Siemens date and time format

    Siemens S7-200/200smart series

This series of read and write instructions is very simple, you can use an instruction and fill in the address, the data has a fixed format.

    S7-300/400, S1200, S1500 series

This series of PLC date and time data types mainly includes; 1 date (date), 2 day time (Time_Of_ Day), 3 long time LTOD (LTime_Of_Day), 4 date time DT (Date_And_Time), 5 date long time LDT ( Date_And_LTime), 6 long date and time DTL.

   For Siemens S7-300/400, S1200, S1500 these data types are not universal.

We need to figure out these date formats

(1) Date DATE

Data type the data as an unsigned integer. The notation contains the year, month and day.

The data type DATE operand is located in hexadecimal form, corresponding to the date value (16#0000) since 01-01-1990. The contents of the variable are shown in integer format by the number of days from January 1, 1990. The constant format is D# before the date. For example, the date specified by D#2168 – 12-31 is December 31, 2168, and the content of the corresponding variable is W#16#FF62.

(2) Day time (Time_Of_ Day)

TOD (TIME_OF_DAY) data type occupies a double word and stores the number of milliseconds from 0:00 h of the day, which is an unsigned integer. The constant indicates that the format is TOD# before the time.

(3) Long time LTOD (LTime_Of_Day)

Long-day LTOD (LTime_Of_Day) data type occupies 2 double words and stores the number of nanoseconds from 0:00 of the day, which is an unsigned integer. Nanosecond data are only available in the S1500 series.

(4) Date time DT ( Date_And_Time)

The daytime DT (Date_And_Time) data type stores date and time information in the format BCD.

(5) Date long LDT (Date_And_LTime)

The date long LDT (Date_And_LTime) data type stores date and time information (in nanoseconds) since 0:00 on January 1, 1970.

(6) Long date and time DTL

The extended date time (DTL) data type has an operand length of 12 bytes and stores date and time information in a predefined structure.

The structure of a DTL data type has several parts, each of which contains different data types and ranges of values. The data type of the specified value must match the data type of the corresponding element. Table 5-18 shows in the structural components of the DTL data type.

How can I report an error without finding the SSF file?

When the Siemens STEP7-V5.5 programming software is installed, how can I report an error without finding the SSF file?

1. Copy the file to the root directory of the C drive, paying attention to only English characters.

2. If all the Siemens software installations are prompted to restart the computer or restart after the restart, please click “Start – Run”.

Enter “regedit” (Win7 system, search for “regedit” in the start menu, then right click and select “Run as administrator” [Important]

Then find in the tree box on the left:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager [Important] Then delete the right side: “PendingFileRenameOperations” (delete without risk, the operating system will automatically re-create) [important]

Then re-run the installer (do not restart).

Prompt not found SSF file when installing STEP7-300 5.4

1, can be installed with a virtual optical drive;

2. There is only English in the installation path;

3, it is recommended to put the installation folder in the root directory of the system disk, note that the folder should be an English name;

4. If necessary, you can copy the “step7.Ssf” file in the “step7” folder in the installer to the upper folder, which means that you want to put this file in the installation file “setup.Exe”. Inside the folder.

What is the SSF file? There is no SSF file when installing the Siemens S7-300 plc programming software

The SSF file is a software description file from Siemens.
For missing SSF files you can do the following:
1. Copy from someone with a SSF file.
2, burn to CD installation
3. Go directly to the Step7 installation directory and run Setup to set up.
4. Unzip in the root directory to install.

Also ensure that your installation path does not contain Chinese characters.

SSF can not find the file always appears when installing STEP7

It is best to put the STEP7 installation files in the English directory.
One way is to move all the files from the installer to the root directory of a disk.
Or copy the “step7.Ssh” file in the “step7” folder in the installer to the upper folder, that is, put this file in the folder where the installation file “setup.Eye” is located. This will be allowed to happen when you install it again.

The values of M8004, M8037, M8061, M8066 in PLC program?

M8004 is an error alarm. When an error occurs in the PLC, such as power failure, hardware error, parameter, etc., M8004 is ON.
M8034 is all outputs in hexadecimal. When M8034 is ON, all outputs Y are stopped.
M8037 is forced STOP. When M8037 is ON, the status of the PLC is forced to STOP.
M8061 is a hardware error alarm.
M8066 is a loop error alarm.

What is the difference between the usage of m8004 in fx1n and the usage of m8004 in fx3ga?

How to use M8004 in Mitsubishi plc,

The PLC may report an error when an error occurs in the plc’s instruction. We first enter a correct command: input LD X0.

Connect an output component Y0 to X0. This instruction is correct. In order to learn about the M8004 alarm, we can add another wrong command.

Enter the command returned by a subroutine in the command: SRET, and then press the OK key.

In order to view the status of the M8004, we use the M8004 as a contact in the program to control the output of Y4.

After the program is written, press the Convert button to compile the program, then press the Simulate Test button to simulate the program.

When the program is transferred, you can see that the test window has indicated an error, and the auxiliary relay M8004 has also been activated.

What is the function of Mitsubishi FX2N series PLC M8000-M8255?

Mitsubishi FX2N series PLC M8000-M8255 function

M8000—Power-on has been ON mark
M8001—Power-on has been OFF flag
M8002—Power-on ON one scan cycle mark
M8003—Power-on OFF one scan cycle mark
M8004—PLC error
M8005—PLC backup battery low flag
M8011—1ms clock pulse
M8012—100ms clock pulse
M8013—1s clock pulse
M8014—1min clock pulse

What is the role of m8000 in Mitsubishi plc?

As long as the PLC is RUN, it is considered to be connected. It is generally used to drive the program that runs on power-on!

There are also some instructions in Mitsubishi (especially the rules in the sequence function diagram), some things can not be placed directly with the left bus.
The m8000 is used to achieve direct intersection with the left bus, and does not delay the normal operation of the program. M8000 When your PLC RUN is running, it is turned on. It is the flag. The function of PLC operation is generally applied to the starting point of the bus.

Here, I will see the part of the sequence function diagram.

Of course, most of what you can see is the program that is used to drive the power to run, or the program that needs to run when plc is running normally. Because some errors will stop plc, although the plc has electricity, the program can not run.

What does M8000-M8990 mean in the Mitsubishi series PLC?

PLC M8000-M8990 is a special internal relay of Mitsubishi PLC.

M8000 is a special auxiliary relay. m8000 is always closed during operation. m8001 and m8002 are initialization pulses. When plc is just started, it closes a cycle, but 8001 is normally closed, 8002 is normally open, m8011, 8012, 8013. It is a time pulse with periods of 10ms, 100ms, 1000ms (one second), m8020, m8021, m8022, which are standard real bits, representing benefits, zeros, and endings.

There are other special auxiliary relays, which are commonly used. If you want to know more, you need a programming manual.

M8000-Operation monitors normally open contacts, and the PLC is always ON when it is running.
M8001-Operation monitors normally closed contacts, and the PLC keeps OFF when it is running.
M8002 – Initialize pulse normally open contact, ON one scan cycle when PLC is running.
M8003 – Initialize pulse normally closed contact, OFF one scan cycle when PLC is running.
M8011, M8012, M8013, and M8014 generate clock pulses of 10ms, 100ms, 1s, and 1min, respectively.
Special auxiliary relay.

(2) Coil type. The PLC performs a specific action after the coil is driven by the user program.
M8033 – If its coil is energized, the output image memory and data register contents are maintained when the PLC is stopped.
M8034 – If the coil is energized, the output of the PLC is completely disabled.
M8039 – If its coil is energized, the PLC will operate according to the scan time specified in D8039.

How to check the status of each register or timer when gx works2 is compiled?

If you are using the device memory monitor function in GX Works2,You need to open your program with GX Works2 software, click on a device, right click, select “Device/Buffer Memory Batch Monitor” in “Online”, or find “Online” on the menu bar, select “Monitor” “Device/buffer memory batch monitoring”

How to input the timer command in Mitsubishi PLC programming software

If you want to enter a timer command, you should click the “-O-” button because the timer is handled as a coil.
Then enter data such as “t0 k100” format

In addition, the timers and counters of Mitsubishi plc are coil instructions instead of function instructions.

X0 is closed. The timer starts timing, and X0 is off. The timer is reset. X1 turns on the counter for a number of times, X1 turns the counter on again to count a number, and X2 closes the counter to reset.