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

Both sides previous revisionPrevious revision
Next revision
Previous revision
en-us_products:mpino_studio2:memory [2026/09/08 15:43] – 바깥 편집 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 page explains 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.
  
-^ Reference board ^ Completion goal ^ +{{ :en-us_products:mpino_studio2:memory-learning-path.svg?1000 |Memory understanding sequence }}
-| 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. What Is Memory=====+===== 1. PLC Memory Basics ===== 
 + 
 +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.
  
 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. 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.
Line 26: Line 25:
 | ''R'' | Floating Point (32 bits) | Internal Floating Point memory (real-number memory) | Approximately -3.4028235E38 to +3.4028235E38 | | ''R'' | Floating Point (32 bits) | Internal Floating Point memory (real-number memory) | Approximately -3.4028235E38 to +3.4028235E38 |
  
-> **P address caution:** ''P0'' does not mean an input on every board. The I/O direction and physical terminal follow the board definition selected for the project.+==== Sharing Memory Between Arduino Code and Ladder Logic ====
  
-> **Comparing values:** Floating-point calculations can produce small rounding differencesUse a suitable tolerance when a control decision depends on a calculated real value.+Ladder logic and Arduino code use the same storage for P, M, D, C, T, and memoryvalue written on one side can be read from the same address on the other side.
  
-===== 2Default Memory on MPINO-8A4R(T)-=====+{{ :en-us_products:mpino_studio2:memory-sharing.svg?1000 |Arduino code and ladder logic sharing the same PLC memory }} 
 + 
 +In Arduino code, use the ladder address name directly or write it in array form. Both forms refer to the same memory. 
 + 
 +  * Ladder ''M0'' ↔ Arduino code ''M0'' or ''M[0]'' 
 +  * Ladder ''D0'' ↔ Arduino code ''D0'' or ''D[0]'' 
 +  * Ladder ''R0'' ↔ Arduino code ''R0'' or ''R[0]'' 
 + 
 +<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. 
 + 
 +  ladderLoop(); // Runs the ladder logic with the values stored above. 
 +
 +</code> 
 + 
 +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 41: 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 46: 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 56: 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**.
  
-===== 3. Understand 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 78: Line 113:
 ===== 4. 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''.
  
-===== 5. 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. +
- +
-===== 6. 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.
  
-===== 7Time-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 166: 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. 
- 
-===== 8. 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. 
- 
-===== 9. 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 | 
- 
-===== 10. 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 223: 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.1788849790.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki