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
en-us_products:mpino_studio2:memory [2026/11/10 16:30] – external edit 127.0.0.1en-us_products:mpino_studio2:memory [2026/11/13 00:27] (current) – external edit 127.0.0.1
Line 54: Line 54:
  
 > **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. > **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.
 +
 +==== Use Arduino Variables in Ladder ====
 +
 +Global variables declared outside functions in a ''.ino'' code file can be entered by name in ladder contacts, coils, comparison contacts, and box-function arguments. The variable name must match the Arduino code exactly, including letter case.
 +
 +<code cpp>
 +bool motorOn = false;  // Used as motorOn in contacts and coils.
 +uint16_t flags = 0;    // Used in contacts and coils with a bit number, such as flags.3.
 +int speed = 0;         // Used in comparison contacts such as speed > 100, or as a box-function argument.
 +</code>
 +
 +{{ :products:mpino_studio2:ladder-arduino-variables.png?640 |Ladder cells that use Arduino variable names }}
 +
 +^ Class ^ Supported C types ^ Use in contacts and coils ^
 +| Bit | ''bool'', ''boolean'' | Enter the name as is |
 +| Byte | ''char'', ''signed char'', ''unsigned char'', ''int8_t'', ''uint8_t'', ''byte'' | Add a bit number from ''.0'' to ''.7'' |
 +| Word | ''int'', ''unsigned int'', ''short'', ''unsigned short'', ''int16_t'', ''uint16_t'', ''word'' | Add a bit number from ''.0'' to ''.15'' |
 +| Double-word | ''long'', ''unsigned long'', ''int32_t'', ''uint32_t'' | Add a bit number from ''.0'' to ''.31'' |
 +| Floating-point | ''float'', ''double'' | Not available (use a comparison contact such as ''temp > 30.5'') |
 +
 +Variables of every class can be used in comparison contacts and box-function arguments. They cannot be used in the following cases.
 +
 +  * A ''const'' variable is read-only, so it cannot be used as a coil or as a box-function argument that is written.
 +  * Arrays, structures, ''String'', pointers, ''static'' variables, variables declared together on one line, variables inside an ''#if'' block, and variables in ''.cpp'' or ''.h'' files cannot be used.
 +  * A name shaped like a ladder address, such as ''M0'', ''WM0'', or ''D200'', is always read as a ladder address.
 +  * Arduino variables cannot be timer or counter targets or presets, and they cannot be used in the ''SHL'', ''SHR'', ''ROL'', ''ROR'', ''WNOT'', ''INV'', ''H2D'', ''D2H'', ''GMOV'', ''FMOV'', ''SCALE'', ''FLOOR'', and ''SQRT'' commands.
 +
 +In the candidate list of the cell editor, an Arduino variable appears as “Variable · code file name”. A symbol name spelled exactly like an Arduino variable is an error, and the project cannot be built. If the names differ only in letter case (for example, symbol ''Speed'' and variable ''speed''), a warning appears in the **Problems** tab when you build. In that case, cells that take a single address, such as contacts and coils, and argument fields that take an address in a structured box function use the symbol even if you enter the variable name. Comparison contacts and free-form box-function expressions use the Arduino variable. If you enter a variable that cannot be used, the reason appears in the **Problems** tab when you build.
 +
 +Ladder monitoring does not receive Arduino variable values, so variable cells are not shown as ON or OFF, and hovering over such a cell shows “Arduino variable values are not monitored”. Values cannot be written to Arduino variables with the **Write Value to Arduino** popup or with ''Ctrl + 1'' / ''Ctrl + 0''.
  
 ===== 2. Memory Regions ===== ===== 2. Memory Regions =====
Line 59: Line 89:
 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'')+You can change the number of addresses used under **Settings → Memory Area Settings**. (Shortcut: ''Ctrl + Shift + M'')
  
-{{ :en-us_products:mpino_studio2:memory-settings-modal.png?430 |Figure 1. Memory Region Settings showing the address counts and estimated SRAM use }}+{{ :en-us_products:mpino_studio2:memory-settings-modal.png?640 |Figure 1. Memory Area Settings for address counts, estimated SRAM use, and timer units }}
  
 ^ Region ^ Default count ^ Default address range ^ ^ Region ^ Default count ^ Default address range ^
Line 71: Line 101:
 | ''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.+**Memory Area 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. 
 + 
 +In **Timer units** at the bottom of the dialog, you can also select the length of one timer tick (1 ms or 10 ms for ''T*'' timers; 10 ms, 100 ms, or 1000 ms for ''TA*'' timers). The selected values are saved in the project. See [[en-us_products:mpino_studio2:box_functions:timer#timer_unit_settings|Phase 4-1 · Timer Unit Settings]] for details.
  
 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 136: Line 168:
 Select **Settings → Used Memory**, or press ''Ctrl+Shift+L''. Select **Settings → Used Memory**, or press ''Ctrl+Shift+L''.
  
-{{ :en-us_products:mpino_studio2:memory-map-modal.png?800 |Figure 2. Addresses and references in Used Memory }}+{{ :en-us_products:mpino_studio2:memory-map-marked.svg?1000 |Figure 2. Addresses and references in Used Memory }} 
 + 
 +^ Marker ^ Item ^ Action ^ 
 +| **①** | Area tabs | Switches among the ''P'', ''M'', ''D'', ''C'', ''T'', and ''R'' areas. ''P'' and ''M'' show 16 bits per row; ''D'', ''C'', ''T'', and ''R'' show one address per row. | 
 +| **②** | Ladder and Code | Show or hide the addresses used by the ladder and by Arduino code. | 
 +| **③** | Search address | Enter an address such as ''D5'' and press ''Enter'' to switch to its area tab and highlight its row. | 
 +| **④** | Used cells | Blue cells are used by the ladder, green cells by Arduino code, and purple cells by both. Select a cell to open the usage dialog. | 
 + 
 +If a ladder cell is selected when you open this dialog, the tab and row for that cell's address appear immediately. 
 + 
 +{{ :en-us_products:mpino_studio2:memory-usage-detail-marked.svg?1000 |Usage dialog listing the ladder cells and code lines that use D5 }} 
 + 
 +^ Marker ^ Item ^ Action ^ 
 +| **①** | Usage locations | For the ladder, shows the ladder name and cell position (''R'' row number, ''C'' column number); for Arduino code, shows the file name and line number. | 
 +| **②** | Go to | Moves to that ladder cell or code file and closes the Used Memory dialog. |
  
 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.
Line 171: Line 217:
 ^ Symptom ^ What to check ^ ^ 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. | | 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 Area Settings cannot be saved. | Check whether estimated SRAM use exceeds total SRAM and is shown in red. |
 | An address does not appear in Used Memory. | 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. |
en-us_products/mpino_studio2/memory.1794295849.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki