CODE LẬP TRÌNH CHO VI ĐIỀ U KHIỂ N

Một phần của tài liệu Thiết kế và chế tạo mạch xung áp một chiều (Trang 56 - 76)

org 0000h mov p0,#0ffh mov p1,#0ffh mov p2,#0ffh

;******Bdau ktra********

start:jnb p1.0,x0 ;tso 500Hz ljmp ktra1

;******chon cac do rong xung ******

x0: jnb p0.0,x00 ljmp tso1 x00:clr p2.5 jmp x00 tso1:jb p0.1,tso2 mov r1,#0f8h mov r2,#0f8h mov r3,#0ffh mov r4,#38h ljmp x

tso2:jb p0.2,tso3 mov r1,#0f9h mov r2,#0c0h mov r3,#0feh mov r4,#70h ljmp x

tso3:jb p0.3,tso4 mov r1,#0fah mov r2,#88h mov r3,#0fdh mov r4,#0a8h tso4:jb p0.4,tso5 mov r1,#0fbh mov r2,#50h mov r3,#0fch mov r4,#0e0h ljmp x

tso5:jb p0.5,tso6

mov r1,#0fch mov r2,#18h mov r3,#0fch mov r4,#18h ljmp x

tso6:jb p0.6,tso7 mov r1,#0fch mov r2,#0e0h mov r3,#0fbh mov r4,#50h ljmp x

tso7:jb p0.7,tso8 mov r1,#0fdh mov r2,#0a8h mov r3,#0fah mov r4,#88h ljmp x tso8:jb p2.2,tso9 mov r1,#0feh mov r2,#70h mov r3,#0f9h mov r4,#0c0h ljmp x

tso9:jb p2.3,x0 mov r1,#0ffh mov r2,#38h mov r3,#0f8h mov r4,#0f8h ljmp x

ktra1:jnb p1.1,x1 ;tso 1000Hz ljmp ktra2

;******chon cac do rong xung ******

x1: jnb p0.0,x10 ljmp tso11 x10:clr p2.5

tso11:jb p0.1,tso12 mov r1,#0fch mov r2,#7ch mov r3,#0ffh mov r4,#9ch ljmp x

tso12:jb p0.2,tso13 mov r1,#0fch mov r2,#0e0h mov r3,#0ffh mov r4,#38h ljmp x

tso13:jb p0.3,tso14 mov r1,#0fdh mov r2,#44h mov r3,#0feh mov r4,#0d4h ljmp x

tso14:jb p0.4,tso15 mov r1,#0fdh mov r2,#0a8h mov r3,#0feh mov r4,#70h ljmp x

tso15:jb p0.5,tso16 mov r1,#0feh mov r2,#0ch mov r3,#0fch mov r4,#18h ljmp x

tso16:jb p0.6,tso17 mov r1,#0feh mov r2,#70h mov r3,#0fdh mov r4,#0a8h ljmp x

tso17:jb p0.7,tso18 mov r1,#0feh mov r2,#0d4h mov r3,#0fdh mov r4,#448h ljmp x

tso18:jb p2.2,tso19 mov r1,#0ffh mov r2,#38h mov r3,#0fch mov r4,#0e0h ljmp x

tso19:jb p2.3,x1 mov r1,#0ffh mov r2,#9ch mov r3,#0fch mov r4,#7ch ljmp x

ktra2:jnb p1.2,x2 ;tso 1500Hz ljmp ktra3

;******chon cac do rong xung ******

x2: jnb p0.0,x20 ljmp tso21

x20:clr p2.5 ljmp x20

tso21:jb p0.1,tso22 mov r1,#0fdh mov r2,#0a8h mov r3,#0ffh mov r4,#0bdh ljmp x

tso22:jb p0.2,tso23 mov r1,#0fdh mov r2,#0ebh mov r3,#0ffh

ljmp x

tso23:jb p0.3,tso24 mov r1,#0feh mov r2,#2eh mov r3,#0ffh mov r4,#37h ljmp x

tso24:jb p0.4,tso25 mov r1,#0feh mov r2,#71h mov r3,#0feh mov r4,#0f4h ljmp x

tso25:jb p0.5,tso26 mov r1,#0feh mov r2,#0b3h mov r3,#0feh mov r4,#0b3h ljmp x

tso26:jb p0.6,tso27 mov r1,#0feh mov r2,#0f7h mov r3,#0feh mov r4,#6eh ljmp x

tso27:jb p0.7,tso28 mov r1,#0ffh mov r2,#3ah mov r3,#0feh mov r4,#2bh ljmp x

tso28:jb p2.2,tso29 mov r1,#0ffh mov r2,#7dh mov r3,#0fdh mov r4,#0e8h

ljmp x

tso29:jb p2.3,x2 mov r1,#0ffh mov r2,#0c0h mov r3,#0fdh mov r4,#0a5h ljmp x

ktra3:jnb p1.3,x3 ;tso 2000Hz ljmp ktra4

;******chon cac do rong xung ******

x3: jnb p0.0,x30 ljmp tso31

x30:clr p2.5 ljmp x30

tso31:jb p0.1,tso32 mov r1,#0feh mov r2,#3eh mov r3,#0ffh mov r4,#0ceh ljmp x

tso32:jb p0.2,tso33 mov r1,#0feh mov r2,#70h mov r3,#0ffh mov r4,#9ch ljmp x

tso33:jb p0.3,tso34 mov r1,#0feh mov r2,#0a2h mov r3,#0ffh mov r4,#6ah ljmp x

tso34:jb p0.4,tso35 mov r1,#0feh mov r2,#0d4h

mov r4,#38h ljmp x

tso35:jb p0.5,tso36 mov r1,#0ffh mov r2,#06h mov r3,#0ffh mov r4,#06h ljmp x

tso36:jb p0.6,tso37 mov r1,#0ffh mov r2,#38h mov r3,#0feh mov r4,#0d4h ljmp x

tso37:jb p0.7,tso38 mov r1,#0ffh mov r2,#6ah mov r3,#0feh mov r4,#0a2h ljmp x

tso38:jb p2.2,tso39 mov r1,#0ffh mov r2,#9ch mov r3,#0feh mov r4,#70h ljmp x

tso39:jb p2.3,x3 mov r1,#0ffh mov r2,#0ceh mov r3,#0feh mov r4,#3eh ljmp x

ktra4:jnb p1.4,x4 ;tso 2500Hz ljmp ktra5

;******chon cac do rong xung ******

x4: jnb p0.0,x40

ljmp tso41 x40:clr p2.5 ljmp x40

tso41:jb p0.1,tso42 mov r1,#0feh mov r2,#98h mov r3,#0ffh mov r4,#0d8h ljmp x

tso42:jb p0.2,tso43 mov r1,#0feh mov r2,#0c0h mov r3,#0ffh mov r4,#0b0h ljmp x

tso43:jb p0.3,tso44 mov r1,#0feh mov r2,#0e8h mov r3,#0ffh mov r4,#88h ljmp x

tso44:jb p0.4,tso45 mov r1,#0ffh mov r2,#10h mov r3,#0ffh mov r4,#60h ljmp x

tso45:jb p0.5,tso46 mov r1,#0ffh mov r2,#38h mov r3,#0ffh mov r4,#38h ljmp x

tso46:jb p0.6,tso47 mov r1,#0ffh

mov r3,#0ffh mov r4,#10h ljmp x

tso47:jb p0.7,tso48 mov r1,#0ffh mov r2,#88h mov r3,#0feh mov r4,#0e8h ljmp x

tso48:jb p2.2,tso49 mov r1,#0ffh mov r2,#0b0h mov r3,#0feh mov r4,#0c0h ljmp x

tso49:jb p2.3,x4 mov r1,#0ffh mov r2,#0d8h mov r3,#0feh mov r4,#98h ljmp x

ktra5:jnb p1.5,x5 ;tso 3000Hz ljmp ktra6

;******chon cac do rong xung ******

x5: jnb p0.0,x50 ljmp tso51

x50:clr p2.5 ljmp x50

tso51:jb p0.1,tso52 mov r1,#0feh mov r2,#0d4h mov r3,#0ffh mov r4,#0dfh ljmp x

tso52:jb p0.2,tso53 mov r1,#0feh

mov r2,#0f5h mov r3,#0ffh mov r4,#0beh ljmp x

tso53:jb p0.3,tso54 mov r1,#0ffh mov r2,#16h mov r3,#0ffh mov r4,#9dh ljmp x

tso54:jb p0.4,tso55 mov r1,#0ffh mov r2,#37h mov r3,#0ffh mov r4,#7ch ljmp x

tso55:jb p0.5,tso56 mov r1,#0ffh mov r2,#5ah mov r3,#0ffh mov r4,#5ah ljmp x

tso56:jb p0.6,tso57 mov r1,#0ffh mov r2,#79h mov r3,#0ffh mov r4,#3ah ljmp x

tso57:jb p0.7,tso58 mov r1,#0ffh mov r2,#9ah mov r3,#0ffh mov r4,#19h ljmp x

tso58:jb p2.2,tso59

mov r2,#0bbh mov r3,#0feh mov r4,#0f8h ljmp x

tso59:jb p2.3,x5 mov r1,#0ffh mov r2,#0dch mov r3,#0feh mov r4,#0d7h ljmp x

ktra6:jnb p1.6,x6 ;tso 3500Hz ljmp ktra7

;******chon cac do rong xung ******

x6: jnb p0.0,x60 ljmp tso61

x60:clr p2.5 ljmp x60

tso61:jb p0.1,tso62 mov r1,#0feh mov r2,#0ffh mov r3,#0ffh mov r4,#0e3h ljmp x

tso62:jb p0.2,tso63 mov r1,#0ffh mov r2,#1ch mov r3,#0ffh mov r4,#0c6h ljmp x

tso63:jb p0.3,tso64 mov r1,#0ffh mov r2,#39h mov r3,#0ffh mov r4,#0a9h ljmp x

tso64:jb p0.4,tso65

mov r1,#0ffh mov r2,#56h mov r3,#0ffh mov r4,#8ch ljmp x

tso65:jb p0.5,tso66 mov r1,#0ffh mov r2,#71h mov r3,#0ffh mov r4,#71h ljmp x

tso66:jb p0.6,tso67 mov r1,#0ffh mov r2,#90h mov r3,#0ffh mov r4,#52h ljmp x

tso67:jb p0.7,tso68 mov r1,#0ffh mov r2,#0adh mov r3,#0ffh mov r4,#31h ljmp x

tso68:jb p2.2,tso69 mov r1,#0ffh mov r2,#0cah mov r3,#0ffh mov r4,#18h ljmp x

tso69:jb p2.3,x6 mov r1,#0ffh mov r2,#0e7h mov r3,#0fe mov r4,#0fbh ljmp x

ljmp ktra8

;******chon cac do rong xung ******

x7: jnb p0.0,x70 ljmp tso71

x70:clr p2.5 ljmp x70

tso71:jb p0.1,tso72 mov r1,#0ffh mov r2,#1fh mov r3,#0ffh mov r4,#0e7h ljmp x

tso72:jb p0.2,tso73 mov r1,#0ffh mov r2,#38h mov r3,#0ffh mov r4,#0ceh ljmp x

tso73:jb p0.3,tso74 mov r1,#0ffh mov r2,#51h mov r3,#0ffh mov r4,#0b5h ljmp x

tso74:jb p0.4,tso75 mov r1,#0ffh mov r2,#6ah mov r3,#0ffh mov r4,#9ch ljmp x

tso75:jb p0.5,tso76 mov r1,#0ffh mov r2,#83h mov r3,#0ffh mov r4,#83h ljmp x

tso76:jb p0.6,tso77 mov r1,#0ffh mov r2,#9ch mov r3,#0ffh mov r4,#6ah ljmp x

tso77:jb p0.7,tso78 mov r1,#0ffh mov r2,#0b5h mov r3,#0ffh mov r4,#51h ljmp x

tso78:jb p2.2,tso79 mov r1,#0ffh mov r2,#0ceh mov r3,#0ffh mov r4,#38h ljmp x

tso79:jb p2.3,x7 mov r1,#0ffh mov r2,#0e7h mov r3,#0ffh mov r4,#1fh ljmp x

ktra8:jnb p2.0,x8 ;tso 4500Hz ljmp ktra9

;******chon cac do rong xung ******

x8: jnb p0.0,x80 ljmp tso81 x80:clr p2.5 ljmp x80

tso81:jb p0.1,tso82 mov r1,#0ffh mov r2,#38h mov r3,#0ffh

ljmp x

tso82:jb p0.2,tso83 mov r1,#0ffh mov r2,#4eh mov r3,#0ffh mov r4,#0d4h ljmp x

tso83:jb p0.3,tso84 mov r1,#0ffh mov r2,#64h mov r3,#0ffh mov r4,#0beh ljmp x

tso84:jb p0.4,tso85 mov r1,#0ffh mov r2,#7ah mov r3,#0ffh mov r4,#0a8h ljmp x

tso85:jb p0.5,tso86 mov r1,#0ffh mov r2,#90h mov r3,#0ffh mov r4,#90h ljmp x

tso86:jb p0.6,tso87 mov r1,#0ffh mov r2,#0a6h mov r3,#0ffh mov r4,#7ch ljmp x

tso87:jb p0.7,tso88 mov r1,#0ffh mov r2,#0bch mov r3,#0ffh mov r4,#66h

ljmp x

tso88:jb p2.2,tso89 mov r1,#0ffh mov r2,#0d2h mov r3,#0ffh mov r4,#50h ljmp x

tso89:jb p2.3,x8 mov r1,#0ffh mov r2,#0e8h mov r3,#0ffh mov r4,#3ah ljmp x

ktra9:jnb p2.1,x9 ;tso 5000Hz ljmp start

;******chon cac do rong xung ******

x9: jnb p0.0,x90 ljmp tso91 x90:clr p2.5 ljmp x90

tso91:jb p0.1,tso92 mov r1,#0ffh mov r2,#4ch mov r3,#0ffh mov r4,#0ech ljmp x

tso92:jb p0.2,tso93 mov r1,#0ffh mov r2,#60h mov r3,#0ffh mov r4,#0d8h ljmp x

tso93:jb p0.3,tso94 mov r1,#0ffh mov r2,#74h

mov r4,#0c4h ljmp x

tso94:jb p0.4,tso95 mov r1,#0ffh mov r2,#88h mov r3,#0ffh mov r4,#0b0h ljmp x

tso95:jb p0.5,tso96 mov r1,#0ffh mov r2,#9ch mov r3,#0ffh mov r4,#9ch ljmp x

tso96:jb p0.6,tso97 mov r1,#0ffh mov r2,#0b0h mov r3,#0ffh mov r4,#88h ljmp x

tso97:jb p0.7,tso98 mov r1,#0ffh mov r2,#0c4h mov r3,#0ffh mov r4,#74h ljmp x

tso98:jb p2.2,tso99 mov r1,#0ffh mov r2,#0d8h mov r3,#0ffh mov r4,#60h ljmp x

tso99:jb p2.3,x9 mov r1,#0ffh mov r2,#0ech mov r3,#0ffh

mov r4,#4ch ljmp x

x:mov tmod,#01h mov th0,r1 mov tl0,r2 setb tr0 jnb tf0,$

clr tf0 clr tr0 cpl p2.5

mov tmod,#01h mov th0,r3 mov tl0,r4 setb tr0 jnb tf0,$

clr tf0 clr tr0 cpl p2.5 ljmp x End

Một phần của tài liệu Thiết kế và chế tạo mạch xung áp một chiều (Trang 56 - 76)

Tải bản đầy đủ (DOCX)

(77 trang)
w