TBLPTR = 0x01A357; The value of TBLPTR register is 0x01A357.
MEMORY (0x01A357) = 0x12
;The value in memory location 0x01A357 is 0x12.
MEMORY (0x01A358) = 0x34
;The value in memory location 0x01A358 is 0x34.
After execution:
TABLAT = 0x34; the value of the TABLAT register is 0x34.
TBLPTR = 0x01A358; the value of TBLPTR register is 0x01A358.
Command name: TBLWT
Original meaning: Table Write
Syntax: [label] TBLWT (*; *+, *-, +*)
Operator: None
Operation description:
uIf TBLWT *,
(TABLAT) -> Holding Register;
TBLPTR No Change;
uIf TBLWT *+,
(TABLAT) -> Holding Register;
(TBLPTR) +1 -> TBLPTR;
uIf TBLWT *-,
(TABLAT) -> Holding Register;
(TBLPTR) -1 -> TBLPTR;
uIf TBLWT +*,
(TBLPTR) +1 -> TBLPTR;
(TABLAT) -> Holding Register;
Impact flags: None
Instruction description: TBLWT is a program memory writing instruction. It has the following four uses:
1.TBLWT*:
Using the contents of the TBLPTRH and TBLPTRL registers as address pointers, write the value in the TABLAT register into the program memory.
2.TBLWT *+:
Using the contents of the TBLPTRH and TBLPTRL registers as address pointers, write the value in the TABLAT register into the program memory, and then automatically increase the address pointer by 1.
3.TBLWT *-:
Using the contents of the TBLPTRH and TBLPTRL recorders as the address pointer, write the value in the TABLAT register into the program memory, and then automatically decrement the address pointer by 1.
4.TBLWT +*:
First add 1 to the TBLPTRH and TBLPTRL recorders, and then use the contents of the TBLPTRH and TBLPTRL recorders as address pointers to write the value in the TABLAT register into the program memory.
Category: Program memory read and write instructions.
Group: Data writing instructions.
Example 1:
TBLWT *+; Use the contents of the TBLPTRH and TBLPTRL recorders as the address pointer, write the value in the TABLAT register into the program memory, and then automatically increase the address pointer by 1.
Before execution:
TABLAT = 0x55; the value of the TABLAT register is 0x55.
TBLPTR = 0x00A356; the value of TBLPTR register is 0x00A356.
Holding Register (0x00A356) = 0xFF
;The value in memory location 0x00A356 is 0xFF.
After execution:
TABLAT = 0x55; the value of TABLAT register is 0x55.
TBLPTR = 0x00A357; The value of TBLPTR register is 0x00A357.
Holding Register (0x00A356) = 0x55
;The value in memory location 0x00A356 is 0x55.
Example 2:
TBLWT +*; First increment the TBLPTRH and TBLPTRL recorders by 1, and then use the contents of the TBLPTRH and TBLPTRL recorders as address pointers to write the value in the TABLAT register into the program memory.
Before execution:
TABLAT = 0x34; the value of the TABLAT register is 0x34.
TBLPTR = 0x01389A; The value of the TBLPTR register is 0x01389A.
Holding Register (0x01389A) = 0xFF
;The value in memory location 0x01389A is 0xFF.
Holding Register (0x01389B) = 0xFF
;The value in memory location 0x01389B is 0xFF.
After execution:
TABLAT = 0x34; the value of the TABLAT register is 0x34.
TBLPTR = 0x01389B; the value of TBLPTR register is 0x01389A.
Holding Register (0x01389A) = 0xFF
;The value in memory location 0x01389A is 0xFF.
Holding Register (0x01389B) = 0x34
;The value in memory location 0x01389B is 0x34.
Command name: TSTFSZ
Original meaning: Test f, Skip if 0
Syntax: [label] TSTFSZ f, a
Operator:
Operation description: Skip if f = 0
Impact flags: None
Instruction description: If the value in temporary register f is equal to 0, skip the next instruction; if the value in temporary register f is not equal to 0, execute the next instruction. 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: Program flow control instructions.
Group: Bit comparison instructions.
Example 1:
HERE TSTFSZ REG, 1; if the value in the temporary register REG is equal to 0, execute the GOTO N2 line of instructions; if the value in the temporary register REG is not equal to 0, execute the GOTO N1 line of instructions.
NZERO GOTO N1;
ZERO GOTO N2;
Before execution:
PC = HERE Address; the current value of the program counter is at the address of the instruction line HERE.
After execution:
If REG = 0x00; If the value in the temporary register REG is equal to 0.
PC = GOTO N2; the value of the program counter will jump to the address of the instruction in the GOTO N2 line.
If REG 0x00; If the value in the temporary register REG is not equal to 0.
PC = GOTO N1; the value of the program counter will jump to the address of the instruction in the GOTO N1 line.
Command name: XORLW
Original meaning: Exclusive OR Literal With W
Syntax: [label] XORLW k
Operator:
Operation description: (W) .XOR. k -> W
Impact flags: N, Z
Instruction description: Perform an exclusive OR (XOR) operation on the constant k and the value of the W accumulator, and put the result back into the W accumulator.
Category: Immediate constant addressing method.
Group: Logical operation XOR instructions.
Example 1:
XORLW 0xAF; Perform an exclusive OR (XOR) operation between the constant k and the value of the W accumulator, and put the result back into the W accumulator.
Before execution:
W = 0xB5; the value of W accumulator is 0xB5.
After execution:
W = 0x1A; the value of W accumulator is 0x1A.
Z = N = 0; both the zero flag Z and the negative flag N are equal to 0.
Example 2:
XORLW 0x40; Perform an exclusive OR (XOR) operation between the constant k and the value of the W accumulator, and put the result back into the W accumulator.
Before execution:
W = 0xB5; the value of W accumulator is 0xB5.
After execution:
W = 0xF5; the value of W accumulator is 0xF5.
N = 1; the negative flag N is equal to 1.
Z = 0; zero flag Z is equal to 0.
Example three:
XORLW 0xB5; Perform an exclusive OR (XOR) operation between the constant k and the value of the W accumulator, and put the result back into the W accumulator.
Before execution:
W = 0xB5; the value of W accumulator is 0xB5.
After execution:
W = 0x00; the value of W accumulator is 0x00.
N = 0; the negative flag N is equal to 0.
Z = 1; zero flag Z is equal to 1.
Command name: XORWF
Original meaning: Exclusive OR W With f
Syntax: [label] XORWF f, d, a
Operator:
Operation description: (W) .XOR. (f) -> dest
Impact flags: N, Z
Instruction description: Perform an exclusive OR (XOR) operation on the constant k and the value of the W accumulator. 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 W accumulator. In the f temporary register, if the temporary register that stores the operation result is stored in the W accumulator, we can also write it as W (table W accumulator); if the temporary register that stores the operation result is stored in the temporary register, we It can also 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: Logical operation XOR instructions.
Example 1:
XORWF REG,f; The value of the REG temporary register performs a mutually exclusive OR (XOR) operation with the W accumulator, and the result of the operation is placed in the REG temporary register.
Before execution:
W = 0xB5; the value of W accumulator is 0xB5.
REG = 0xAF; the value of the REG register is 0xAF.
After execution:
W = 0xB5; the value of W accumulator is 0xB5.
REG = 0x1A; the value of the REG register is 0x1A.
Z = N = 0; both the zero flag Z and the negative flag N are equal to 0.
Example 2:
XORWF REG,W; perform a mutually exclusive OR (XOR) operation on the value of the REG temporary register and the W accumulator, and put the result of the operation into the REG temporary register.
Before execution:
W = 0xB5; the value of W accumulator is 0xB5.
REG = 0xAF; the value of the REG register is 0xAF.
After execution:
W = 0x1A; the value of W accumulator is 0x1A.
REG = 0xAF; the value of the REG register is 0xAF.
Z = N = 0; both the zero flag Z and the negative flag N are equal to 0.
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
- LTC2325-16 Sampling Issues
- Design considerations for single-chip microcomputer key scanning program
- How to change the library file in the schematic diagram in orcad?
- Free application: Domestic FPGA Gaoyunjia Little Bee Family GW1N Series Development Board
- Taking stock of the college entrance examination experience of Internet tycoons! How many points did you get in the exam?
- Without American EDA software, we can’t make chips?
- 【Share】Flash management tools: FAL (Flash Abstraction Layer) library
- Good morning my love——One Xiao and One Jian
- [Awards awarded] Grab the post! Download the TWS headset white paper, write a wonderful review, and win a JD card!
- [RVB2601 Creative Application Development] Record the startup process of the hello world system