Entry conditions: The independent variable is in [R0], the polynomial coefficient is after the call instruction, and ends with 40H.
Exit information: When OV=0, the result is still in [R0], and when OV=1, there is an overflow.
Affected resources: DPTR, PSW, A, B, R2~R7, bits 1EH, 1FH Stack requirement: 4 bytes
FPLN: POP DPH ; Get the address where the polynomial coefficients are stored
POP DPL
XCH A,R0 ; R0 and R1 exchange roles, the independent variable is in [R1]
XCH A,R1
XCH A,R0
CLR A ; Clear the first work area
MOV R2,A
MOV R3,A
MOV R4,A
CLR 1FH
PLN1: CLR A ; Read a coefficient and load it into the second work area
MOVC A,@A+DPTR
MOV C,ACC.7
MOV 1EH,C
MOV C,ACC.6
MOV ACC.7,C
MOV R5,A
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV R6,A
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV R7,A
INC DPTR ;Point to the next coefficient
MOV C,1EH ;Compare two numbers
RRC A
XRL A,23H
RLC A
MOV F0,C ;Save the comparison result
LCALL AS1 ;Perform algebraic addition
CLR A ;Read the first byte of the next coefficient
MOVC A,@A+DPTR
CJNE A,#40H,PLN2;Is it the end mark?
XCH A,R0 ;Operation ends, restore the original roles of R0 and R1
XCH A,R1
XCH A,R0
LCALL MOV0 ;Pass the result back to [R0]
CLR A
INC DPTR
JMP @A+DPTR ;Return to the main program
PLN2: MOV A,@R1 ;Compare the signs of the independent variable and the intermediate result
XRL A,23H
RLC A
MOV 1FH,C ;Save the comparison result
LCALL MUL0 ;Perform multiplication
SJMP PLN1 ;Continue the next operation
Previous article:Base 10 floating point logarithm function
Next article:Square root of a number (fast approximation algorithm)
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
- The development history of Chinese radio
- Qorvo simplifies Wi-Fi 6E with first FEM to support 5.1 to 7.1 GHz frequency bands in a single module ...
- 12 "Wanli" Raspberry Pi car - socket learning (Android sending and receiving)
- How does Windows know the last startup failure?
- 【2022 Digi-Key Innovation Design Competition】Latest unboxing post
- EEWORLD University Hall----Live Replay: Intel FPGA Deep Learning Acceleration Technology
- How to assign IMX6-CB200 GPIO
- [Precise delay function] Precise delay function in IAR (MSP430)
- After reading this article from the Research Institute, I feel that 6-lane Wi-Fi still has a long way to go.
- Warning for trouble~~~~ la la la~ hurry to the front of the post to find out