When developing the 'Speech Teaching Instrument with Pinyin', the author encountered such a requirement: determine a function value (the code of the pronunciation spelled out by these three) based on three independent variables (the key value of the initial consonant, the key value of the final consonant, and the key value of the four tones), where the values of the independent variables and the function are both known, but there is no clear correspondence between them. In addition, it is required to determine whether the independent variables have corresponding function values. The conventional table lookup method cannot be used. After some research, the author compiled a table lookup program to solve this problem.
1. Table lookup requirements:
Input variables: 1 ) the key value of the initial consonant, 2 ) the key value of the final vowel, 3 ) the key value of the four tones ( varies between 47-50 ).
Output result: the code of the corresponding pronunciation.
Table lookup requirements: Determine whether there is a corresponding value based on the input. If so, output the corresponding code. If not, give a not found mark.
2. Table Lookup Procedure:
;**********************************************************************
; Double spelling processing
; Entrance : 2EH and 2DH store the initials and finals of the spelling respectively , and 2CH stores the four tones of the spelling .
; Exit : If found, return the serial number value of the sound signal in 50H , and set 06H to 1
; If not found , 06H is cleared to ''0''
; R6 is used as a total number of spelling counters
;***********************************************************************
J_XH2:
PUSH PSW
MOV R6,#0
MOV DPTR,#J_X2
J2_LP0:
INC R6
CLR A
MOVC A,@A+DPTR
CJNE A,2EH,J2_NOTEQH; take initial consonants , compare , if not equal, transfer
INC DPTR
MOVC A,@A+DPTR
CJNE A,2DH,J2_NOTEQL; if the initials are equal , the finals are not equal.
MOV A,2CH
SUBB A, #47; minus 47 ( radix , so the key value starts at ''0'' and goes from 0 to 3)
MOV R7,A; R7 is used as a four-tone key value counter
J2_LOOP:
CJNE R7,#0,J2_LOOP1; if the value in R7 is not 0, then go to loop
AJMP J2_DONE
J2_LOOP1:
INC DPTR
DEC R7
AJMP J2_LOOP
J2_DONE:; Get data
INC DPTR
CLR A
MOVC A,@A+DPTR
MOV50H,A; store number
SETB06H
AJMP J2_RET
J2_NOTE:
INC DPTR
J2_NOTEQL:
INC DPTR
INC DPTR
INC DPTR
INC DPTR
CJNE R6,#SPZS,J2_LP0; if not equal to the total number of double spellings , continue the cycle
CLR06H
J2_RIGHT:
POP PSW
RIGHT
J_X2:DB1826100101102103;zi
DB1926104105106107;ci
DB2026108109110111;si.
3. Description
Before using this program, you must know exactly how many data there are in the table and define a constant: SPZS , that is, define it as follows in the program header (assuming there are 100 data in the table):
SPZS EQU100
According to this program, it is not difficult to get the three-spelling table lookup program. The above program has been verified and proved to be running correctly.
Previous article:msp430 software installation cracking process
Next article:MSP430 microcontroller framework program
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- TPS23861 48V power supply has a small probability of burning out.
- Free resource download | Five trends driving change in power management
- My Journey of MCU Development (Part 2)
- 【Development and application based on NUCLEO-F746ZG motor】13. Parameter configuration - USART3 configuration
- What is the sound-generating mechanism of a piezoelectric buzzer? How to choose the sound component?
- The mechanical and electrical parts of the intelligent car based on the DFRobot four-way motor driver board have been preliminarily completed.
- [Example] Easily implement wifi remote RS485 bus (multi-node bus)
- Forum friends give examples to explain these operators in C language
- Talk about the upper and lower tubes of the buck circuit_DC-DC BUCK bootstrap circuit
- Real-time solution to single chip microcomputer delay