08-15-2011 06:45 PM
If I were to simply make a call to a power supply such as:
gpib open -address 5
gpib write -message {VOLT 20}
my power supply would set the voltage to 20VDC
However if I were to make a procedure that sets the voltage and pass the voltage value as an argument - then the Agilent instrument gives me an Invalid Character response (code -101).
example:
proc SetDCPower {gpibID DCPower} {
gpib open -address $gpibID
gpib write -message {VOLT $DCPower}
gpib close
}
followed by a call to this procedure with the following in the same TCL script
SetDCPower 5 15
Other commands such as gpib write -message {POW ON} work fine in a procedure so I know the GPIB address argument works.
I have also output the DCPower argument to the screen and text file - and it looks normal.
Anyone have this issue?
08-15-2011 08:34 PM
OK. It looks as though the GPIB command will not accept a variable in place of a number regardless of whether it is an argument from a procedure.
I defined a variable: set ThisIsATest 15
the made a call with it in the same procedure: gpib write -message {VOLT $ThisIsATest} and it still fails.
Thus my question is now - can a TCL GPIB command be given with a variable in the SCPI message
08-16-2011 11:51 AM
Krusty,
Because youre using a third party language to interface with an Agilent power supply, you may have more luck asking this on the TCL developer's site here:
Theyre most likely going to have a much more in depth knowledge for how to program and troubleshoot in TCL.
Regards,
Kyle Mozdzyn
Applications Engineering
National Instruments
08-16-2011 12:11 PM
Yes I agree, and I have actually posted on one of the services from that web page. However, there were some TCL related questions on this discussion board and thought I would see if anyone else had similar experiences.
08-16-2011 03:57 PM
I figured out what the problem was. It had to do with creating a string using the variable prior to sending the command.
08-17-2011 03:45 PM - edited 08-17-2011 03:45 PM
Hi Krusty,
I am happy that you were able to figure it out!! Excellent!!
Perry S.
05-21-2013 08:44 PM
@krusty wrote:
I figured out what the problem was. It had to do with creating a string using the variable prior to sending the command.
I know this is an old post, but I was wondering if you could help me. I ran into virtually the same problem and its had me stumped. I was wondering if you remember how you fixed this. If so, could you share the code?
Much Appreciation,
CAO
05-22-2013 12:53 PM
Have you also posted your questions to the other forum listed for the third party code?
As stated above: