⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asm

📁 单片机的类PLC功能程序原代码,若有PLC的使用经历
💻
📖 第 1 页 / 共 3 页
字号:
                mov     Time1ctrH,#H100ms

PwrOn1:         mov      c,S008
                orl      c,Time1str
                anl      c,/Time1out
                mov      Time1str,c

                jnb      Time1Out,PwrOnRet

                call    Sysinit
                setb    s008
                inc     stp
                
PwrOnRet:       ret
;-----------------------------------------------------------------------------
maininit:       ;0
;-----------------------------------------------------------------------------
                call    Sysinit
                setb    s008
                inc     stp

                ret
;-----------------------------------------------------------------------------
StrUp:          ;1
;-----------------------------------------------------------------------------
stp1IO:         jnb      s008,StrU1
                jnb      Str, StrU0
                mov      DifPrgtmp0,#1
StrU0:          jnb      s1,StrU1
                orl      DifPrgtmp0,#2

StrU1:          mov     c,Str
                mov     difu0,c
		
		mov	c,fu0
		orl	c,Pass
		mov	Pass,c

                mov     c,fu0
                orl     c,/Sol1
                cpl     c
                mov     Sol1,c

                mov     c,S1
                mov     difu1,c

                jnb     fu1,StrUret

                call    DifTimRef
                setb    s008
                inc     stp

StrUret:        ret
;-----------------------------------------------------------------------------
RTest:          ;2
;-----------------------------------------------------------------------------
RisIO:          jnb      s008,Ris1
                jnb      R_Rej,RisIO1
                orl      DifPrgtmp0,#1
RisIO1:         jnb      Rst,Ris1
                orl      DifPrgtmp0,#2

Ris1:           jb      time1str,Ris10
                mov     Time1ctrL,#l1s
                mov     Time1ctrH,#H1s                 ;Ris RST 
Ris10:          jb      time2str,Ris11
                mov     Time2ctrL,#l100ms              ;Ris STR
                mov     Time2ctrH,#H100ms
Ris11:          jb      time3str,Ris12
                mov     Time3ctrL,#l1s                  ;Ris TST
                mov     Time3ctrH,#H1s
Ris12:          jb      time4str,Ris13
                mov     Time4ctrL,#l500ms               ;RST Ris
                mov     Time4ctrH,#H500ms
Ris13:          jb      time5str,Ris14                   ;RST rly_Ris
                mov     Time5ctrL,#l500ms
                mov     Time5ctrH,#H500ms
Ris14:          jb      time6str,Ris2                   ;RST rly_Ris
                mov     Time6ctrL,#l100ms
                mov     Time6ctrH,#H100ms


Ris2:           mov     c,s008
                orl     c,time1str                
		anl	c,/time1out
                mov     time1str,c
		
	        mov     c,s008
		orl	c,/Rly_R
		anl	c,/Time4out
		cpl     c
                mov     Rly_R,c

                mov     c,time1out
                orl     c,Time2str
                anl     c,/Time2Out
                mov     Time2str,c
                cpl     c
                mov     R_Str,c

                mov     c,time1out
                orl     c,Time3str
                anl     c,/fu0
                anl     c,/Time3out
                mov     Time3str,c

		mov     c,Time3out
		orl	c,a001
		orl	c,Time6str
		anl	c,/Time6out
		mov	Time6str,c
		cpl	c
		mov	R_Rst,c


		mov	c,Time3out
		orl	c,a001
		orl	c,Time4str
		anl	c,/Time4out
		mov	Time4str,c
		
		mov	c,Time4out
		orl	c,Time5str
		anl	c,/Time5out
		mov	Time5str,c		
		
		mov	c,R_Rej
		mov	difu0,c
		
		mov	c,fu0
		orl	c,a000
		mov	a000,c

		mov	c,fu0
		orl	c,/Rej
		anl	c,/a001
		cpl	c
		mov	Rej,c
		mov	Buz,c

		mov	c,Rst
		mov	difu1,c

		mov	c,fu1
		anl	c,a000
		mov	a001,c		
		
Ris3:		mov	c,Time5out
		anl	c,a000
		jnc	Ris30		
                setb    s008
                call    DifTimRef
                mov     stp,#4
		ret
		
Ris30:	    	mov	c,Time5out
		anl	c,/a000
		jnc     Risret
                setb    s008
                call    DifTimRef
                inc     stp

Risret:          ret

;-----------------------------------------------------------------------------
HiPotTest:      ;2
;-----------------------------------------------------------------------------
HPIO:          jnb      s008,HP1
               jnb      Hp_Rej,HPIO1
               orl      DifPrgtmp0,#1
HPIO1:         jnb      Hp_Pass,HPIO2
               orl      DifPrgtmp0,#2
HPIO2:         jnb      Rst,HP1
               orl      DifPrgtmp0,#4

HP1:            jb      time1str,HP10
                mov     Time1ctrL,#l1s
                mov     Time1ctrH,#H1s                 ;HP RST 
HP10:          jb      time2str,HP11
                mov     Time2ctrL,#l100ms              ;HP STR
                mov     Time2ctrH,#H100ms
HP11:          jb      time3str,HP12
                mov     Time3ctrL,#l1s                  ;HP TST
                mov     Time3ctrH,#H1s
HP12:          jb      time4str,HP13
                mov     Time4ctrL,#l500ms               ;RST HP
                mov     Time4ctrH,#H500ms
HP13:          jb      time5str,HP14                   ;RST rly_HP
                mov     Time5ctrL,#l500ms
                mov     Time5ctrH,#H500ms
HP14:          jb      time6str,HP2                   ;RST rly_HP
                mov     Time6ctrL,#l100ms
                mov     Time6ctrH,#H100ms


HP2:            mov     c,s008
                orl     c,time1str                
		anl	c,/time1out
                mov     time1str,c
		
	        mov     c,s008
		orl	c,/Rly_Hp
		anl	c,/Time4out
		cpl     c
                mov     Rly_HP,c

                mov     c,time1out
                orl     c,Time2str
                anl     c,/Time2Out
                mov     Time2str,c
                cpl     c
                mov     HP_Str,c

		mov	c,Hp_Rej
		mov	difu0,c

		mov	c,Hp_Pass
		mov	difu1,c
				

		mov     c,fu1
		orl	c,a001
		orl	c,Time6str
		anl	c,/Time6out
		mov	Time6str,c
		cpl	c
		mov	HP_Rst,c

		mov	c,fu1
		orl	c,a001
		orl	c,Time4str
		anl	c,/Time4out
		mov	Time4str,c
		
		mov	c,Time4out
		orl	c,Time5str
		anl	c,/Time5out
		mov	Time5str,c		
				
		mov	c,fu0
		orl	c,a000
		mov	a000,c

		mov	c,fu0
		orl	c,/Rej
		anl	c,/a001
		cpl	c
		mov	Rej,c
		mov	Buz,c

		mov	c,Rst
		mov	difu1,c

		mov	c,fu1
		anl	c,a000
		mov	a001,c		
		
HP3:		mov	c,Time5out
		anl	c,a000
		jnc	HP30		
                setb    s008
                call    DifTimRef
                mov     stp,#4
		ret
		
HP30:	    	mov	c,Time5out
		anl	c,/a000
		jnc     HPret
		clr     Pass
                setb    s008
                call    DifTimRef
                inc     stp

HPret:          ret

;-----------------------------------------------------------------------------
SolExt:         ;3
;-----------------------------------------------------------------------------
                jb      time1str,SolExt0
                mov     Time1ctrL,#l1s
                mov     Time1ctrH,#H1s


SolExt0:        mov     c,s008
                orl     c,Time1Str
                mov     Time1Str,c

                setb     Sol1


                jnb     Time1out,Solret

                setb    s008
                call    DifTimRef
                mov     stp,#1

Solret:         ret

;-----------------------------------------------------------------------------
;*********************************************************************************
Intio:          clr     s008
                push    acc
                push    psw
                mov     psw,#RsBank3
                mov     th0,#0f1h
                mov     tl0,#0

                call    DIF
                call    TimeCnterRefresh
                call    CnterInt
                call    scanIO

INT10mS:        djnz     It_sv,IntRet
                mov      It_sv, #4

                call    TimeInt

IntRet:         pop     psw
                pop     acc
                reti
                
;*********************************************************************************
;-------------------------------------------------------------------------------
DIF:            mov     difwhOut0,#0                   ;wh
                mov     a,DifwhIn0
                xrl     a,difwhTmp0

l0wh_dif:       mov     c,acc.0
                jnb     difuwh0,l1wh_dif
                mov     fuwh0,c

l1wh_dif:       mov     c, acc.1
                jnb     difuwh1,l2wh_dif
                mov     fuwh1,c
                
l2wh_dif:       mov     c, acc.2
                jnb     difuwh2,l3wh_dif
                mov     fuwh2,c
                
l3wh_dif:       mov     c, acc.3
                jnb     difuwh3,l4wh_dif
                mov     fuwh3,c
                
l4wh_dif:       mov     c, acc.4
                jnb     difuwh4,l5wh_dif
                mov     fuwh4,c
                
l5wh_dif:       mov     c, acc.5
                jnb     difuwh5,l6wh_dif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -