MAGNET POWER SUPPLY SYSTEM 7000
17
DANFYSIK A/S - DK 4040 JYLLINGE - DENMARK.
Below is an example written in BASIC on how to turn ON the power supply and read the status
without and with acceptance answer:
Turning the power supply ON and reading/evaluating the status with always answer disabled.
LPRINT "N"+CHR$(13)
:REM Turns the power supply on
LPRINT "S1"
:REM Issues the status command
LINPUT S1$
:REM Read the MPS reply
IF LEFT$(S1$,1) = CHR$(?)
:REM Is it an error message reply?
GOTO ERROR_HANDLING
:REM Yes then go to error module
ENDIF
J=1
DO
:REM evaluate status reply
IF MID$(S1$,J,1)="!"
GOSUB STATUS(J)_ACTIVE
:REM set this status bit active
ELSE
GOSUB STATUS(J)_ACTIVE
:REM set this status bit inactive
ENDIF
J=J+1
UNTIL J=24
Turning the power supply ON with always answer enabled
J=0 :ERROR$=”“
DO
J=J+1
:REM Counter for maximum attempts
LPRINT "N"+CHR$(13)
:REM Turns the power supply on
LINPUT RE$
:REM Read the MPS reply with 0.1 Sec. time out
IF LEFT$(RE$,1) = CHR$(?)
:REM Is it an error reply?
ERROR$=RE$
:REM Mark the error code
ELSEIF RE$=”OK”
:REM Is it a good reply
BRAKE
:REM then exit DO loop
ELSEIF J=6
:REM Try only six times
IF LEFT$(ERROR$,1) = CHR$(?) :REM Was it error reply?
GOTO ERROR_HANDLING :REM Yes then go to error module
ELSEIF
GOTO NO_COMMUNICATION :REM Yes then go to “No answer” error module
ENDIF
ENDIF
UNTIL -1
:REM loop endless
Ps.
An ERROR message includes a "?BELL". (Bell = ASCII 7.)