2 - Introduction to Programming

RS-232 Programming Example

The following program illustrates how to program the ac source using RS-232 to set the output voltage and frequency and to read back the model number and output voltage. The program was written to run on any controller using Microsoft QBasic.

NOTE: The ac source must be configured for RS232 and the same baud rate and parity as the controller.

Program to write and read via RS232

Configure serial port for:

9600 baud

7 bit data

2 stop bits

Ignore request to send

Ignore carrier detect

‘ Even parity

‘ Needed with Vectra basic, ignored with QBasic

Send line feed

Reserve 1000 character buffer for serial I/O

DECLARE FUNCTION gets$ ()

‘ Function to read string from ac source

CLS

Clears screen

LOCATE 1, 1

Position cursor at top left

‘ Configure Com1 Port

OPEN “com1:9600,e,7,2,rs,cd,pe,lf” FOR RANDOM AS #1 LEN = 1000

PRINT #1, “*RST”

‘ Resets the ac source

PRINT #1, “VOLT 60”

‘ Set voltage to 60 volts

PRINT #1, “FREQ 50”

‘ Set frequency to 50 hertz

PRINT #1, “OUTPUT ON”

‘ Turn on the output

PRINT #1, “*IDN?”

‘ Query the ac source identification string

PRINT gets$

‘ Go to gets$ Function and print data returned

PRINT #1, MEAS”VOLT?”; volt

‘ Query the ac source voltage

Volt = VAL (gets$)

‘ Convert gets$ string to a value

PRINT gets$

‘ Print the value of the voltage

END

‘ End of main program

FUNCTION gets$

‘ Get a new line feed terminated string from device #1

C$ = “”

‘ Set C$ to null

WHILE c$ <> CHR$ (10)

‘ Set loop to stop at Line Feed

C$ = INPUT$ (1, #1)

‘ Read 1 bit into file #1

Resp$ = resp$ + c$

‘ Concatenate bit with previous bits

WEND

‘ End of WHILE loop

gets$ = resp$

‘ Assign response to gets$

END FUNCTION

 

RS-232 Troubleshooting

If you are having trouble communicating over the RS-232 interface, check the following:

The computer and the ac source must be configured for the same baud rate, parity, and number of data bits. Note that the ac source is configured for 1 start bit and 2 stop bits (these values are fixed).

The correct interface cables or adaptors must be used, as described under "RS-232 Connector" in the User’s Guide. Note that even if the cable has the proper connectors for your system, the internal wiring may be incorrect.

The interface cable must be connected to the correct serial port on your computer (COM1, COM2, etc.).

16

Page 16
Image 16
Agilent Technologies 6811B, 6834B, 6814B, 6843A, 6813B, 6812B manual RS-232 Programming Example, RS-232 Troubleshooting

6812B, 6811B, 6813B, 6834B, 6843A specifications

Agilent Technologies, a leader in electronic test and measurement equipment, offers a range of powerful signal sources including the 6843A, 6834B, 6814B, 6813B, and 6811B models. These instruments are designed to support various applications in research, development, and manufacturing, providing precise signal generation capabilities.

The Agilent 6843A is a versatile signal generator known for its exceptional frequency range and modulation capabilities. It supports an extensive bandwidth, making it ideal for applications that require high-frequency signal generation. With its superior phase noise performance, the 6843A is an excellent choice for radar, wireless communications, and electronic warfare applications. The instrument features an intuitive user interface, allowing engineers to set parameters quickly and efficiently.

Next, the Agilent 6834B offers exceptional performance characteristics, including high output power and low distortion. This signal generator is particularly noted for its ability to produce complex modulation formats, making it suitable for testing advanced wireless communication systems. With a reliable and stable output, the 6834B ensures accurate and repeatable measurements, which is vital for thorough testing processes.

The 6814B model stands out for its dual-channel capabilities, allowing users to generate simultaneous signals for testing multiple components or systems. This feature significantly enhances testing efficiency and flexibility for engineers. With built-in arbitrary waveform functionality, users can create custom waveforms, making the 6814B suitable for a wide range of applications including device characterization and signal processing research.

For those seeking a more compact solution, the Agilent 6813B provides essential signal generation features without compromising on performance. It is designed for a variety of applications across telecommunications and consumer electronics, featuring a straightforward interface and robust performance metrics.

Lastly, the 6811B is an entry-level yet capable model that supports a broad spectrum of testing needs. Perfect for educational and laboratory environments, it provides essential functionalities required for effective signal generation and analysis.

Overall, Agilent Technologies' 6843A, 6834B, 6814B, 6813B, and 6811B signal generators offer an array of features and technologies that cater to various application needs. Their precision, reliability, and user-oriented designs position them as invaluable assets in any testing environment, ensuring engineers can carry out their work with confidence and accuracy.