Math instruction:
- Math instructions refer to all output instructions that uses the data of two words or registers and perform the desired function.
- Math instructions are programmed depending on the type of processor used.
- The data manipulation instructions are almost similar to math instructions.
- Math instructions are normally used to perform arithmetic functions on the values stored in memory words or registers.
Math functions:
The basic math functions performed by PLCs are as follows:
- Addition
- This function is used to add one piece of data to another.
- It is also called as ADD.
- Subtraction
- This function is used to subtract one piece of data from another.
- It is also called as SUB.
- Multiplication
- This function is used to multiply one piece of data by another.
- It is also called as MUL.
- Division
- This function is used to divide one piece of data from another.
- It is also called as DIV.
Terms used:
The following terms are used in the instruction.
- Source A
- Source A refers to the address of the first piece of data that is used in the instruction.
- Source B:
- Source B refers to the address of the second piece of data that is used in the instruction.
- Destination
- Destination refers to the address where the results of the instruction are stored.
Given:
- In the given figure, the instruction ADD is executed to add the values accumulated at “C5:0” and “C5:1” and the result will be stored at the address “N7:1”.
- The instruction GREATER THAN OR EQUAL (GEQ) is executed to activate the PL1 output.
- Here, the instruction will become true when the value accumulated at the address “N7:1” is greater than or equal to the constant value “350”.
Explanation of Solution
b.
Status of output PL1:
“No”, the output PL1 will not be energized when the accumulated value of counter “C5:0” and “C5:1” is “148” and “36” respectively.
Reason:
- The accumulated value of counter “C5:0” is “148” and the accumulated value of counter “C5:1” is “36”...
Explanation of Solution
c.
Value of the numbers stored:
Assume that the accumulated value of counter “C5:0” is “250” and the accumulated value of counter “C5:1” is “175”.
(1)
Value stored in “C5:0.ACC”:
Since, the given program stores the accumulated value of counter addressed at “C5:0”, the “C5:0.ACC” contains the value of the number “250”.
(2)
Value stored in “C5:1.ACC”:
Since, the given program stores the accumulated value of counter addressed at “C5:1”, the “C5:1.ACC”contains the value of the number “175”...
Explanation of Solution
d.
Status of output PL1:
“Yes”, the output PL1 will get energized when the accumulated value of counter “C5:0” and “C5:1” is “175” and “250” respectively.
Reason:
- The accumulated value of counter “C5:0” is “250” and the accumulated value of counter “C5:1” is “175”...
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
LogixPro PLC Lab Manual for Programmable Logic Controllers
- Two 1-bit values generate a 1 result value when a(n) _____ instruction is executed. All other input pairs generate a 0 result value.arrow_forwardA(n) ____________________ instruction copies data from one memory location to another.arrow_forwardWhat would occur if an instruction were to be disregarded? A software-managed TLB is quicker than a hardware-managed TLB in the following situations:arrow_forward
- Multiple choice please answer this The following operations (instruction) function with signed numbers except one. a. SHL b. IDIV c. SAR d. IMULarrow_forwardYou may use only the instructions we covered: add, sub, addi, lw, sw and the same rules as mentioned earlier still apply.AssignmentWrite MIPS assembly code implementing the following C/C++ statement:a[k*2-4] = a[k]*2 + 7;You may assume that no bounds checking is needed (always in this course). YOU MAY ONLY USE add, sub, addi, lw, and swarrow_forward. If R1 = 0xEF00DE12, R2 = 0x0456123F, R5 = 4, R6 = 28; Find the values of the destination registers for the following instruction? a) LSL R1, #8 b) ASR R1, R5 c) ROR R2, R6 d) LSR R2, #6 Substantiate your answers appropriately.arrow_forward
- Q 2. Differentiate between the following terms properly: PUSH and POP instructions. Stack Pointer (SP) and Instruction Pointer (IP). Data Shift and Rotate operation.arrow_forward) State whether the following instructions are valid or invalid? Define the valid instructions. In case any instruction is invalid then state the reason of their invalidity. ADD BX, [1234H] AND 23H, AL CMP AL, SP JCXZ Telecom IMUL BLarrow_forwardConsider the following MIPS instruction: add $t1, $t2, $t3 (Refer to the figure) a. What is the ALUSrc control signal value: top or bottom? b. What is the MemtoReg control signal value: top or bottom? c. What is the PCSrc control signal value: top or bottom?arrow_forward
- Determine the costs of the following instruction sequences: LD R0, c LD R1, i MUL R1, R1, 8 ST a(R1),R0arrow_forwardIn the following code sequence, show the value of AL after each shift or rotate instructionhas executed:mov al,0D4hshr al,1 ; a.mov al,0D4hsar al,1 ; b.mov al,0D4hsar al,4 ; c.mov al,0D4hrol al,1 ; darrow_forwardBelow is a set of instructions for a three-address machine. Write down the equivalent set of instructions for a 1-address machine and a 0-address machine. SUB R1, B, C ADD R2, D, E MULT A, R1, R2arrow_forward
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningPrinciples of Information Systems (MindTap Course...Computer ScienceISBN:9781285867168Author:Ralph Stair, George ReynoldsPublisher:Cengage Learning