12
DAC internal device v. 2.6
;-------------------------------------------------------------------------------------
; Name File
: TASK_00.MOD
; Project
: EX_DAC
; Description : Gestione Posizionamento
;-------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------
; Device initialization
;-------------------------------------------------------------------------------------
Asse:offset = 0
;Offset voltage
Asse:uplim = 32767
;Max. value of analog output
;(+10V)
Asse:lowlim = -32768
;Min. value of analog output
;(-10V)
OUTDIR Asse
;Set analog output sign
WAIT NOT Asse:st_outrev
;Check analog output sign
slOutAna = 0
;Set analog output input variable to 0 Volt
;-------------------------------------------------------------------------------------
;
Setting of the analog output
;------------------------ Used variables -------------------------------------
; slOutAna: percentage value of analog output (% of uplim)
; ifChangeOut: input used to reverse the sign of analog output
; gfCambio: flag for rising front detection of input ifChangeOu
;-------------------------------------------------------------------------------------
MAIN:
IF ifChangeOut
IF NOT gfCambio
;Wait for input activation
gfCambio = 1
;Write the new analog output value
Asse:in = (slOutAna * Asse:uplim) /100
;Set analog output sign
ENDIF
ELSE
gfCambio = 0
;Write the new analog output value
ENDIF
;-------------------------------------------------------------------------------------
;
Final operation
;-------------------------------------------------------------------------------------
WAIT 1
JUMP MAIN
END
DAC management