11-09-2018 12:35 PM
Hi there,
Has anybody got idea what is wrong with my code?
Error occurs first at the output of gx3x0 Configure.vi.
11-09-2018 01:15 PM
Can you see that this device is connected to COM4? Your error in the Config.vi seems to indicate that one of the setting you give that VI is incorrect. Can you test the settings on the front panel to make sure that they work, then use those in code? I think you probably have to specify parameters for every input to the VI, defaults might be causing an issue here.
Once you get that problem fixed you'll want to move that Close.vi out of the while loop. Not sure what the first VI in the while loop is, but once you call the Close.vi and close communications to the instrument you likely won't be able to execute that on the next loop iteration.
11-09-2018 02:10 PM
Yes, i can see COM4 is recognised by windows. I can't add anything else to "Initialize" function but the number of COM port.
E.g.: Earlier i made a code in which there was Agilent 33220A function generator that had more properties to set. Thus I could get a running code.
But, in my current project relating to Metrix GX320 there is no serial configuration.
Datesheet reads :
'The new COM port is configured as follows:
- speed: 19200 bauds
- data bits: 8
- parity: none
- stop bit: 1
- protocol: hardware (RTS / CTS)'
and
'All the devices GX 310 or GX 320 – whether programmable or not –
respond to the IEEE488.2 *idn? command which returns the device
identification and version.'
It is okay, i'll move Close.vi out of the while loop.
Thanks for your help.
11-09-2018 02:29 PM
I wasn't referring to the setting for INIT, but to Configure.vi. Did you try to specify something for every input (Duty cycle, freq, etc..)?
I think by not specifying some inputs you are either telling it they are 0, or accepting some default that it doesn't like. Try a set of parameters that works with what you can setup on the instruments front panel.
11-09-2018 02:34 PM
Are you using a USB-RS232 adaptor?
You did try using NI-MAX to communicate with this instrument at COM4? (*IDN?\r)
And you got the right reply?
If so that's good and its not a problem with the cable/physical connection.
Craig
11-10-2018 01:39 AM
Instrument has built in "Silicon Labs CP210x USB to UART Bridge". I have tried to configure COM4 in Windows, but i still get error code:1210.
Then I opened NI MAX:
For some reason I cannot change port setting in NI MAX.
11-10-2018 06:09 PM
Ok, so you can see it in NI-MAX. (No need to change the port setup!)
Can you open a test panel and communicate with the instrument?
11-12-2018 12:58 AM - edited 11-12-2018 12:58 AM
Yes, i can communicate with instrument in NI MAX.
Note: I added gx3x.LLB and gx3x.dll to my project at the very beginning. Using functions provided by manufacturer.
Even though i get that Error 1210 now.
Have you got any ideas what may cause this issue?
11-12-2018 01:07 AM
Please see the attached VIs I use:
11-12-2018 09:39 AM
Ok, now I see it. It was staring us in the face in the first screen capture you posted...but I missed it. Just to confirm I downloaded the driver and tried myself. It seem the creator of the driver used non-standard terminal configuration where the top left terminal is the serial port id, but the top right is an integer reference to an error. So unlike most instrument drivers you can't simply chain driver VIs together and have the instrument id flow left to right. Nasty trick!
Give this a try. I think you were always successfully initializing communications with the first VI which returned a 0 for error integer, which was past as the serial port id to the next VI which is of course wrong so it caused an error.
Personally I'd be inclined to explode that LLB, rework all the VIs and save my own version of the driver that you could wire like other drivers.
Let me know if that helps.
Craig