Equivalent ibwrtfW and ibwrtfA function in python visa / gpib module

I am engaged in the automation of laboratory instruments. I have a requirement how the function will send files / binary data via VISA GPIB from PC to PC.

Ni4882.h has the following functions for transferring files / binary data in Visual Studio 2010, and it works. I am well versed in the send command as a GPIB string.

But I never came across sending a file through the GPIB command.

These are the functions I tried in C ++. I used the ni4882.obj file (had a definition of these functions) and created the application, so I managed to transfer the PC file to the tools. But I can not find equivalent functions in python

unsigned long NI488CC ibwrtfA (int ud, const char * filename); unsigned long NI488CC ibwrtfW (int ud, const wchar_t * filename); 

Can someone please let me know the equivalent function in pyvisa or visa python package? - or - any equivalent module to an alternative for this.

I look through all the pyvisa functions and visas, but I could not find equivalent functions.

Thanks in advance!

+6
source share
1 answer

You can try the write_raw method. Try this code:

 import visa rm = visa.ResourceManager() rm.list_resources() # ('ASRL1::INSTR', 'ASRL2::INSTR', 'GPIB0::12::INSTR') ud = rm.open_resource('GPIB0::12::INSTR') #You need to specify your device here. #Read the file into data f = open('file.dat', 'rb') data = list(f.read()) #Write file into device ud.write_raw(data) 

As an alternative to write_raw you can try write_binary_values or write_ascii_values . Both options provide more customization if you need to.

+1
source

All Articles