en-us_products:mp_studio:device_clock

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en-us_products:mp_studio:device_clock [2026/11/05 12:39] – created - external edit 127.0.0.1en-us_products:mp_studio:device_clock [2026/11/12 20:37] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== MP STUDIO 2 · Device Clock (RTC) ======+====== MP STUDIO 2 · PLC Clock (RTC) ======
  
-The device clock has the device put the date and time of an external DS3231 clock module connected to it into 16 words of the D area every 0.1 seconds, so that the ladder can read them directly (V1.2.0 and later). It also provides a window for setting the clock to the PC time, and an internal clock with which the device keeps time by itself when there is no clock module.+The PLC clock has the PLC write the date and time of an external DS3231 clock module connected to it into 16 words of the D area every 0.1 seconds, so that the ladder can read them directly (V1.2.0 and later). It also provides a window for setting the clock to the PC time, and an internal clock with which the PLC keeps time by itself when there is no clock module.
  
-The device has no built-in clock module, so connect a DS3231 module (I²C address 0x68) to the I²C terminals of the device. Check the connection pins on the page of each product. The module shares the same lines with other I²C devices such as a character LCD.+The PLC has no built-in clock module, so connect a DS3231 module (I²C address 0x68) to the I²C terminals of the PLC. Check the connection pins on each product's page. The module shares its lines with other I²C devices such as a character LCD.
  
 ===== Turning It On ===== ===== Turning It On =====
  
-  - Select **Setting → RTC (Clock)…**. +  - Select **Settings → RTC (Clock)…**. 
-  - Turn on **Use device clock (RTC)**.+  - Turn on **Use PLC clock (RTC)**.
   - Enter a D area address in **Start address** (default ''D100''). The 16 words from the start address (''D100'' to ''D115'') are used.   - Enter a D area address in **Start address** (default ''D100''). The 16 words from the start address (''D100'' to ''D115'') are used.
-  - Click **OK**, then download the program. After the download, the device updates the time every 0.1 seconds.+  - Click **OK**, then download the program. After the download, the PLC updates the time every 0.1 seconds.
  
 {{ :en-us_products:mp_studio:rtc-settings.png?640 |Figure 1. The RTC (Clock) window }} {{ :en-us_products:mp_studio:rtc-settings.png?640 |Figure 1. The RTC (Clock) window }}
  
-The bottom of the window shows the flash and RAM this feature uses and its processing time (about 0.4 ms every 0.1 seconds). When it is off, the compiled program does not change by a single byte. Click **Add Names to Symbol Table** to add the names ''RTC_YEAR'' … ''RTC_REQ'' to the symbol table, so that you can use names instead of addresses in the ladder (optional).+The bottom of the window shows the flash and RAM this feature uses and its processing time (about 0.4 ms every 0.1 seconds). When it is off, the compiled program does not change by a single byte. Click **Add names to the symbol table** to add the names ''RTC_YEAR'' … ''RTC_REQ'' to the symbol table, so that you can use names instead of addresses in the ladder (optional).
  
 ===== Layout of the 16 Words ===== ===== Layout of the 16 Words =====
Line 20: Line 20:
 Values are stored as decimal numbers. The tables below are for a start address of ''D100''. Values are stored as decimal numbers. The tables below are for a start address of ''D100''.
  
-^ Address ^ Read (written by the device every 0.1 s) ^ Range ^+^ Address ^ Read (written by the PLC every 0.1 s) ^ Range ^
 | ''D100'' | Year | 2000 to 2099 | | ''D100'' | Year | 2000 to 2099 |
 | ''D101'' | Month | 1 to 12 | | ''D101'' | Month | 1 to 12 |
Line 28: Line 28:
 | ''D105'' | Minute | 0 to 59 | | ''D105'' | Minute | 0 to 59 |
 | ''D106'' | Second | 0 to 59 | | ''D106'' | Second | 0 to 59 |
-| ''D107'' | Status | 0 OK · 1 no module (internal clock) · 2 has stopped |+| ''D107'' | Status | 0 OK · 1 no module (internal clock) · 2 stopped before |
  
 ^ Address ^ Set (written by PC, HMI or ladder) ^ Description ^ ^ Address ^ Set (written by PC, HMI or ladder) ^ Description ^
Line 34: Line 34:
 | ''D115'' | Set request | Write 1 to set the clock. It becomes 0 when done, or 2 if a value is invalid (the clock is unchanged). | | ''D115'' | Set request | Write 1 to set the clock. It becomes 0 when done, or 2 if a value is invalid (the clock is unchanged). |
  
-To set the time from the ladder or an HMI, write the values to set to ''D108'' to ''D114'', then write 1 to ''D115''. A status of 2 means that the clock has stopped at some point, for example because the module battery was removed, so set the time again.+To set the time from the ladder or an HMI, write the new time values to ''D108'' to ''D114'', then write 1 to ''D115''. A status of 2 means that the clock has stopped at some point, for example because the module battery was removed, so set the time again.
  
 ===== Setting the Clock to the PC Time ===== ===== Setting the Clock to the PC Time =====
  
-  - Start monitoring (''Ctrl+M'') a device to which you downloaded the program with the device clock turned on. You can also do this during simulation. +  - Download the program with the PLC clock turned on, then start monitoring the PLC (''Ctrl+M''). You can also set the clock during simulation. 
-  - Select **Run → Set Device Clock…**. +  - Select **Run → Set PLC Clock…**. 
-  - Click **Set to PC Time**.+  - Click **Set to PC time**.
  
-{{ :en-us_products:mp_studio:rtc-sync.png?540 |Figure 2. The Set Device Clock window (shown with the virtual clock because a simulation is running) }}+{{ :en-us_products:mp_studio:rtc-sync.png?540 |Figure 2. The Set PLC Clock window (shown with the virtual clock because a simulation is running) }}
  
-The window shows the PC time, the device time and the difference between them ("In sync (±1 s)", or "Device N behind" or "Device N ahead"). The time is sent so that it arrives just as the next second begins, and after setting, the device time is read again to confirm that it was actually set.+The window shows the PC time, the PLC time and the difference between them ("In sync (±1 s)", "PLC N behind" or "PLC N ahead"). The time is sent so that it arrives just as the next second begins, and after setting, the PLC time is read again to confirm that it was actually set.
  
-  * You can set the clock only when the device clock is turned on, monitoring or simulation is running, and the program on the device is confirmed to be the same as this project. If these conditions are not met, the button is disabled and the reason is shown in one line. +  * You can set the clock only when the PLC clock is turned on, monitoring or simulation is running, and the program on the PLC is confirmed to be the same as this project. If these conditions are not met, the button is disabled and the reason is shown in one line. 
-  * Whether the program on the device is the same is confirmed from the record of downloading this program to that port (COM or IP) with MP STUDIO 2 on this PC. If it cannot be confirmed, download and then turn monitoring on again. +  * Whether the program on the PLC matches this project is confirmed from the record of downloading this program to that port (COM or IP) with MP STUDIO 2 on this PC. If it cannot be confirmed, download the program and turn monitoring on again. 
-  * If there is no clock module, the internal clock of the device is set, and you are told that the time is lost when the power is turned off.+  * If there is no clock module, the internal clock of the PLC is set, and you are told that the time is lost when the power is turned off.
   * The S1 port does not accept value writes, so the clock cannot be set through it. Connect through the download port.   * The S1 port does not accept value writes, so the clock cannot be set through it. Connect through the download port.
  
 ===== Check When Monitoring Starts ===== ===== Check When Monitoring Starts =====
  
-When you turn on monitoring of a real device and the device time differs from the PC by 5 seconds or more, you are asked once, with a question such as "The device clock is N behind the PC — set it to the PC time?". Click **Yes** to set the clock in the same way as above. If the clock has stopped at some point (status 2), a question asking you to check the module battery is shown instead. The question is asked only when the program on the device is confirmed to be the same as this project, and never during simulation.+When you turn on monitoring of a real PLC and the PLC time differs from the PC by 5 seconds or more, you are asked once, with a question such as "The PLC clock is N behind the PC — set it to the PC time?" Click **Yes** to set the clock the same way as above. If the clock has stopped at some point (status 2), a question asking you to check the module battery is shown instead. The question is asked only when the program on the PLC is confirmed to be the same as this project, and never during simulation.
  
 ===== When There Is No Clock Module (Internal Clock) ===== ===== When There Is No Clock Module (Internal Clock) =====
  
-  * If the module is missing, is removed or cannot be read, the status becomes 1, and the device counts the time by itself and keeps updating it. The scan does not stop.+  * If the module is missing, is removed or cannot be read, the status becomes 1, and the PLC counts the time by itself and keeps updating it. The scan does not stop.
   * If the power is turned on without a module, the clock counts from 2000-01-01 00:00:00. The time is lost when the power is turned off.   * If the power is turned on without a module, the clock counts from 2000-01-01 00:00:00. The time is lost when the power is turned off.
   * When the module is plugged back in, the clock follows the module's time. It also follows a module that lost its time because it has no battery, so set the time again.   * When the module is plugged back in, the clock follows the module's time. It also follows a module that lost its time because it has no battery, so set the time again.
-  * The internal clock is less accurate than the module (about -2.3 seconds a day on one device).+  * The internal clock is less accurate than the module (about -2.3 seconds a day on one PLC).
  
 ===== Simulation ===== ===== Simulation =====
Line 69: Line 69:
  
   * If the 16-word block overlaps a retentive (EEPROM) D range, the program can be neither compiled nor downloaded, because the time words change constantly and would quickly shorten the life of the EEPROM. Move the block outside the retentive range or shrink the range ([[:en-us_products:mp_studio:memory_symbols#data_memory|Data Memory]]).   * If the 16-word block overlaps a retentive (EEPROM) D range, the program can be neither compiled nor downloaded, because the time words change constantly and would quickly shorten the life of the EEPROM. Move the block outside the retentive range or shrink the range ([[:en-us_products:mp_studio:memory_symbols#data_memory|Data Memory]]).
-  * If the ladder writes to the read words (''D100'' to ''D107''), or receiving cells of the [[:en-us_products:mp_studio:modbus_device_table|Modbus device table]] overlap the block, a yellow warning is shown. The warning does not prevent compiling.+  * If the ladder writes to the read words (''D100'' to ''D107''), or the receiving cells of the [[:en-us_products:mp_studio:modbus_device_table|Modbus device table]] overlap the block, an orange warning is shown. The warning does not prevent compiling.
   * The clock module uses the SDA pin, so that pin cannot be used as a counter or encoder input.   * The clock module uses the SDA pin, so that pin cannot be used as a counter or encoder input.
-  * A project file (''.mpx'') that uses the device clock cannot be opened in V1.1.0.+  * A project file (''.mpx'') that uses the PLC clock cannot be opened in V1.1.0.
  
 ===== Related Pages ===== ===== Related Pages =====
en-us_products/mp_studio/device_clock.1793849997.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki