AT89C4051+TLC7225I three-phase AC signal source

Publisher:superstar11Latest update time:2016-08-08 Source: eefocusKeywords:AT89C4051  TLC7225I Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
;********************************************************************;

;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

Keywords:AT89C4051  TLC7225I Reference address:AT89C4051+TLC7225I three-phase AC signal source

Previous article:RS485 to TTL communication with microcontroller
Next article:PC2004 LCM Driver

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号