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
PROGRAMMABLE LOGIC CONTROL.(LL)>CUSTOM<
- EX:[AE00]=fa50h number of ones =1111 1010 0101 0000 Physical address=4AE00h=4000h*10h+AE00h Mov ax,4000 Mov ds,ax; DS=4000h mov ds,4000 X Mov ax,[AE00] ; ax=[ae00]=FA50h Mov cx,10; 16 bit in decimal Mov bl,0 *: Ror ax,1 Jnc ** Inc bl **:Dec cx Jnz * ;LSB⇒CF Cf=1 ; it jump when CF=0, will not jump when CF=1 HW1: rewrite the above example use another wayarrow_forwardEX2: Write a piece of assembly code that can count the number of ones in word stored at 4AE00harrow_forwardWrite a program that simulates a Magic 8 Ball, which is a fortune-telling toy that displays a random response to a yes or no question. In the student sample programs for this book, you will find a text file named 8_ball_responses.txt. The file contains 12 responses, such as “I don’t think so”, “Yes, of course!”, “I’m not sure”, and so forth. The program should read the responses from the file into a list. It should prompt the user to ask a question, then display one of the responses, randomly selected from the list. The program should repeat until the user is ready to quit. Contents of 8_ball_responses.txt: Yes, of course! Without a doubt, yes. You can count on it. For sure! Ask me later. I'm not sure. I can't tell you right now. I'll tell you after my nap. No way! I don't think so. Without a doubt, no. The answer is clearly NO. (You can access the Computer Science Portal at www.pearsonhighered.com/gaddis.)arrow_forward
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTPrinciples of Information Systems (MindTap Course...Computer ScienceISBN:9781285867168Author:Ralph Stair, George ReynoldsPublisher:Cengage Learning
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEnhanced Discovering Computers 2017 (Shelly Cashm...Computer ScienceISBN:9781305657458Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. CampbellPublisher:Cengage Learning