Thanks so much for your attention and help in advance.
I' have a problem with TTi (TGA12104) Arbitrary Waveform Generator connected via USB to PC. I'm loading the DLL file into MATLAB and using its functions to send commands to the device.
Device is connected, I can detect the device using "AWG_GetDevices()" and then I use "AWG_Open()" to open the device, there is no problem up to this point, but as I try "AWG_Write()" to send commands, I receive beeps which means the command is not recognized, I can't even reset the device sending a string '*RST'
There is a "TestAWGUSB.exe" provided with the driver which works very well with the same DLL file ensures that the "DLL" file works, the device is connected and there is a problem with what I'm doing in MATLAB(I've been using this device via RS232 but it fails one out of 4 for unknown reasons, anyway this is not related to the problem at all)
Code is consist of some few lines so far, cuz I'm still unable to even reset it via USB :(
I have a "AWGUSB.DLL" "AWGUSB.lib" and "AWGUSB.H" in the same folder as I wrote the MATLAB code.
After loading the device, it's time to open it so
deviceNumber = calllib('AWGUSB','AWG_GetDevices',1,1);
LibPointerDevHandle = calllib('AWGUSB','AWG_Open',deviceNumber,1024,0);
stat = calllib('AWGUSB','AWG_Write',LibPointerDevHandle,'*RST',4);
As I run the last command it beeps(unrecognized command,doesn't restart), command should be a char pointer apparently, so I tried below but still the same
command = '*RST';
cmd = libpointer('cstring',command);
stat = calllib('AWGUSB','AWG_Write',LibPointerDevHandle,cmd,4);
The same problem, I tried sprintf(command) instead of cmd, command,char(command), int32(4) instead of 4! No progress at all!
According to the DLL guide PDF "AWG_Write" should return (-5) in case of an error, and number of transmitted chars otherwise, and 'stat' is always 4 which means writing is ok! But it is not infact! :(
I have no idea what the problem is, is it the format of the command which is not recognized to the "AWG_Write"? Am I not using the write data format!?
Header is attached in text format so that you can see the input argument format.
Thanks a lot!