N = Z = C = 0; Assume that the status registers are all 0.
After execution:
REG = 0000 0000; the value of the REG register is 00000000.
W = 0000 0000; the value of W register is 00000000.
Z = C = 1; Since the result after shifting to the left is 0, the zero flag Z is 1; the carry flag C is 1.
Command name: RLNCF
Original meaning: Rotate Left f (no Carry)
Syntax: [label] RLNCF f, d
Operator:
Operation description: (f < n >) -> dest (f < 7 >) -> 7, Impact flags: N, Z Instruction description: Rotate the value in the REG temporary memory to the left. If d = 0, the result after the operation is placed in the W accumulator; if d = 1, the result after the operation is placed in the f temporary register. If the temporary register storing the operation result is stored in the W accumulator, We can also write it as W (table W accumulator); if the temporary register storing the operation result is stored in the temporary register, we can also write it as F (table temporary register). Category: Logical operation instructions. Group: Logic instructions. Example 1: RLNCF REG, 0; Rotate the value of the REG register to the left and store the result back into the W register. Before execution: REG = 1110 0110; the value of the REG register is 11100110. N = Z = 0; Assume that the status registers are all 0. After execution: REG = 1110 0110; the value of the REG register is 11100110. W = 1100 1100; the value of W register is 11001100. N = 1; Since moving to the left means more negative numbers, the negative flag N is 1. Example 2: RLNCF REG, F; Rotate the value of the REG register to the left and store the result back into the REG register. Before execution: REG = 1000 0000; the value of the REG register is 10000000. W = 0000 0000; the value of W register is 00000000. N = Z = 0; Assume that the status registers are all 0. After execution: REG = 0000 0000; the value of the REG register is 00000000. W = 0000 0000; the value of W register is 00000000. Z = 1; Since the result after shifting to the left is 0, the zero flag Z is 1. Command name: RRCF Original meaning: Rotate Right f through Carry Syntax: [label] RRCF f, d Operator: Operation description: (f < n >) -> dest (f < 7 >) -> 7, ( C ) -> dest <0 > Impact flags: C, N, Z Instruction description: Rotate the value in the REG temporary memory to the right together with the carry flag C. If d = 0, the result after the operation is placed in the W accumulator; if d = 1, the result after the operation is placed in the f temporary register. If the temporary register storing the operation result is stored in the W accumulator, We can also write it as W (table W accumulator); if the temporary register storing the operation result is stored in the temporary register, we can also write it as F (table temporary register). Category: Logical operation instructions. Group: Logic instructions. Example 1: RRCF REG, 0; Rotate the value of the REG register to the right together with the carry flag C, and store the result back into the W register. Before execution: REG = 1110 0110; the value of the REG register is 11100110. N = Z = 0; Assume that the negative flag N and the zero flag Z in the status register are both 0. C = 1; Assume that the carry flag C is 1. After execution: REG = 1110 0110; the value of the REG register is 11100110. W = 1111 0011; the value of W register is 11110011. N = Z = C = 0; the negative flag N, zero flag Z and carry flag C in the status register all result in 0. Example 2: CLRC; Clear the carry flag C to 0. RRCF REG, F; Rotate the value of the REG register to the left together with the carry flag C, and store the result back into the REG register. Before execution: REG = 0000 0001; the value of the REG register is 00000001. W = 0000 0000; the value of W register is 00000000. N = Z = C = 0; the negative flag N, zero flag Z and carry flag C in the status register are all 0. After execution: REG = 0000 0000; the value of the REG register is 00000000. W = 0000 0000; the value of W register is 00000000. Z = C = 1; Since the result after shifting to the left is 0, the zero flag Z is 1; the carry flag C is 1. N = 0; the negative flag N is 0. Command name: RRNCF Original meaning: Rotate Right f (no Carry) Syntax: [label] RRNCF f, d Operator: Operation description: (f < n >) -> dest (f < 7 >) -> 7, Impact flags: N, Z Instruction description: Rotate the value in the REG temporary memory to the right. If d = 0, the result after the operation is placed in the W accumulator; if d = 1, the result after the operation is placed in the f temporary register. If the temporary register storing the operation result is stored in the W accumulator, We can also write it as W (table W accumulator); if the temporary register storing the operation result is stored in the temporary register, we can also write it as F (table temporary register). Category: Logical operation instructions. Group: Logic instructions. Example 1: RRNCF REG, 0; Rotate the value of the REG register to the right and store the result back into the W register. Before execution: REG = 1110 0110; the value of the REG register is 11100110. N = Z = 0; Assume that the status registers are all 0. After execution: REG = 1110 0110; the value of the REG register is 11100110. W = 0111 0011; the value of W register is 11001100. N = Z = 0; both the negative flag N and the zero flag are 0. Example 2: RRNCF REG, F; Rotate the value of the REG register to the right and store the result back into the REG register. Before execution: REG = 0000 0001; the value of the REG register is 00000001. W = 0000 0000; the value of W register is 00000000. N = Z = 0; Assume that the status registers are all 0. After execution: REG = 0000 0001; the value of the REG register is 00000001. W = 0000 0000; the value of W register is 00000000. Z = 1; Since the result after shifting to the right is 0, the zero flag Z is 1. N = 0; the negative flag N is 0. Command name: SETF Original meaning: Set f Syntax: [label] SETF f Operator: Operation description: 0xFF -> f Impact flags: None Instruction description: Set all values in the REG temporary memory to 1. Category: Data transfer instructions. Group: Bit setting instructions. Example 1: SETF REG; Set all values in the REG register to 1. Before execution: REG = 1110 0110; the value of the REG register is 11100110. After execution: REG = 1111 1111; the value of the REG register is 11111111. Command name: SLEEP Original meaning: Enter SLEEP Mode Syntax: [label] SLEEP Operator: Operation description: 0x00 -> WDT, 0 -> WDT post divider, , Impact flags: Instruction description: CPU enters sleep state. Category: Program flow control instructions. Group: Program flow instructions. Example 1: SLEEP; Set the CPU to enter sleep state. Before execution: ; The value of AND is unknown. After execution: ; The value of the temporary register is 1. ; The value of the temporary register is 0. Command name: SUBFWB Original meaning: Subtract f From W with Borrow Syntax: [label] SUBFWB f, d, a Operator: Operation description: (W) – (f) – ( ) -> dest Impact flags: N, OV, C, DC, Z Instruction description: Subtract the f register and carry flag C from the value of the W accumulator. If d = 0, the result of the operation is placed in the W accumulator; if d = 1, the result of the operation is placed in f. In the temporary register, if the temporary register that stores the operation result is stored in the W accumulator, we can also write it as W (meaning W accumulator); if the temporary register that stores the operation result is stored in the temporary register, we can also It can be written as F (table register). If a = 0, the result of the operation is placed in the current RAM address; if a = 1, the result of the operation is placed in the RAM address specified by the BSR register. Category: Data transfer instructions. Group: Math subtraction instructions. Example 1: SUBFWB REG, F, 0; Subtract the REG register and carry flag C from the value of the W accumulator, and put the result of the operation into the REG register. Before execution: REG = 3; the value of the REG register is 3. W = 2; the value of W accumulator is 2. C = 1; the value of the carry flag C is 1. After execution: REG = 0xFF; the value of the REG register is 0xFF. W = 2; the value of W accumulator is 2. C = 0; the value of the carry flag C is 0. Z = 0; the value of zero flag Z is 0. N = 1; the value of negative flag N is 1. ²The result of the operation is negative. Example 2: SUBFWB REG, W, 0; subtract the REG register and carry flag C from the value of the W accumulator, and put the result of the operation into the W accumulator. Before execution: REG = 2; the value of the REG register is 2. W = 5; the value of W accumulator is 5. C = 1; the value of the carry flag C is 1. After execution: REG = 2; the value of the REG register is 2. W = 3; the value of W accumulator is 3. C = 1; the value of the carry flag C is 1. Z = 0; the value of zero flag Z is 0. N = 0; the value of negative flag N is 0. ²The result of the operation is positive. Example three: SUBFWB REG, F, 0; Subtract the REG register and carry flag C from the value of the W accumulator, and put the result of the operation into the REG register. Before execution: REG = 1; the value of the REG register is 1. W = 2; the value of W accumulator is 2. C = 0; the value of the carry flag C is 0. After execution: REG = 0; the value of the REG register is 0. W = 2; the value of W accumulator is 2. C = 1; the value of the carry flag C is 1. Z = 1; the value of zero flag Z is 1. N = 0; the value of negative flag N is 0. ²The result of the operation is zero. Command name: SUBLW Original meaning: Subtract W From Literal Syntax: [label] SUBLW k Operator: Operation description: k – (W) -> W Impact flags: N, OV, C, DC, Z Instruction description: Subtract the constant k from the value of the W accumulator and put the result back into the W accumulator. Category: Immediate constant addressing method. Group: Math subtraction instructions. Example 1: SUBLW 0x02; Subtract 0x02 from the value of the W accumulator and put the result back into the W accumulator.
Previous article:Ultrasonic PIC microcontroller C program
Next article:Single chip microcomputer EC1 digital rotary encoder simulation program
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [MM32 eMiniBoard Review] Building a development environment - lighting up the onboard LED
- EEWORLD University ---- Embedded Development Data Structure
- How to use the assembly language delay subroutine to realize the MCU P2 port to light up 8 LED lights in a loop
- Show off the Feike razor I exchanged with E-coins.
- Loto practical tips (3) Measuring CAN bus communication data
- Installing Android Studio on Xunwei 4412 Development Board (Part 1)
- [Synopsys IP Resources] Meeting China's Evolving Cloud Call Center Technology Needs with IP
- Hard-core black technology is coming! | RIGOL 2020 New Product Launch and Industry Forum Countdown on October 28!
- Processing of default settings after GPIO power-on of HUADA MCU
- CC3200 - TCP Communication