Home › Forums › HTBasic Forum › Programming modern SCPI equipment over the USB port › Reply To: Programming modern SCPI equipment over the USB port
Check with Ralph, we spent many e-mails working on this issue.
It starts with \n “Newline” issues from these instruments.
1 Your original code did not return the instrument’s ID. Here are the changes I made to make it work.
***************************************************************
Newl$=CHR$(10)
ON ERROR GOSUB Erreur
Isc=18
Devname$=”USBInstrument1″ ! Your Instrument Find in AGILENT Connection Expert / USB Interface
Devname$=”SVA1032X” ! I changed the name of my device with the HTBasic Tools–>Devices
LOAD BIN “USBS;DEV “&Devname$&” ISC “&VAL$(Isc)&” TIME 10″
Identity: Response$=””
OUTPUT Isc;”*IDN?”&Newl$; !!!! NOTE THE NeWL$ and especially the SEMICOLON AT THE END of the line!!!
ENTER Isc USING “#,50A”;Response$ !!! We found that formatting allowed HTBasic to read the string
CLEAR SCREEN
PRINT Response$
PRINT “ISC Setup Success”
WAIT 10
GOTO Exit
Erreur: OFF ERROR
ERROR RETURN
**************************************
Result was printed on the screen as:
Siglent Technologies,SVA1032X,SSA3PCDX5R0598,3.2.2.5.0
ISC Setup Success
Next I played around with formatting the output statement for reading the marker, here is the code I came up with.
**************************************
Newl$=CHR$(10)
ON ERROR GOTO Err
B$=””
OUTPUT @Analyzer;”:CALC:MARK1:FCO:X?”&Newl$; !!!SEMICOLON PUT one at the end of all of our output statements!!!
ENTER @Analyzer USING “#,6A”;B$ !!!Only 6 characters
Marker=VAL(B$)
Err: OFF ERROR
PRINT ERRM$ !!!Print an error to prevent program from halting
PRINT B$
PRINT “Marker Frequency= “;Marker;” MHz”
**************************************
Again Check with Ralph, we had a very long exchange, he contacted other resources that helped define the problem.
HTBasic was written around old GPIB/HPIB instruments, the new stuff is designed entirely differently and CR/LF is not used even ignored by them. So extreme changes need to be made in HTBasic code to accommodate them.
The “Agilent Connection Expert” APP (Windows 10) was the main tool in verifying that it wasn’t an equipment issue!!!
Also “Agilent Interactive I/O tool” APP came along with it. I know I got it with my Agilent 82357B USB-GPIB interface CD,
I have it on all of my machines.
Hope this helps,
Thanks again for all of Ralph’s help!!!
73