Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

Interfacing with AFG3102C with Python

Post Reply
Jacob E. Overgaard
Posts: 2
Joined: March 5th, 2018, 9:15 am
Country: Denmark

Interfacing with AFG3102C with Python

Post by Jacob E. Overgaard » March 5th, 2018, 9:26 am

Dear Tektronix enthusiasts

I am currently using Pyvisa and NI-VISA to interface with my AFG3102C (on ethernet) signal generator to automate a measurement setup using the pulse function.

Atm I am using SCPI commands (in lack of better possibilities, could only find SCPI documentation). A simple sample script atm looks like the following:


instr1.write("SOURce1:PULSe:PERiod 200ns")
time.sleep(0.1)
instr1.write("SOURce1:PULSe:DCYCle 10")
time.sleep(0.1)
instr1.write('OUTPUT1:STATE ON')


It does not properly set up my pulse period and the corresponding duty cycle, but it does turn on a 1 MHz 1 V sine wave, which I do not understand.

Is there anyone here with experience in this, who can tell my why this is happening?

Best regards Jacob

David N
Tektronix Applications
Tektronix Applications
Posts: 525
Joined: July 31st, 2008, 8:26 am

Re: Interfacing with AFG3102C with Python

Post by David N » March 5th, 2018, 10:19 am

You need to fist set the AFG to the desired shape using the [SOURce[1|2]]:FUNCtion[:SHAPe] command.

Typically the best way to set up programming for the AFG is to first perform the steps manually from the front panel to set it up to your desired function. Then use the programmers manuals to look for the related commands you used for the manual process and include those in your program code.

Jacob E. Overgaard
Posts: 2
Joined: March 5th, 2018, 9:15 am
Country: Denmark

Re: Interfacing with AFG3102C with Python

Post by Jacob E. Overgaard » March 5th, 2018, 12:25 pm

Ah thank you for your answer, it makes great sense!

I naturally did go through the process, but I mistakenly thought, that setting PULse values would automatically set it to pulse.

I am extremely grateful, thank you!

Post Reply

Return to “AFG1000/2000/3000 series”

Who is online

Users browsing this forum: No registered users and 1 guest