User Tools

Site Tools


en-us_products:mpino_studio2:memory

Differences

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

Link to this comparison view

Next revision
Previous revision
en-us_products:mpino_studio2:memory [2026/09/08 15:05] – 만듦 - 바깥 편집 127.0.0.1en-us_products:mpino_studio2:memory [2026/09/14 12:24] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== MPINO STUDIO 2 Phase 2 · Understand Memory ====== ====== MPINO STUDIO 2 Phase 2 · Understand Memory ======
  
-This guide introduces memory to first-time MPINO Studio 2 users. Open the project from Phase 1 and learn the differences between **P, M, D, C, T, and R memory**, address notation, memory-region settings, the Used Memory Map, and time-driven special contacts.+This page explains the differences between **P, M, D, C, T, and R memory**, address notation, memory-region settings, where memory is used in a project, and special-bit memory.
  
-^ Application ^ Reference board ^ Completion goal ^ +{{ :en-us_products:mpino_studio2:memory-learning-path.svg?1000 |Memory understanding sequence }}
-| MPINO Studio 2 | MPINO-8A4R(T)-S | Identify memory addresses and locate where they are used in a project | +
- +
-{{ :en-us_products:mpino_studio2:memory-learning-path.svg?1000 |Phase 2 memory learning path }}+
  
 > **About screenshots:** Screenshots use the Korean user interface. Button positions, icons, and keyboard shortcuts are the same. > **About screenshots:** Screenshots use the Korean user interface. Button positions, icons, and keyboard shortcuts are the same.
  
-===== 1. Before You Begin =====+===== 1. PLC Memory Basics =====
  
-Prepare the following:+Unlike Arduino programs, PLC programs use P, M, D, C, T, and R memory. Arduino code can allocate variables from the remaining SRAM after the PLC memory regions have been allocated.
  
-  * A PC with MPINO Studio 2 installed +Memory holds input states, internal conditions, calculation results, timer values, and other data while the program runs. Ladder logic and Arduino C code in MPINO Studio 2 can share and use this memory.
-  * The ''.mp2'' project saved in Phase 1 +
-  * An MPINO-8A4R(T)-S board +
-  * An MP download cable if you will run the final flashing exercise on the board+
  
-You can complete most of this guide without connecting board. For the upload exercisedisconnect output loads first and verify the board and port used in Phase 1.+A basic address consists of **region letter followed by a zero-based number**. For example, ''M10'' is the eleventh address in the M region, and ''D0'' is the first address in the D region.
  
-After this phase, you will be able to:+{{ :en-us_products:mpino_studio2:memory-overview.svg?1000 |Comparison of the P M D C T and R memory regions }}
  
-  * Identify the kind of value stored from the first letter of an address. +^ Region ^ Unit ^ Storage form ^ Value range ^ 
-  * Choose BIT, BYTE, WORD, or DWORD for the required value range. +| ''P''BIT | Digital input or output state on the board | 0 or 1 | 
-  * Split an address such as ''WM1.3'' into widthregionindex, and bit number. +''M'' | BIT | Internal BIT memory | 0 or 1 | 
-  * Inspect memory-region sizes and estimated SRAM use. +| ''D'' | WORD | Signed internal WORD memory | -32,768 to 32,767 | 
-  * Find every project location that uses a specific address. +| ''C'' | WORD | Counter value (signed internal WORD memory) | -32,768 to 32,767 | 
-  * Explain the timing difference between ''@100'' and ''@F1000''.+''T'' | WORD | Current timer value (signed internal WORD memory) | -32,768 to 32,767 | 
 +''R'' | Floating Point (32 bits) | Internal Floating Point memory (real-number memory) | Approximately -3.4028235E38 to +3.4028235E38 |
  
-===== 2. What Is Memory? =====+==== Sharing Memory Between Arduino Code and Ladder Logic ====
  
-Memory holds input states, internal conditions, calculation results, timer values, and other data while the program runs. Ladder logic and Arduino code in MPINO Studio 2 can use the same memory.+Ladder logic and Arduino code use the same storage for P, M, D, C, T, and R memory. A value written on one side can be read from the same address on the other side.
  
-A basic address consists of **a region letter followed by a zero-based number**For example, ''M10'' is the eleventh address in the M region, and ''D0'' is the first address in the D region.+{{ :en-us_products:mpino_studio2:memory-sharing.svg?1000 |Arduino code and ladder logic sharing the same PLC memory }}
  
-{{ :en-us_products:mpino_studio2:memory-overview.svg?1000 |Comparison of the P M D C T and R memory regions }}+In Arduino code, use the ladder address name directly or write it in array formBoth forms refer to the same memory.
  
-^ Region ^ Basic unit ^ Stored value ^ Beginner guideline ^ +  * Ladder ''M0'' ↔ Arduino code ''M0'' or ''M[0]'' 
-''P'' | BIT | Digital input or output state on the board | Check the selected board's pin map for the physical terminal and direction. | +  * Ladder ''D0'' ↔ Arduino code ''D0'' or ''D[0]'' 
-''M'' | BIT | Internal ON/OFF state not directly connected to a terminal | Use for run permissions, sequence states, interlock results, and other auxiliary conditions. | +  * Ladder ''R0'' ↔ Arduino code ''R0'' or ''R[0]''
-''D'' | WORD | Signed integers and calculation results | Use for quantities, setpoints, and converted sensor values handled as integers. | +
-''C'' | WORD | Counter values | First check whether the selected board maps the C address to an analog input, PWM output, or another board feature. | +
-''T'' | WORD | Elapsed timer values | Stores time data used by ladder timers. | +
-''R'' | 32-bit real | Values with a decimal point | Use for temperature, ratios, and scaled values that require floating-point calculations. |+
  
-**P address caution:** ''P0'' does not mean an input on every boardThe I/O direction and physical terminal follow the board definition selected for the project.+<code cpp> 
 +void loop() { 
 +  M0 = true;    // Sets the M0 bit contact in the ladder to ON. 
 +  D0 = 120;     // Shares the D0 integer between ladder and Arduino code. 
 +  R0 = 23.5f;   // Shares the R0 floating-point value between both sides.
  
-> **Comparing R values:** Floating-point calculations can produce small rounding differences. Use a suitable tolerance when a control decision depends on a calculated real value.+  ladderLoop(); // Runs the ladder logic with the values stored above. 
 +
 +</code>
  
-===== 3Default Memory on MPINO-8A4R(T)-S =====+A value changed by ladder logic can be read in Arduino code after ''ladderLoop()'' finishes. Within one scan, read and write order follows the position of the ''ladderLoop()'' call inside ''loop()''
 + 
 +> **I/O mapping caution:** The P region and C addresses mapped to board functions are synchronized with physical I/O during a ladder scan. Before sharing these regions with Arduino code, check the address and I/O direction under **Settings → Ladder Pin Map Settings**. 
 + 
 +> **P address caution:** P addresses can be reviewed and changed in **Board Pin Editing**. Their I/O directions and physical terminals follow the definition of the board selected for the project. 
 + 
 +> **R value error caution:** Because of the limits of 32-bit floating-point arithmetic, ''0.1 + 0.2'' may be stored as approximately ''0.30000001'' instead of exactly ''0.3''. This characteristic must be considered on controllers that use IEEE 754 32-bit floating point. 
 + 
 +===== 2. Memory Regions =====
  
 The MPINO-8A4R(T)-S board uses these default memory counts: The MPINO-8A4R(T)-S board uses these default memory counts:
 +
 +You can change the number of addresses used under **Settings → Memory Region Settings**. (Shortcut: ''Ctrl + Shift + M'')
 +
 +{{ :products:mpino_studio2:memory-settings-modal.png?430 |Figure 1. Memory Region Settings showing the address counts and estimated SRAM use }}
  
 ^ Region ^ Default count ^ Default address range ^ ^ Region ^ Default count ^ Default address range ^
Line 61: Line 70:
 | ''T'' | 128 | ''T0'' to ''T127'' | | ''T'' | 128 | ''T0'' to ''T127'' |
 | ''R'' | 50 | ''R0'' to ''R49'' | | ''R'' | 50 | ''R0'' to ''R49'' |
 +
 +**Memory Region Settings:** Blank P, M, D, C, T, and R fields use the board defaults. Entering a value changes the count for that project. The bottom of the dialog shows estimated SRAM use together with total SRAM.
  
 Do not confuse a count with the last address. Numbering begins at zero, so 200 D addresses run from ''D0'' through ''D199''. Do not confuse a count with the last address. Numbering begins at zero, so 200 D addresses run from ''D0'' through ''D199''.
Line 66: Line 77:
 ==== C Region and Board Pin Mapping ==== ==== C Region and Board Pin Mapping ====
  
-The beginning of the C region is assigned to board functions on MPINO-8A4R(T)-S.+On MPINO-8A4R(T)-S, analog inputs, NTC temperature inputs, and PWM are connected to ''C0'' through ''C10'' memory. 
 + 
 +You can change the mapped memory under **Settings → Ladder Pin Map Settings**. 
 + 
 +> **Analog/PWM output caution:** When memory is mapped to an analog or PWM output, the value at the mapped address drives that output. You therefore cannot use ''analogWrite''-related functions for the same output in Arduino code. To use an ''analogWrite''-related function, clear **Use** for that output under **Settings → Ladder Pin Map Settings**.
  
 {{ :en-us_products:mpino_studio2:memory-c-map-8a4r-s.svg?1000 |C memory and board pin mapping on MPINO-8A4R(T)-S }} {{ :en-us_products:mpino_studio2:memory-c-map-8a4r-s.svg?1000 |C memory and board pin mapping on MPINO-8A4R(T)-S }}
Line 76: Line 91:
 | ''C11'' to ''C99'' | Remaining C region not directly assigned above | Confirm the intended use before selecting an address | | ''C11'' to ''C99'' | Remaining C region not directly assigned above | Confirm the intended use before selecting an address |
  
-> **Critical check:** If you choose ''C0'' through ''C10'' as ordinary counter addresses on this board, their data can overlap with the board functions that use the same addresses. Before assigning a counter, inspect both the **pin map** under Board/Memory Information and the **Used Memory Map**.+> **Critical check:** If you choose ''C0'' through ''C10'' as ordinary counter addresses on this board, their data can overlap with the board functions that use the same addresses. Before assigning a counter, check **Settings → Ladder Pin Map Settings** and **Settings → Used Memory**.
  
-Other MPINO products can have different memory counts and pin mappingsDo not reuse this address table in another board project without checking that board.+Mapped addresses vary by board and can also be changed by the userCheck them under **Settings → Ladder Pin Map Settings**.
  
-===== 4Understand Data Widths =====+===== 3. Data Types =====
  
 Data width is the number of bits read or stored at one time. It determines the available value range and memory use. Data width is the number of bits read or stored at one time. It determines the available value range and memory use.
Line 96: Line 111:
 When selecting a width, consider the largest value after calculations. A value incremented every 1 ms for one day reaches 86,400,000 and therefore exceeds the WORD range. When selecting a width, consider the largest value after calculations. A value incremented every 1 ms for one day reaches 86,400,000 and therefore exceeds the WORD range.
  
-===== 5. Read Memory Addresses =====+===== 4. Read Memory Addresses =====
  
-Read a long address from left to right as a **data-width prefix**, **memory region**, **address index**, and **bit number**.+Read memory addresses by starting with the simplest form and adding the required elements one at a time.
  
-{{ :en-us_products:mpino_studio2:memory-addressing.svg?1000 |How to read each part of WM1.}}+{{ :en-us_products:mpino_studio2:memory-addressing.svg?1000 |The M0, D0, D0.1, and WM1.2 memory address formats }}
  
-For example, ''WM1.3'' means:+  - ''M0'': BIT address 0 in the M region. 
 +  - ''D0'': WORD address 0 in the D region. 
 +  - ''D0.1'': the second bit in the D0 WORD. Bit numbering starts at zero. 
 +  - ''WM1.2'': the third bit in ''WM1'', the WORD view of the M region. It refers to the same bit as ''M18''.
  
-  - ''W'': view the data with WORD width. +==== Memory Structure ====
-  - ''M'': use the internal-bit memory region. +
-  - ''1'': use address-group index 1. +
-  - ''.3'': select the fourth bit in that WORD. Bit numbering also begins at zero.+
  
-==== Width Prefixes and Bit Access ====+This diagram shows the memory structure for bits, bytes, words, double words, and floating-point values.
  
-^ Notation ^ Supported regions ^ Examples ^ +{{ :en-us_products:mpino_studio2:memory-structure.svg?1000 |How and bits and D C and WORDs combine into BYTE WORD and DWORD views }}
-''B'' prefix | ''P'', ''M'' | ''BP0'', ''BM1''+
-| ''W'' prefix | ''P'', ''M'' | ''WP0'', ''WM1''+
-| ''D'' prefix | ''P'', ''M'', ''D'', ''C'', ''T'' | ''DM0'', ''DD2'', ''DC31''+
-| ''.n'' bit number | P/M width views, ''D'', ''C'' | ''WM1.3'', ''D0.15'' |+
  
-In ''DD2'', the first ''D'' is the **DWORD width prefix** and the second ''D'' is the **D memory region**. Read the two letters by their separate roles.+The P and M regions group individual BIT addresses in sets of 8, 16, or 32 for BYTE, WORD, and DWORD views. The lowest address is the least significant bit, so ''WM0.0'' refers to ''M0''and ''WM1.3'' refers to ''M19''.
  
-The following forms are not supported:+Each D, C, or T address is one WORD. Two consecutive WORDs form a DWORD''DD0'' combines ''D0'' and ''D1'', while ''DD1'' combines ''D2'' and ''D3''. C and T use the same rule through forms such as ''DC0'' and ''DT0''.
  
-  * A ''B'' or ''W'' prefix on D, C, or T, such as ''BD0'' +===== 5Find Memory Used by the Project =====
-  * Any width prefix on R +
-  * ''.n'' bit access on R+
  
-If the address editor reports an errorcheck whether that memory region supports the selected width and bit access before changing only the spelling.+Select **Settings → Used Memory**or press ''Ctrl+Shift+L''.
  
-===== 6. Inspect Memory-Region Sizes ===== +{{ :products:mpino_studio2:memory-map-modal.png?800 |Figure 2. Addresses and references in Used Memory }}
- +
-Select **Settings → Memory Region Settings**, or press ''Ctrl+Shift+M''+
- +
-{{ :products:mpino_studio2:memory-settings-modal.png?650 |Figure 1. Memory Region Settings dialog }} +
- +
-Check the dialog in this order: +
- +
-  - Confirm that the current project board is **MPINO-8A4R(T)-S**. +
-  - Review the counts in the P, M, D, C, T, and R fields. +
-  - A field left blank uses the selected board's default value. +
-  - Review the estimated SRAM use and total SRAM at the bottom. +
-  - If the total is exceeded, the indicator turns red and the settings cannot be saved. +
-  - If a change is required, enter the value and select **Save**. +
-  - Close the dialog and press ''Ctrl+S'' to store the change in the ''.mp2'' project. +
- +
-Keep the board defaults unless the project has a clear reason to change them. Increasing a count provides more addresses but consumes more SRAM. Reducing a count can leave an existing ladder cell or Arduino C reference outside the valid range, so inspect the Used Memory Map before and after the change. +
- +
-===== 7. Find Memory Used by the Project ===== +
- +
-Select **View → Used Memory Map**, or press ''Ctrl+Shift+L''+
- +
-{{ :products:mpino_studio2:memory-map-modal.png?800 |Figure 2. Addresses and references in the Used Memory Map }} +
- +
-Use the map as follows: +
- +
-  - Select the ''P'', ''M'', ''D'', ''C'', ''T'', or ''R'' tab. +
-  - Narrow the results with the ladder and code source filters. +
-  - Enter an address in the search field and press ''Enter''+
-  - A colored address cell means that the current project uses that memory. +
-  - Select a used cell to display its references below the grid. +
-  - Select a reference to jump to the ladder cell or code location. +
-  - The selected tab and scroll position remain when the dialog is reopened. They reset when the application restarts. +
- +
-==== Check the Phase 1 Project ==== +
- +
-  - Open the project saved in Phase 1. +
-  - Press ''Ctrl+Shift+L''+
-  - Select the ''P'' tab. +
-  - Confirm that ''P0'' and ''P32'' are marked as used. +
-  - Select ''P0'' and confirm the NO contact reference in ''ladderLoop''+
-  - Select ''P32'' and confirm the output-coil reference.+
  
 Inspecting this map before reassigning an address or reducing a memory-region size helps prevent duplicate use and out-of-range references. Inspecting this map before reassigning an address or reducing a memory-region size helps prevent duplicate use and out-of-range references.
  
-===== 8Time-Driven Special Contacts =====+===== 6. Special-Bit Memory =====
  
-A special contact beginning with ''@'' is updated automatically as time passes. It is different from an ordinary P or M memory address. +Special-bit memory beginning with ''@'' is updated automatically by MPINO Studio 2. It can be used in ladder bit contacts.
- +
-{{ :en-us_products:mpino_studio2:special-memory-timing.svg?1000 |Timing comparison of the @100 and @F1000 special contacts }}+
  
 ^ Format ^ Operation ^ Example ^ ^ Format ^ Operation ^ Example ^
 +| ''@ON'' | Always ON | Keeps a bit contact true |
 +| ''@OFF'' | Always OFF | Keeps a bit contact false |
 | ''@<ms>'' | Turns ON for one scan once each specified time boundary | ''@100'' is ON for one scan every 100 ms | | ''@<ms>'' | Turns ON for one scan once each specified time boundary | ''@100'' is ON for one scan every 100 ms |
 | ''@F<ms>'' | Repeats ON for the specified duration, then OFF for the same duration | ''@F1000'' repeats 1 second ON and 1 second OFF | | ''@F<ms>'' | Repeats ON for the specified duration, then OFF for the same duration | ''@F1000'' repeats 1 second ON and 1 second OFF |
 +
 +''@ON'' and ''@OFF'' are case-insensitive, so ''@on'' and ''@off'' are also valid.
 +
 +{{ :en-us_products:mpino_studio2:special-memory-timing.svg?1000 |Timing comparison of @100 and @F1000 special-bit memory }}
  
 ''@100'' still produces one ON scan when the program scan crosses a 100 ms boundary without landing exactly on it. It can start an operation or increment a value at regular intervals. ''@100'' still produces one ON scan when the program scan crosses a 100 ms boundary without landing exactly on it. It can start an operation or increment a value at regular intervals.
Line 186: Line 158:
 ''@F1000'' provides a repeating one-second condition without code that manually toggles a state. ''@F1000'' provides a repeating one-second condition without code that manually toggles a state.
  
-{{ :products:mpino_studio2:special-relay-example.png?500 |Figure 3. A special contact entered in a ladder cell }}+{{ :products:mpino_studio2:special-relay-example.png?420 |Figure 3. Special-bit memory entered in a ladder cell }}
  
 Follow these input rules: Follow these input rules:
  
-  * The time unit is milliseconds (ms).+  * The time unit for ''@<ms>'' and ''@F<ms>'' is milliseconds (ms).
   * Do not use parentheses. Enter ''@F1000'', not ''@F(1000)''.   * Do not use parentheses. Enter ''@F1000'', not ''@F(1000)''.
-  * Use special contact only in a contact or rising/falling-edge cell.+  * Use special-bit memory only in bit contacts.
   * Do not enter it as an output-coil address.   * Do not enter it as an output-coil address.
-  * An arbitrary name such as ''@ON'' is not valid. 
- 
-===== 9. Exercise · Flash P32 Once Per Second ===== 
- 
-Replace the ''P0'' contact in the Phase 1 circuit with an ''@F1000'' special contact. 
- 
-  - Open the Phase 1 project and use **File → Save As** to save ''phase2-memory.mp2''. 
-  - Confirm that output loads are disconnected. 
-  - Select the ''P0'' contact cell in ''ladderLoop''. 
-  - Press ''Enter'' or double-click to open the cell editor. 
-  - Change the address to ''@F1000'' and confirm it. 
-  - Keep ''P32'' as the output-coil address. 
-  - Press ''Ctrl+R'' and confirm that the build finishes successfully. 
-  - Connect the MP download cable and select the port at the lower right. 
-  - Press ''Ctrl+U'' to upload. 
-  - If you configured a monitoring port in Phase 1, press ''Ctrl+M'' to enable real-time ladder monitoring. 
-  - Confirm that the ''@F1000'' contact and ''P32'' coil repeat approximately 1 second ON and 1 second OFF. 
- 
-To resume the physical-input test afterward, restore the contact address to ''P0'', then build and upload again. 
- 
-===== 10. Choose Memory by Situation ===== 
- 
-^ Value to store ^ Region to check first ^ What to verify ^ 
-| Physical digital input or output | ''P'' | Pin map and I/O direction for the selected board | 
-| Internal ladder ON/OFF condition | ''M'' | Whether another circuit already uses the same address | 
-| General integer or calculation result | ''D'' | Whether the result exceeds the WORD range | 
-| Current counter value | ''C'' | Whether the C address overlaps with a mapped board pin | 
-| Elapsed timer value | ''T'' | Whether the same timer address is used twice | 
-| Value with a decimal point | ''R'' | A comparison tolerance suitable for floating-point calculations | 
-| Periodic contact condition | ''@<ms>'', ''@F<ms>'' | Whether one scan or a repeating ON/OFF state is required | 
- 
-===== 11. Completion Checklist ===== 
- 
-You have completed Phase 2 when you can explain or verify every item below. 
- 
-  * Distinguish the purposes of ''P'', ''M'', ''D'', ''C'', ''T'', and ''R''. 
-  * Explain that ''C0'' through ''C10'' are mapped to board functions on MPINO-8A4R(T)-S. 
-  * Identify the size and signed range of BIT, BYTE, WORD, and DWORD. 
-  * Read ''WM1.3'' and ''DD2'' by the role of each character. 
-  * Open Memory Region Settings with ''Ctrl+Shift+M''. 
-  * Find the ''P0'' and ''P32'' references with ''Ctrl+Shift+L''. 
-  * Explain the difference between ''@100'' and ''@F1000''. 
-  * Save the exercise as a separate project and verify the build result. 
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
Line 243: Line 172:
 | An entered address is rejected. | Check the region letter, address range, B/W/D prefix support, and ''.n'' bit-access support. | | An entered address is rejected. | Check the region letter, address range, B/W/D prefix support, and ''.n'' bit-access support. |
 | Memory Region Settings cannot be saved. | Check whether estimated SRAM use exceeds total SRAM and is shown in red. | | Memory Region Settings cannot be saved. | Check whether estimated SRAM use exceeds total SRAM and is shown in red. |
-| An address does not appear in the Used Memory Map. | Select the correct region tab and ladder/code filters, enter the address, and press ''Enter''. |+| An address does not appear in Used Memory. | Select the correct region tab and ladder/code filters, enter the address, and press ''Enter''. |
 | A C counter value is unexpected. | First check for overlap with the ''C0'' through ''C10'' board pin mapping on MPINO-8A4R(T)-S. | | A C counter value is unexpected. | First check for overlap with the ''C0'' through ''C10'' board pin mapping on MPINO-8A4R(T)-S. |
-| ''@F1000'' cannot be entered. | Confirm that the selected cell is a contact or edge cell, not an output coil, and that no parentheses are present. | +| ''@F1000'' cannot be entered. | Confirm that the selected cell is a bit contact and that no parentheses are present. |
-| P32 does not flash. | Confirm that ''@F1000'' and the ''P32'' coil are in the same circuit and that build, port selection, and upload all completed successfully. |+
  
 ===== Related Documentation ===== ===== Related Documentation =====
 +
 +  * [[en-us_products:mpino_studio2:activity_bar|Phase 8 · Activity Bar and Side Panels]]
 +
 +  * [[en-us_products:mpino_studio2:menus_settings|Phase 7 · Menus and Preferences]]
 +
 +  * [[en-us_products:mpino_studio2:monitoring|Phase 6 · Serial and Ladder Monitoring]]
  
   * [[:en-us_products:mpino_studio2:first_project|Phase 1 · Create Your First Project]]   * [[:en-us_products:mpino_studio2:first_project|Phase 1 · Create Your First Project]]
en-us_products/mpino_studio2/memory.1788847532.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki