Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-568x serial link commands "TRGIMM" etc

Hi,

 

I am using a NI USB-5681 power sensor with python. I know you can use the ni568x_64.dll with ctypes and this works but this is a very clumsy method.

 

If I monitor the USB bus I noticed the USB-5681 acts as a serial device and you can talk to it through the serial link using pySerial.

 

The following python code reads the power measurement using the serial interface

 

import serial as s
from time import sleep

ser = s.Serial('COM10',timeout=None)                                          # open serial port
ser.write(b"IDN?\n")
print( ser.read_until('\n'.encode('utf-8')).decode('utf-8'))
ser.write(b"RST\n")
print(ser.read_until('\n'.encode('utf-8')).decode('utf-8'))
ser.write(b"START\n")
print(ser.read_until('\n'.encode('utf-8')).decode('utf-8'))

try:
  while True:
    ser.write(b"TRGIMM\n")
    print(ser.read_until('\n'.encode('utf-8')).decode('utf-8'))
except KeyboardInterrupt:
  pass

ser.close()

 

Please can you give me a link to the user manual for the NI-5681 RF POWER METER serial commands. The NI website seems to avoid the subject.

 

MPC.

0 Kudos
Message 1 of 2
(340 Views)

Reverse engineering is probably the only way to figure out the commands, as NI officially recommends using the 568x only through their NI-568x driver and not through VISA or serial.

 

If you are motivated enough, you can use the Soft Front Panel, monitor the commands, and create a map between the various SFP operations and commands.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 2
(299 Views)