Use a Crimson program on a Red Lion G07 to request a measurement from an Agilent 34461A voltmeter through its LAN interface. The sample uses Crimson logical port 4 with a raw TCP/IP driver, sends CR and LF after each command, reads the returned text, converts the text to a floating-point value, and exits the program.
Voltmeter.RawVolts.CV.CV_ForPartA.Configuration note: The supplied information does not specify the 34461A IP address, TCP service or port number, measurement setup, or the Crimson program/event that executes the code. Configure and verify these application-specific items for the installed system.
PortPrint(4, "CLS") sends the CLS command through logical port 4.PortWrite(4,13) sends CR (carriage return), and PortWrite(4,10) sends LF (line feed), through logical port 4.PortPrint(4, "INIT") sends the INIT command, followed by CR and LF.PortPrint(4, "FETC?") sends the FETC? query, followed by CR and LF.PortInput(4, 0, 10, 100, 20) reads the response from logical port 4. Reception begins immediately because start is zero. The end character is 10, the inter-character timeout is 100 ms, and the maximum length is 20 characters.Voltmeter.RawVolts.TextToFloat(Voltmeter.RawVolts) converts the returned text and assigns the result to CV.CV_ForPartA.return; exits the program at that point.Crimson documents PortPrint(), PortWrite(), and PortInput() for raw port drivers, including raw TCP/IP drivers. PortInput() returns the received characters without the start or end byte. If it times out while either end or length is nonzero, it returns an empty string.
Voltmeter.RawVolts string tag and CV.CV_ForPartA floating-point tag.Voltmeter.RawVolts contains the expected returned text.CV.CV_ForPartA contains the corresponding converted value.No measured validation results were supplied.
Voltmeter.RawVolts is empty, verify the TCP connection, response termination, response timing, and expected response length. Crimson documents that PortInput() returns an empty string after a timeout when the end or length parameter is nonzero.PortPrint(4, "*CLS"); PortWrite(4,13);//CR(CarriageReturn) PortWrite(4,10);//LF(LineFeed) Sleep(200); PortPrint(4, "INIT"); PortWrite(4,13);//CR(CarriageReturn) PortWrite(4,10);//LF(LineFeed) Sleep(800); PortPrint(4, "FETC?"); PortWrite(4,13);//CR(CarriageReturn) PortWrite(4,10);//LF(LineFeed) Voltmeter.RawVolts := PortInput(4, 0, 10, 100, 20); CV.CV_ForPartA = TextToFloat(Voltmeter.RawVolts); return;
PortInput, PortPrint, and PortWrite.
Need Further assistance? Submit a support ticket here.
https://support.hms-networks.com/
© HMS Networks AB 2026