-
Step 1: ANL is Logic and Operation.
That is to say, the first step is to perform and calculate the content in A and 47h in 34h. a=10000011 34h=00110100
With the operation feature, there is "0", then 0, the result of the operation is 00000000=00h, and the content in the accumulator A is 00h
Step 2: ORL is logic or operation.
This part is the first part of the calculation of a and 34h in the 47h address or calculation, and the result is stored in the 47h unit. a=00h=00000000 47h=00110100 or the arithmetic feature is that there is a "1" then 1
Therefore, the result of the operation is 00110100=34h, and the content in the address is 34h after the operation is 47h
Step 3: XRL is a logical XOR instruction.
The @ in front of r0 indicates that the addressing method is register addressing. The characteristic is that the content in r0 is used as the address, and the corresponding content is found as the content of r0 from this address. In the stem, it is said that (r0)=47h means that the content in r0 is 47h@r0 which is to use the content 47h in r0 as the address to find the corresponding content.
In the previous part, we already knew that the content in 47h is 34h. Going back to the third step, it is equivalent to xrl a, 34h a=00h=00000000 34h=00110100 The characteristic of the logical XOR operation is that it is 0 if it is the same, and 1 if it is different, so the result is 00110100=34h In this case, the content in the accumulator A is 34h
Step 4: swap is the exchange of high and low four-digit data values (if it is 8 digits) is to swap the first four digits of the 00110100 with the last four digits, and after the exchange, it is still 01000011=43h, and finally the content in a is 43h
Refer to the big brother below, it's changed, or don't mislead people.
-
anl" and "is the relationship of multiplication 1 times 1 = 1 times 0 times 0 orl " or "is the relationship of addition 1 + 1 1 + 0 = 1 0 + 0 = 0xrl" XOR" true false = true.
False True = True.
False False = False.
True True = False True 1 False is 0
swap A is the swap of high and low nibble within A.
And then there's the conversion between hexadecimal and binary, and you won't forget it after you figure it out.
-
In logical algebra, there are three basic logical operations: and, or, and non. There are many ways to represent logical operations, such as statement descriptions, logical algebraic formulas, truth tables, Carnot diagrams, etc. Logical operations are often used to test true or false values.
The most common logical operation is loop processing, which is used to determine whether to leave the loop or continue to execute instructions in the loop.
Accumulator macro shed a clear 0 instruction.
clr a;The function of the single-chip microcomputer software instruction is to clear the content of the accumulator A to 0. Affects the odd-even flag bit P in the microcontroller flag register PSW.
Accumulator a takes the negation instruction.
cpl a;The software instruction function of the single-chip microcomputer is to reverse all the contents of the accumulator A, and the result is sent back to A. Affects the odd-even flag bit P in the microcontroller flag register PSW.
It is often used to compensate for the signed number in a memory cell or a memory area of a microcontroller.
rl a;Left Loop Shift Instruction:
The function of the single-chip microcomputer software instruction is to move the 8-bit binary number of the accumulator a to the left by 1 bit, and the left-most digit of the accumulator is moved to the rightmost 1 bit (i.e., the lowest bit). It does not affect the flag bit in the PSW of the microcontroller flag register.
rr a;Right Loop Shift Instruction:
The software instruction function of the single-chip microcomputer is to move the 8-bit binary number of the accumulator a to the right by 1 bit, and the rightmost 1 bit of the accumulator a (i.e., the lowest displacement to the leftmost 1 digit (i.e., the highest bit). It does not affect the flag bit in the PSW of the microcontroller flag register.
rlc a;Left Loop Shift Instruction with Carry Bit:
The single-chip microcomputer software instruction function is to move the 8-bit binary number and carry bit cy of accumulator a by 1 bit to the left, and the leftmost digit of accumulator a (i.e., the highest displacement is moved to cy, and the original content of cy is moved to the rightmost 1 bit of accumulator a (i.e., the lowest bit). Affects the carry flag CY in the PSW flag register of the microcontroller.
rrc a;With carry right loop shift instruction:
The software instruction function of the single-chip microcomputer is to move the 8-bit binary number and carry bit cy of accumulator a by 1 bit to the right, and the rightmost 1 bit of accumulator a (i.e., the lowest displacement is moved to cy, and the original content of cy is moved to the leftmost 1 bit of accumulator a (i.e., the highest bit). Affects the carry flag CY in the PSW flag register of the microcontroller.
-
Summary. Hello dear, how does the single-chip microcomputer do addition, subtraction, multiplication and division operations? The arithmetic operation components (mainly including adders and multipliers, dividers) integrated in the single-chip microcomputer CPU can complete addition, subtraction, multiplication and division operations, and the control signal generated by the arithmetic operation instructions of the single-chip microcomputer after being decoded by the instruction decoder controls the arithmetic operation components to work and produce the operation results.
Hello dear, how does the single-chip microcomputer do addition, subtraction, multiplication and division operations? The arithmetic operation components (mainly including adders and multipliers, dividers) integrated in the single-chip microcomputer CPU can complete addition, subtraction, multiplication and division operations, and the control signal generated by the arithmetic operation instructions of the single-chip microcomputer after being decoded by the instruction decoder controls the arithmetic operation components to work and produce the operation results. I hope my reply can help you.
1) Addition instructions without carry (4 items) The function of these 4 instructions is to add the contents of the immediate number, direct address, working register, and indirect address with the content of accumulator a, and the result of the operation is stored in a. add a,#data ;(a) + data (a) the content in the accumulator a is added to the immediate number of data, and the result is present in a add a, data ; (a)+(data) (a) The contents of the accumulator a are added to the contents of the immediate address unit, and the result is in a add a,rn ; (a) +(rn) (a) the contents of accumulator a are added to the contents of the working register rn, and the result is in a add a, @ri ; (a)+(ri)) a) The contents of the accumulator A are added to the address unit pointed to by the working register ri, and the result exists in a For example, in the "addition program" in the task, mov a, p0 mov r0, p2 add a, r0 is to add the contents of p0 and p2.
Can you write a process?
According to the arithmetic, a=1
That's it? According to the following program, i=5, that is=11, satisfies the first if operation, so a=1. You don't need to continue with the else program later to get the answer.
According to the following program calculation, i=5, j=11, satisfies the first if operation process, so a=1. You don't need to continue with the else program later to get the answer.
Yes, dear, this is the most basic arithmetic.
-
You are well informed, according to your problem description, how can this trembling side provide you with the solution such as the most basic logic operation of the single-chip microcomputer There are 51 commonly used operators of the single-chip microcomputer are listed as follows: 1
Arithmetic operators: used for various numerical operations. Including addition (+) subtraction (-) multiplication (*) division ( ) remainder (or modulo operation, % self-increment (++ self-subtraction (--, a total of seven kinds.
2.Relational Operator: Used for comparison operations.
Including more than (>) and less than () six kinds. 5.Assignment Operator:
It is used for assignment operations, and is divided into three categories: simple assignment (=), compound arithmetic assignment (+=) and compound bit operation assignment (&=). 6.Conditional Operator:
This is a trinocular operator that is used for conditional evaluation (?:7.Comma operator:
-
There are 4 types of logic operations in a microcontroller:
1. "AND" operation.
An operation that has a logical relationship with "the operation is the implementation" must be there, otherwise there is none". The operator is "· The rules of operation are as follows:
2. "or" operation.
or "an operation is an operation that implements the logical relationship of "as long as one of them exists", and its operator is "+" or "the operation rules are as follows:
3. "Non" operation.
The "non" operation is an operation that implements the logic of "negation", such as the "non" operation of variable A is recorded as its operation rules as follows:
4. XOR operation.
XOR "operation is implementation" must be different, otherwise there is no such logic as "an operation with the operator " whose operation rules are:
-
1."AND" operation.
An operation that has a logical relationship with "the operation is the implementation" must be there, otherwise there is none". The operator is "· The rules of operation are as follows:
2.OR arithmetic.
or "an operation is an operation that implements the logical relationship of "as long as one of them exists", and its operator is "+" or "the operation rules are as follows:
3."NOT" arithmetic.
The "non" operation is an operation that implements the logic of "negation", such as the "non" operation of variable a. The rules of operation are as follows:
4.XOR operations.
XOR "operation is implementation" must be different, otherwise there is no such logic as "an operation with the operator " whose operation rules are:
-
+ a+b The value of the A variable and the value of the B variable are added.
a-b The values of the A variables and the values of the B variables are subtracted.
a*b a variable value multiplied by b variable value.
a b a variable value divided by b variable value.
a%b takes the remainder of the value of variable a divided by the value of variable b.
a=6 Set 6 to variable a, i.e. variable a value is equal to 6
a+=b is equivalent to a=a+b, and the result of adding a and b is stored back to a
a-=b is equivalent to a=a-b, and the result of subtracting a and b is saved back to a
a*=b is equivalent to a=a*b, and the result of multiplying a and b is stored back to a
A = B is equivalent to a = a b, and the result of dividing a and b is stored back in a
a%=b is equivalent to a=a%b, and the remainder of dividing the value of the a variable by the value of the b variable is stored back in a
The value of a++ a is added by 1, i.e. a=a+1
a-- the value of a minus 1, i.e. a = a-1
A>B tests whether the value of A is greater than B
a tests whether the value of a is less than b
a=b tests whether the value of a is equal to b
a>=b tests whether the value of a is greater than or equal to b
a<=b tests whether the value of a is less than or equal to b
a!=b tests whether the value of a is not equal to b
a&&b A and B do logic and and, both variables are "true", the result is "true", otherwise the result is "0".
a||b a and b do logic or or as long as any variable is "true", the result is "true".
a Invert the value of variable a, i.e., "true" becomes "false" and "false" becomes "true".
a>>b shifts a to the right by b bits.
a< Move A to the left and b bits, and add "0" to the right
a|b a and b bitwise do or operations.
a&b a and b do and and do the and arithmetic bitwise.
A b A and B do XOR arithmetic bitwise.
a Reverses each of a of a.
a=&b Deposit the address of the b variable in the A register.
a Used to fetch the value in the address indicated by the register.
Note: In logical operations, any value with a result of "0" is true, and a value equal to "0" is false.
-
and a,#55h;The content of register A is bitwise matched with the number 55h, if a turns out to be 0ffh, the result is 055h; If a turns out to be 0aah, the result is 0; If A turns out to be 33, the result is 011h;
or a,#55h;The content of register a is bitwise or with the number 55h, if a turns out to be 0, the result is 055h; If a turns out to be 0aah, the result is 0ffh; If a turns out to be 33h, the result is 077h;
-
There are 4 kinds of grinding logic operations in microcontrollers:
1. "AND" operation.
An operation or rush with the logical relationship of "operation is realization" must have, otherwise there is no such logical relationship. The operator is "· The rules of operation are as follows:
2. "or" operation.
or "an operation is an operation that implements the logical relationship of "as long as one of them exists", and its operator is "+" or "the operation rules are as follows:
3. "Non" operation.
The "non" operation is an operation that implements the logic of "negation", such as the "non" operation of variable A is recorded as its operation rules as follows:
4. XOR operation.
The XOR operation is an operation that implements the logic of "must be different, otherwise there will be none", and the operator is " " and its operation rules are:
You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More
A: The bit-addressing area is located between 20F and 2Fh in the data memory. The registers in this interval can be bit-addressed, and they can be bit-manipulated and bit-arithmetic. >>>More
void key0()
if(p1_0!=1) *If the key 0 is pressed. >>>More
In this case, it depends on sp, ret is equal to (sp) pch, sp-1 sp (sp) pcl, sp-1 sp >>>More
Isn't this thing just a digital tube displaying 16 digits? Prompt you 16 times to get there, let go after you think to press the stop button. If so, the procedure is available for reference: >>>More