en-us_products:mp_studio:bit_control
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en-us_products:mp_studio:bit_control [2026/11/12 20:37] – external edit 127.0.0.1 | en-us_products:mp_studio:bit_control [2026/11/13 13:42] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ====== MP STUDIO 2 · Bit Control Functions ====== | ====== MP STUDIO 2 · Bit Control Functions ====== | ||
| - | The bit control functions are five functions (V1.4.0 and later): '' | + | The bit control functions are five functions (V1.4.0 and later): '' |
| [[# | [[# | ||
| - | {{ : | + | {{ : |
| ^ Functions ^ Categories ^ Execution ^ Version ^ | ^ Functions ^ Categories ^ Execution ^ Version ^ | ||
| - | | 5 | Bit Logic, Timer | Edge, level, cycle | V1.4.0 and later | | + | | 16 | Bit Logic and 3 others |
| * **Toggles on each press**\\ '' | * **Toggles on each press**\\ '' | ||
| Line 16: | Line 16: | ||
| * **A whole range at once**\\ '' | * **A whole range at once**\\ '' | ||
| * **Separate ON and OFF times**\\ '' | * **Separate ON and OFF times**\\ '' | ||
| + | * **Bit number as a value**\\ '' | ||
| + | * **Processes run in steps**\\ '' | ||
| **On this page** | **On this page** | ||
| Line 24: | Line 26: | ||
| * [[# | * [[# | ||
| * [[# | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| * [[# | * [[# | ||
| * [[# | * [[# | ||
| Line 34: | Line 40: | ||
| ===== Finding and Inserting the Functions ===== | ===== Finding and Inserting the Functions ===== | ||
| - | '' | + | '' |
| ^ Function ^ Name in the Functions panel ^ Block cells (from the left) ^ | ^ Function ^ Name in the Functions panel ^ Block cells (from the left) ^ | ||
| Line 42: | Line 48: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| {{ : | {{ : | ||
| - | * **① Bit Logic category:** the number on the right is the number of functions in the category (4). | + | * **① Bit Logic category:** the number on the right is the number of functions in the category (11). |
| * **② FF, BSFT, BRST and BSETN:** double-click to insert the function at the cursor cell. | * **② FF, BSFT, BRST and BSETN:** double-click to insert the function at the cursor cell. | ||
| - | * **③ TFLK:** the last row of the Timer category. | + | * **③ LOADB to BSUM:** the Bit Logic functions added in V1.5.0. |
| + | * **④ TFLK:** the last row of the Timer category. | ||
| - | In the Insert Function window, the argument order of '' | + | {{ : |
| - | {{ : | + | * **① ROL and ROR:** the last two rows of the Word Logic category. |
| + | * **② SSET and SOUT:** the last two rows of the Program Control category. | ||
| + | |||
| + | In the Insert Function window, the argument order of '' | ||
| + | |||
| + | {{ : | ||
| ===== Common Behavior ===== | ===== Common Behavior ===== | ||
| - | All five functions run on the condition to the left of the block. When they act depends on the function. | + | All bit control |
| ^ Function ^ When it acts ^ | ^ Function ^ When it acts ^ | ||
| | '' | | '' | ||
| - | | '' | + | | '' |
| | '' | | '' | ||
| + | | '' | ||
| + | | '' | ||
| - | * '' | + | * Except for '' |
| * '' | * '' | ||
| * If the condition is already ON in the first scan after power-on or a download, it is treated as a change from OFF to ON. In that case, '' | * If the condition is already ON in the first scan after power-on or a download, it is treated as a change from OFF to ON. In that case, '' | ||
| - | * Inside an '' | + | * Inside an '' |
| ===== FF Flip-Flop ===== | ===== FF Flip-Flop ===== | ||
| Line 71: | Line 96: | ||
| '' | '' | ||
| - | {{ : | + | {{ : |
| * OUT can be a '' | * OUT can be a '' | ||
| Line 90: | Line 115: | ||
| * **BIT:** the start bit. You can use a '' | * **BIT:** the start bit. You can use a '' | ||
| - | * **N:** the number of bits. Use a constant of 1 or more, or a byte or word address such as '' | + | * **N:** the number of bits. Use a constant of 1 or more, or a byte or word address such as '' |
| - | * **IN:** the value to put in. Use 0, 1 or a bit such as '' | + | * **IN:** the value to put in. Use 0, 1 or a bit such as '' |
| - | * **DIR:** the shift direction. Use 0, 1 or a bit. | + | * **DIR:** the shift direction. Use 0, 1 or a bit. In V1.5.0 and later, you can also use addresses and integers, as with IN, and any value other than 0 is treated as 1. |
| - | If IN or DIR is a bit, its value in the scan in which the condition turned ON is read. | + | If IN or DIR is a bit or an address, its value in the scan in which the condition turned ON is read. |
| - | {{ : | + | {{ : |
| * **① BSFT block:** the BIT, N, IN and DIR cells. | * **① BSFT block:** the BIT, N, IN and DIR cells. | ||
| Line 121: | Line 146: | ||
| * A blink with equal ON and OFF times and a fixed period can also be made with the [[: | * A blink with equal ON and OFF times and a fixed period can also be made with the [[: | ||
| - | {{ : | + | {{ : |
| * **① '' | * **① '' | ||
| Line 138: | Line 163: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| + | |||
| + | ===== BMOV and BSUM Copy Bit Range and Count ON Bits ===== | ||
| + | |||
| + | In every scan in which the condition is ON, '' | ||
| + | |||
| + | * **IN:** the value to read bits from. Use a constant or a byte, word or double word address such as '' | ||
| + | * **SB:** the bit number in IN to start reading from (counting from 0). | ||
| + | * **OUT:** the byte, word or double word address to write the bits to. | ||
| + | * **DB:** the bit number in OUT to start writing at (counting from 0). | ||
| + | * **N:** the number of bits to copy (1 or more). | ||
| + | |||
| + | Bit numbers are counted within the size of the address in the cell. A byte has bits 0 to 7, a word has bits 0 to 15, and a double word or a constant has bits 0 to 31. SB+N must not exceed the number of bits of IN, and DB+N must not exceed that of OUT. IN and OUT can be different sizes and can even be the same address. If you write an address in SB, DB or N, the value is decided while the program runs ([[# | ||
| + | |||
| + | ^ Example ^ Action ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | The result of '' | ||
| + | |||
| + | ===== ROL and ROR Rotate Left and Right ===== | ||
| + | |||
| + | '' | ||
| + | |||
| + | * The rotation width is the size of OUT (8 bits for a byte, 16 bits for a word and 32 bits for a double word). If IN is smaller than OUT, the upper bits are filled with 0. If IN is larger, only the lower bits that fit in OUT are read. | ||
| + | * If N is equal to or larger than the width, the value is rotated by the remainder of N divided by the width (4 bits when N is 20 for a word). If N is 0, IN is written to OUT unchanged. | ||
| + | * To rotate a value in place, write the same address in IN and OUT. | ||
| + | * The value is rotated in every scan in which the condition is ON. To rotate it only once when the condition turns ON, put a rising edge contact in front of the block. | ||
| + | |||
| + | ^ Example ^ Action ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | Figure 7 shows a rung in which a rising edge contact after '' | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | ===== LOADB, LOADBN, BOUT, BSET and BRESET Bit N Contacts and Outputs ===== | ||
| + | |||
| + | These five functions read or write a single bit, the one whose number is in N (V1.5.0 and later). If you write an address such as '' | ||
| + | |||
| + | ^ Function ^ What it does ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | * Use a constant or a byte, word or double word address in IN, and a byte, word or double word address in OUT. '' | ||
| + | * N counts from 0 and must be smaller than the number of bits of the address in the cell (0 to 7 for a byte, 0 to 15 for a word and 0 to 31 for a double word). If IN is a constant, N is 0 to 31. | ||
| + | * '' | ||
| + | * If N of '' | ||
| + | |||
| + | ^ Example ^ Action ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | ===== SSET and SOUT Step Control ===== | ||
| + | |||
| + | '' | ||
| + | |||
| + | ^ Function ^ What it does in a scan in which the condition is ON ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | * In GROUP, use a byte, word or double word address such as '' | ||
| + | * GROUP keeps its value after the condition turns OFF. Write the work for each step as a coil after a comparison contact such as '' | ||
| + | * If GROUP is an address outside the retentive range, the process starts at step 0 after power-on or a download. | ||
| + | * Several '' | ||
| + | |||
| + | > **Steps can advance more than once in a scan** | ||
| + | > If the conditions of '' | ||
| ===== Inputs That Do Not Compile ===== | ===== Inputs That Do Not Compile ===== | ||
| Line 146: | Line 242: | ||
| | OUT of '' | | OUT of '' | ||
| | BIT of '' | | BIT of '' | ||
| - | | N of '' | + | | N of '' |
| - | | IN and DIR of '' | + | | IN and DIR of '' |
| | ON and OFF of '' | | ON and OFF of '' | ||
| | TIMER of '' | | TIMER of '' | ||
| + | | SB, DB and N of '' | ||
| + | | N of '' | ||
| + | | N of '' | ||
| + | | STEP of '' | ||
| + | | OUT and GROUP of the functions added in V1.5.0 | A constant | | ||
| + | | All cells of the functions added in V1.5.0 | A bit address such as '' | ||
| - | The cells of the five functions cannot take an [[: | + | The cells of the bit control |
| For example, if you enter '' | For example, if you enter '' | ||
| - | {{ : | + | {{ : |
| + | |||
| + | If you enter '' | ||
| + | |||
| + | {{ : | ||
| ===== Out of Range and @IXERR ===== | ===== Out of Range and @IXERR ===== | ||
| - | If you write an address such as '' | + | If you write an address such as '' |
| - | * It skips only that block. It writes no bits, so no other memory | + | ^ Function ^ Value treated as out of range ^ What happens ^ |
| - | * The system bit '' | + | | '' |
| - | * While the condition | + | | '' |
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| - | If you write addresses in ON and OFF of '' | + | * No bit is written to the wrong place, so no other memory is overwritten. Except for '' |
| + | * Except for '' | ||
| + | * '' | ||
| - | '' | + | If you write addresses in ON and OFF of '' |
| - | {{ : | + | '' |
| - | {{ : | + | {{ : |
| + | |||
| + | {{ : | ||
| * **① N cell '' | * **① N cell '' | ||
| Line 178: | Line 291: | ||
| ===== Monitoring and Simulation ===== | ===== Monitoring and Simulation ===== | ||
| - | The five functions work the same in simulation as on the PLC. | + | All bit control |
| - | * When the condition is ON, the blocks of '' | + | * When the condition is ON, the blocks of all functions except |
| * The value in the BIT cell is the value of the start bit alone. To see the whole range, add the addresses to the [[: | * The value in the BIT cell is the value of the start bit alone. To see the whole range, add the addresses to the [[: | ||
| * The TIMER cell of '' | * The TIMER cell of '' | ||
| + | * Like a contact, '' | ||
| + | * For '' | ||
| * To see a single moment of the blink, use **Pause** and **Step one scan** on the [[: | * To see a single moment of the blink, use **Pause** and **Step one scan** on the [[: | ||
| - | * In **Run → Used Data**, if N is a constant, the N bits from BIT are painted as used, and if N is an address, only the start bit is painted ('' | + | * In **Run → Used Data**, if N is a constant, the N bits from BIT are painted as used, and if N is an address, only the start bit is painted ('' |
| ===== Examples ===== | ===== Examples ===== | ||
| - | You can write the three examples | + | You can write Examples 1 to 4 in order in a new '' |
| ==== Example 1. Toggling a Lamp with a Single Push Button ==== | ==== Example 1. Toggling a Lamp with a Single Push Button ==== | ||
| Line 200: | Line 315: | ||
| | 0 | '' | | 0 | '' | ||
| - | Start **Run → Simulation**, | + | Start **Run → Simulation**, |
| ==== Example 2. Tracking Rejects on a Conveyor ==== | ==== Example 2. Tracking Rejects on a Conveyor ==== | ||
| Line 214: | Line 329: | ||
| | 3 | '' | | 3 | '' | ||
| - | During simulation, add '' | + | During simulation, add '' |
| ==== Example 3. Blinking a Beacon ==== | ==== Example 3. Blinking a Beacon ==== | ||
| Line 227: | Line 342: | ||
| | 5 | '' | | 5 | '' | ||
| - | During simulation, when you turn '' | + | During simulation, when you turn '' |
| + | |||
| + | ==== Example 4. Counting Rejects on a Conveyor and Checking a Position ==== | ||
| + | |||
| + | In this example, the tracking records shifted into '' | ||
| + | |||
| + | - In **Settings → Symbol**, register NG_COUNT for '' | ||
| + | - Write the rungs below after the rungs of Example 3. | ||
| + | |||
| + | ^ Rung ^ Input ^ Function or coil ^ What it does ^ | ||
| + | | 6 | '' | ||
| + | | 7 | '' | ||
| + | |||
| + | During simulation, turn '' | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | * **① OUT of '' | ||
| + | * **② '' | ||
| + | * **③ N cell '' | ||
| + | * **④ Coil '' | ||
| + | |||
| + | ==== Example 5. Running Three Processes in Order with Steps ==== | ||
| + | |||
| + | In this example, the start signal '' | ||
| + | |||
| + | - Create a new '' | ||
| + | - Write the rungs below. | ||
| + | |||
| + | ^ Rung ^ Input ^ Function or coil ^ What it does ^ | ||
| + | | 0 | '' | ||
| + | | 1 | '' | ||
| + | | 2 | '' | ||
| + | | 3 | '' | ||
| + | | 4 | '' | ||
| + | | 5 | '' | ||
| + | | 6 | '' | ||
| + | | 7 | '' | ||
| + | |||
| + | During simulation, turning '' | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | * **① "▶ Now 2":** appears in the head of the block of the current step, and the head border changes to the power-flow color. | ||
| + | * **② GROUP cell '' | ||
| + | * **③ Comparison contact '' | ||
| + | * **④ Coil '' | ||
| ===== Things to Check ===== | ===== Things to Check ===== | ||
| Line 233: | Line 394: | ||
| * The bits that '' | * The bits that '' | ||
| - | > **Cannot be opened in V1.3.0 and earlier** | + | > **Cannot be opened |
| - | > A '' | + | > A '' |
| ===== Related Pages ===== | ===== Related Pages ===== | ||
en-us_products/mp_studio/bit_control.1794483454.txt.gz · Last modified: by 127.0.0.1
