Zwar hat bobobo das in Windows erzeugt, aber ich wollte mal eine Consoleausgabe
zeigen. Leider kann ich bei mir an meinem Multimeter, sowas nicht testen. Kannst ja
mal ausprobieren ob es so bei dir läuft. Wegen dem Puffer, das kannst du ja ändern.
Die Variablen habe ich nur mit Space belegt. Also bitte nur als Testcode ansehen.
Garantieren kann ich im Moment hier nichts, ob es so bei dir läuft.
Code: Alles auswählen
OpenConsole("Ausgabe Multimeter")
ClearConsole() ;CLS
ConsoleLocate(1,1);LOCATE 1, 1
cmd$=Space(100)
resp$=Space(10000);Dim cmd$(100), resp$(1000)
; Set up serial port For 9600 baud, even parity, 7 bits;
; Ignore Request To Send And Carrier Detect; Send line feed,
; enable parity check, reserve 1000 bytes For input buffer
;
;OPEN "com1:9600,e,7,2,rs,cd,lf,pe" For RANDOM As #1 LEN = 1000
OpenSerialPort(1,"COM1",9600,#PB_SerialPort_EvenParity,7,2, #PB_SerialPort_NoHandshake, 1000, 1000)
;
; Put the multimeter into the remote operation mode
WriteSerialPortString(1, ":SYST:REM");PRINT #1, ":SYST:REM" ; Format hier ist #PB_Ascii (auch im Unicode-Modus) standard
;
; Query the multimeter’s id string
;
WriteSerialPortString(1, "*IDN?");PRINT #1, "*IDN?"
Laenge.l=AvailableSerialPortInput(1)
If ReadPuffer
ReadSerialPortData(1, @resp$, Laenge); LINE INPUT #1, resp$
PrintN("*IDN? returned: "+resp$) ; PRINT "*IDN? returned: ", resp$
EndIf
;
; Ask what revision of SCPI the multimeter conforms To
WriteSerialPortString(1, ":SYST:VERS?");PRINT #1, ":SYST:VERS?"
Laenge=AvailableSerialPortInput(1)
If ReadPuffer
ReadSerialPortData(1, @resp$, Laenge);LINE INPUT #1, resp$
PrintN(":SYST:VERS? returned: "+ resp$) ;PRINT ":SYST:VERS? returned: ", resp$
EndIf
;
; Send a message To the multimeter’s display, And generate a beep
WriteSerialPortString(1, ":SYST:BEEP;:DISP:TEXT ’HP 34401A’");PRINT #1, ":SYST:BEEP;:DISP:TEXT ’HP 34401A’"
;
; Configure the multimeter For dc voltage readings,
; 10 V range, 0.1 V resolution, 4 readings
WriteSerialPortString(1, ":CONF:VOLT:DC 10,0.1;:SAMP:COUN 4");PRINT #1, ":CONF:VOLT:DC 10,0.1;:SAMP:COUN 4"
; Trigger the readings, And fetch the results
WriteSerialPortString(1, ":READ?");PRINT #1, ":READ?"
If ReadPuffer
ReadSerialPortData(1, @resp$, Laenge);LINE INPUT #1, resp$
PrintN(":READ? returned: "+ resp$) ;PRINT ":READ? returned: ", resp$
EndIf
PrintN("Druecken Sie Return zum Schliessen der Konsole.")
Input()
CloseSerialPort(1)
CloseConsole()
End
PS: Änderungswünsche und Korrekturen sind natürlich erwünscht
Gruß,
Falko