I am trying to commuicate with an HP meter via RS232. My attempt at converting the QB code supplied by HP, to FB, has not been successful. I would appreciate help in identifying where the code is in error? I am using a null modem (cross over pins) as stipulated by HP. One of my code line options seems to prove that there is some sort of communication with the meter where I have noted that an error code is received on the meter. But that is the only activity I could get. Pls see following code
Code: Select all
'file: HP.bas
dim as string resp (100)
'9600 baud,even parity, 7 bits,2 stop bits
'rs = supress detection of request to send(RTS) signal
'cd = # of ms to wait for the time-out on data carrier detect (DCD)line
'LF = adds a linefeed to every carriage rtn
'pe = enable parity check
open com "com1:9600,E,7,2,RS,CD,LF,PE" for random as 1 len = 1000 'no meter activity, blank console,hangs
'open com "com2:9600,E,7,2,RS,CD,LF,PE" for random as 1 len = 1000 'no meter activity, console displays queries
'open "com1:9600,E,7,2,RS,CD,LF,PE" for random as 1 len = 1000 'meter displays an error msg, console displays queries
'open "com2:9600,e,7,2,rs,cd,lf,pe" for random as 1 len = 1000 'no meter activity, console displays queries
'put meter in remote operation
print #1, ":SYST:REM"
'query the meter ID
print #1, "*IDN?"
print "*IDN? returned: ",resp (100)
'ask what revision of SCPI meter conforms to
print #1, ":SYST:VERS?"
print ":SYST:VERS? returned: ",resp(100)
sleep
end