|
|
|
|
| Example Programs - D |
1085 | ’ |
|
|
|
|
1090 | ’Query dc source outputs CURRENT?" | :GOSUB 2000 :GOSUB 3000 | |||
1100 | VOUT = OUTPUTS(1) |
|
|
|
|
1105 | IOUT = OUTPUTS(2) |
|
|
|
|
1110 | PRINT "The output levels are "VOUT" Volts and "IOUT" Amps" | ||||
1115 | ’ |
|
|
|
|
1120 | ’Program triggered current level to value insufficient to maintain | ||||
1125 | ’supply within its CV operating characteristic | ||||
1130 | CODES$ = "CURR:TRIG MIN" :GOSUB 2000 |
|
| ||
1135 | ’ |
|
|
|
|
1140 | ’Set operation status mask to detect mode change from CV to CC | ||||
1145 | CODES$ = "STAT:OPER:ENAB 1024;PTR 1024" |
| :GOSUB 2000 | ||
1150 | ’ |
|
|
|
|
1155 | ’Enable Status Byte OPER summary bit |
|
|
| |
1160 | CODES$ = "*SRE 128" :GOSUB 2000 |
|
|
| |
1165 | ’ |
|
|
|
|
1170 | ’Arm trigger circuit and send trigger to dc source | ||||
1175 | CODES$ = "INITIATE:SEQUENCE1;TRIGGER" |
| :GOSUB 2000 | ||
1180 | ’ |
|
|
|
|
1185 | ’Wait for supply | to respond to trigger |
|
| |
1190 | FOR I= 1 to 100 | :NEXT I |
|
|
|
1195 | ’ |
|
|
|
|
1200 | ’Poll for interrupt caused by change to CC mode and print to | ||||
screen |
|
|
|
|
|
1205 | CALL IOSPOLL (PS,RESPONSE) |
|
|
| |
1210 | IF (RESPONSE AND 128) <> 128 THEN GOTO 1240 | ’No OPER event to | |||
report |
|
|
|
|
|
1215 | CODES$ = "STATUS:OPER:EVEN?" :GOSUB 2000 | ’Query status oper | |||
register |
|
|
|
| |
1220 | CALL IOENTER (PS,OEVENT) |
|
| ’Read back event bit | |
1225 | IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR |
| |||
1230 | IF (OEVENT AND 1024) = 1024 THEN PRINT "Supply switched to CC | ||||
mode." |
|
|
|
|
|
1240 | ’Clear the status circuit |
|
|
| |
1245 | CODES$ = "*CLS" | :GOSUB 2000 |
|
|
|
1250 | FOR I = 1 TO 100 | :NEXT I |
|
| ’Wait for supply to |
clear |
|
|
|
|
|
1255 | ’ |
|
|
|
|
1260 | ’Disable output and save present state in location 2 | ||||
1265 | CODES$ = "OUTPUT OFF;*SAV 2" :GOSUB 2000 |
| |||
1270 | END |
|
|
|
|
1275 | ’ |
|
|
|
|
2000 | ’Send command to dc source |
|
|
| |
2005 | LENGTH = LEN(CODES$) |
|
|
| |
2010 | CALL IOOUTPUTS (PS,CODES$,LENGTH) |
|
| ’Send command to | |
interface |
|
|
|
| |
2015 | IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR | ’SETUP.BAS error | |||
trap |
|
|
|
|
|
2020 | RETURN |
|
|
|
|
2025 | ’ |
|
|
|
|
3000 | ’Get data from dc source |
|
|
| |
3005 | CALL IOENTERA (PS,OUTPUTS(1),MAX.ELEMENTS,ACTUAL.ELEMENTS) | ||||
3010 | IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR |
| |||
3015 | RETURN |
|
|
|
|
95