您的位置 首页 技术

AT89C4051+TLC7225I 三相沟通信号源

;********************************************************************;;说明:;1.本程序使用AT89C4051/2051单片机驱

;********************************************************************;

;阐明:
;1.本程序运用AT89C4051/2051单片机驱动DA转换器TLC7225I输出三相50Hz正弦波信号 ;
;2.在P3.3,P3.4,P3.5口输出与正弦波同相同步的方波信号,该方波信号可用于操控在正弦信号 ;
;的过零处将正弦信号堵截. ;
;作者:Free Zheng ;
;********************************************************************;
ADD0 EQU P3.0 ;DAC口挑选低地址
ADD1 EQU P3.1 ;DAC口挑选高地址
DAWR EQU P3.2 ;DAC写操控
SQA EQU P3.3
SQB EQU P3.4
SQC EQU P3.5
DALD EQU P3.7 ;DAC数据输出操控

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

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/xinpin/jishu/274687.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部