This is an old revision of the document!
Table of Contents
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.
| Reference board | Completion goal |
|---|---|
| MPINO-8A4R(T)-S | Identify memory addresses and locate where they are used in a project |
About screenshots: Screenshots use the Korean user interface. Button positions, icons, and keyboard shortcuts are the same.
1. What Is 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.
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.
| Region | Unit | Storage form | Value range |
|---|---|---|---|
P | BIT | Digital input or output state on the board | 0 or 1 |
M | BIT | Internal BIT memory | 0 or 1 |
D | WORD | Signed internal WORD memory | -32,768 to 32,767 |
C | WORD | Counter value (signed internal WORD memory) | -32,768 to 32,767 |
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 |
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.2may be stored as approximately0.30000001instead of exactly0.3. This characteristic must be considered on controllers that use IEEE 754 32-bit floating point.
2. Default Memory on MPINO-8A4R(T)-S
The MPINO-8A4R(T)-S board uses these default memory counts:
You can change the number of addresses used under Settings → Memory Region Settings.
| Region | Default count | Default address range |
|---|---|---|
P | 64 | P0 to P63 |
M | 1,024 | M0 to M1023 |
D | 200 | D0 to D199 |
C | 100 | C0 to C99 |
T | 128 | T0 to T127 |
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.
C Region and Board Pin Mapping
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 useanalogWrite-related functions for the same output in Arduino code. To use ananalogWrite-related function, clear Use for that output under Settings → Ladder Pin Map Settings.
| C address | Board function | MCU pin |
|---|---|---|
C0 to C5 | Analog inputs | A0 to A5 |
C6 to C7 | NTC temperature inputs | A6 to A7 |
C8 to C10 | PWM outputs | D21 to D23 |
C11 to C99 | Remaining C region not directly assigned above | Confirm the intended use before selecting an address |
Critical check: If you chooseC0throughC10as 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.
Mapped addresses vary by board and can also be changed by the user. Check them under Settings → Ladder Pin Map Settings.
3. Understand Data Widths
Data width is the number of bits read or stored at one time. It determines the available value range and memory use.
| Width | Size | Signed range | Typical use |
|---|---|---|---|
| BIT | 1 bit | 0 or 1 | Contacts, coils, and ON/OFF states |
| BYTE | 8 bits | -128 to 127 | Small integers |
| WORD | 16 bits | -32,768 to 32,767 | General integers and the basic values of D, C, and T |
| DWORD | 32 bits | -2,147,483,648 to 2,147,483,647 | Large integers beyond the WORD range |
The R region also uses 32 bits, but it stores a floating-point value, not a DWORD integer. Do not treat R memory as DWORD access simply because both use 32 bits.
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.
4. Read Memory Addresses
Read a long address from left to right as a data-width prefix, memory region, address index, and bit number.
For example, WM1.3 means:
W: view the data with WORD width.M: use the internal-bit memory region.1: the WORD address. It identifies the second WORD group, afterWM0..3: select the fourth bit in that WORD. Bit numbering also begins at zero.
How Memory Is Grouped
This diagram shows the memory structure for bits, bytes, words, double words, and floating-point values.
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.
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.
Width Prefixes and Bit Access
| Notation | Supported regions | Examples |
|---|---|---|
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 following forms are not supported:
- A
BorWprefix on D, C, or T, such asBD0 - Any width prefix on R
.nbit access on R
If the address editor reports an error, check whether that memory region supports the selected width and bit access before changing only the spelling.
5. Inspect Memory-Region Sizes
Select Settings → Memory Region Settings, or press Ctrl+Shift+M.
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+Sto store the change in the.mp2project.
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.
Use the map as follows:
- Select the
P,M,D,C,T, orRtab. - 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
Ptab. - Confirm that
P0andP32are marked as used. - Select
P0and confirm the NO contact reference inladderLoop. - Select
P32and 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.
7. Time-Driven Special Contacts
A special contact beginning with @ is updated automatically as time passes. It is different from an ordinary P or M memory address.
| Format | Operation | Example |
|---|---|---|
@<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 |
@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.
@F1000 provides a repeating one-second condition without code that manually toggles a state.
Follow these input rules:
- The time unit is milliseconds (ms).
- Do not use parentheses. Enter
@F1000, not@F(1000). - Use a special contact only in a contact or rising/falling-edge cell.
- Do not enter it as an output-coil address.
- An arbitrary name such as
@ONis 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
P0contact cell inladderLoop. - Press
Enteror double-click to open the cell editor. - Change the address to
@F1000and confirm it. - Keep
P32as the output-coil address. - Press
Ctrl+Rand confirm that the build finishes successfully. - Connect the MP download cable and select the port at the lower right.
- Press
Ctrl+Uto upload. - If you configured a monitoring port in Phase 1, press
Ctrl+Mto enable real-time ladder monitoring. - Confirm that the
@F1000contact andP32coil 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, andR. - Explain that
C0throughC10are mapped to board functions on MPINO-8A4R(T)-S. - Identify the size and signed range of BIT, BYTE, WORD, and DWORD.
- Read
WM1.3andDD2by the role of each character. - Open Memory Region Settings with
Ctrl+Shift+M. - Find the
P0andP32references withCtrl+Shift+L. - Explain the difference between
@100and@F1000. - Save the exercise as a separate project and verify the build result.
Troubleshooting
| Symptom | What to check |
|---|---|
| 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. |
| 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. |
| 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. |
| 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. |



