日: 2021年4月25日
4-20mA(H8)
;=======================;
; AD 5410 SET TEST ;
;=======================;
BCLR #4,@P4DR ; DATA: 0
BCLR #5,@P4DR ; CLK: 0
BCLR #6,@P4DR ; LACH: 0
MOV.L #1000,ER5 ; 1000mS wait
JSR @WAIT_TLW_TIME
JSR @DSET9
;;;; reset: 56h+00h+01h ; reset
MOV.B #H’56,R0L ;
JSR @DSET1
MOV.B #H’00,R0L ;
JSR @DSET1
MOV.B #H’01,R0L ;
JSR @DSET1
JSR @DSET9
MOV.L #1000,ER5 ; 1000mSwait
JSR @WAIT_TLW_TIME
;;;; CONTROL: 55h+10h+05h ; 4-20mA ENABLE
MOV.B #H’55,R0L ;
JSR @DSET1
MOV.B #H’10,R0L ;
JSR @DSET1
MOV.B #H’05,R0L ;
JSR @DSET1
JSR @DSET9
MOV.L #1000,ER5 ; 1000mSwait
JSR @WAIT_TLW_TIME
;;;; SET DATA: 01h+00h+00h ; 4mA SET
DALP:
MOV.B #H’01,R0L ;
JSR @DSET1
MOV.B #H’00,R0L ;
JSR @DSET1
MOV.B #H’00,R0L ;
JSR @DSET1
JSR @DSET9
MOV.L #1000,ER5 ; 1000mSwait
JSR @WAIT_TLW_TIME
;;;; SET DATA: 01h+FFh+FFh ; 20mA SET
MOV.B #H’01,R0L ;
JSR @DSET1
MOV.B #H’FF,R0L ;
JSR @DSET1
MOV.B #H’FF,R0L ;
JSR @DSET1
JSR @DSET9
MOV.L #1000,ER5 ; 1000mSwait
JSR @WAIT_TLW_TIME
BRA DALP
;;; DA SET 8 BIT
DSET1: MOV.B #8,R0H ;
DSET2: BCLR #4,@P4DR ; DATA: 0
SHLL.B R0L ;
BCC DSET3
BSET #4,@P4DR ; DATA: 1
DSET3: BSET #5,@P4DR ; CLK: 1
BSET #5,@P4DR
BCLR #5,@P4DR ; CLK: 0
DEC.B R0H ;
BNE DSET2
RTS
DSET9: BSET #6,@P4DR ; LACH: 1
BSET #6,@P4DR ; LACH: 1
BCLR #4,@P4DR ; DATA: 0
BCLR #5,@P4DR ; CLK: 0
BCLR #6,@P4DR ; LACH: 0
RTS