;Description:
;1. This program uses AT89C4051/2051 microcontroller to drive DA converter TLC7225I to output three-phase 50Hz sine wave signal.
;2. Output square wave signal in phase with sine wave at P3.3, P3.4, P3.5 ports. This square wave signal can be used to control the sine signal to
cut off at the zero crossing of the sine signal. ;
;Author: Free Zheng ;
;************************************************************************;
ADD0 EQU P3.0 ;DAC port select low address
ADD1 EQU P3.1 ;DAC port select high address
DAWR EQU P3.2 ;DAC write control
SQA EQU P3.3
SQB EQU P3.4
SQC EQU P3.5
DALD EQU P3.7 ;DAC data output control
OUTA EQU 80H
OUTB EQU 81H
OUTC EQU 82H
OUTD EQU 83H
SCOUNT EQU 200
ASTART EQU 0
BSTART EQU 67
CSTART EQU 133
ORG 00H
AJMP MAIN
ORG 03H
RETI
NOP
NOP
LJMP MAIN
ORG 0BH
RETI
NOP
NOP
LJMP MAIN
ORG 13H
RETI
NOP
NOP
LJMP MAIN
ORG 1BH
RETI
NOP
NOP
LJMP MAIN
ORG 23H
RETI
NOP
NOP
LJMP MAIN
ORG 30H
MAIN: CLR EA
MOV P3,#0E4H
MOV P1,#00H
MOV R0,#ASTART
MOV R1,#BSTART
MOV R2,#CSTART
LBL_ABC_CONTINUE:
MOV DPTR,#SIN
MOV A,R0
MOVC A,@A+DPTR
MOV P1,A
CLR ADD0
CLR ADD1
CLR DAWR
SETB DALD
NOP
NOP
NOP
NOP
CJNE R0,#100,A_SQUARECONV
CPL SQA
JMP A_KEEP
NOP
NOP
LJMP MAIN
A_SQUARECONV:
NOP
NOP
NOP
A_KEEP:
SETB DAWR
INC R0
CJNE R0,#SCOUNT,LBL_A_LESS
MOV R0,#0
CPL SQA
JMP LBL_A_END
NOP
NOP
LJMP MAIN
LBL_A_LESS:
NOP
NOP
JMP LBL_A_END
NOP
NOP
LJMP MAIN
LBL_A_END:
MOV DPTR,#SIN
MOV A,R1
MOVC A,@A+DPTR
MOV P1,A
SETB ADD0
CLR ADD1
CLR DAWR
SETB DALD
NOP
NOP
NOP
NOP
CJNE R1,#100,B_SQUARECONV
CPL SQB
JMP B_KEEP
NOP
NOP
LJMP MAIN
B_SQUARECONV:
NOP
NOP
NOP
B_KEEP:
SETB DAWR
INC R1
CJNE R1,#SCOUNT,LBL_B_LESS
MOV R1,#0
CPL SQB
JMP LBL_B_END
NOP
NOP
LJMP MAIN
LBL_B_LESS:
NOP
NOP
JMP LBL_B_END
NOP
NOP
LJMP MAIN
LBL_B_END:
MOV DPTR,#SIN
MOV A,R2
MOVC A,@A+DPTR
MOV P1,A
CLR ADD0
SETB ADD1
CLR DAWR
SETB DALD
NOP
NOP
NOP
NOP
CJNE R2,#100,C_SQUARECONV
CPL SQC
JMP C_KEEP
NOP
NOP
LJMP MAIN
C_SQUARECONV:
NOP
NOP
NOP
C_KEEP:
SETB DAWR
INC R2
CJNE R2,#SCOUNT,LBL_C_LESS
MOV R2,#0
CPL SQC
JMP LBL_C_END
NOP
NOP
LJMP MAIN
LBL_C_LESS:
NOP
NOP
JMP LBL_C_END
NOP
NOP
LJMP MAIN
LBL_C_END:
CLR DALD
NOP
NOP
NOP
NOP
NOP
SETB DALD
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
JMP LBL_ABC_CONTINUE
NOP
NOP
LJMP MAIN
ORG 0180H
NOP
NOP
LJMP MAIN
ORG 0200H
NOP
NOP
LJMP MAIN
ORG 0280H
NOP
NOP
LJMP MAIN
ORG 0300H
NOP
NOP
LJMP MAIN
ORG 0380H
NOP
NOP
LJMP MAIN
ORG 0400H
NOP
NOP
LJMP MAIN
ORG 0480H
NOP
NOP
LJMP MAIN
ORG 0500H
NOP
NOP
LJMP MAIN
ORG 0600H
NOP
NOP
LJMP MAIN
ORG 0700H
NOP
NOP
LJMP MAIN
ORG 0800H
SIN:
DB 080H, 084H, 088H, 08CH, 090H, 094H, 097H, 09BH, 09FH, 0A3H, 0A7H, 0ABH, 0AFH, 0B2H, 0B6H, 0BAH, 0BDH, 0C1H, 0C4H, 0C7H
DB 0CBH, 0CEH, 0D1H, 0D4H, 0D7H, 0DAH, 0DDH, 0E0H, 0E2H, 0E5H, 0E7H, 0E9H, 0ECH, 0EEH, 0F0H, 0F2H, 0F3H, 0F5H, 0F7H, 0F8H
DB 0F9H, 0FAH, 0FBH, 0FCH, 0FDH, 0FEH, 0FEH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FEH, 0FEH, 0FDH, 0FCH, 0FBH, 0FAH
DB 0F9H, 0F8H, 0F7H, 0F5H, 0F3H, 0F2H, 0F0H, 0EEH, 0ECH, 0E9H, 0E7H, 0E5H, 0E2H, 0E0H, 0DDH, 0DAH, 0D7H, 0D4H, 0D1H, 0CEH
DB 0CBH, 0C7H, 0C4H, 0C1H, 0BDH, 0BAH, 0B6H, 0B2H, 0AFH, 0ABH, 0A7H, 0A3H, 09FH, 09BH, 097H, 094H, 090H, 08CH, 088H, 084H
DB 080H, 07BH, 077H, 073H, 06FH, 06BH, 068H, 064H, 060H, 05CH, 058H, 054H, 050H, 04DH, 049H, 045H, 042H, 03EH, 03BH, 038H
DB 034H, 031H, 02EH, 02BH, 028H, 025H, 022H, 01FH, 01DH, 01AH, 018H, 016H, 013H, 011H, 0FH, 0DH, 0CH, 0AH, 08H, 07H
DB 06H, 05H, 04H, 03H, 02H, 01H, 01H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 01H, 01H, 02H, 03H, 04H, 05H
DB 06H, 07H, 08H, 0AH, 0CH, 0DH, 0FH, 011H, 013H, 016H, 018H, 01AH, 01DH, 01FH, 022H, 025H, 028H, 02BH, 02EH, 031H
DB 034H, 038H, 03BH, 03EH, 042H, 045H, 049H, 04DH, 050H, 054H, 058H, 05CH, 060H, 064H, 068H, 06BH, 06FH, 073H, 077H, 07BH
ORG 08D0H
NOP
NOP
LJMP MAIN
ORG 0900H
NOP
NOP
LJMP MAIN
ORG 0A00H
NOP
NOP
LJMP MAIN
ORG 0B00H
NOP
NOP
LJMP MAIN
ORG 0C00H
NOP
NOP
LJMP MAIN
ORG 0D00H
NOP
NOP
LJMP MAIN
ORG 0E00H
NOP
NOP
LJMP MAIN
ORG 0F00H
NOP
NOP
LJMP MAIN
END
Previous article:RS485 to TTL communication with microcontroller
Next article:PC2004 LCM Driver
- 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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Ask God for help
- 【EVAL-M3-TS6-665PN】1. Here comes a big guy-----EVAL-M3-TS6-665PN
- How to charge shared electric vehicles
- [AIoT Smart Smoke Detection System] LAUNCHXL-CC26X2R1 Development Board Hands-on Experience
- Working Principles and Applications of Embedded Systems
- A brief discussion on the application of PD and QC fast charging protocol deception chip circuit
- IAR prompts that the device cannot be connected
- I have a wireless radio code and I open it with IAR, but I don't have a board. How can I test it?
- MSP430G2553 Software UART and Hardware UART and Jumper Settings
- The "backplane problem" is broken down, let's see how we catch the monster