LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem of TSP Script in Keythley 2602

Hi, community!

 

I am trying to use VISA Write command to send a very simple test script processor (TSP) to my Keythley 2602b. This is my code:

x = 0
y = 2
if x and y then
print("Both x and y are true")
end

 

Simple, right? However, error occurs in this step, which states:


Keithley 2600 Series.lvlib:Error Query.vi<ERR>
Instrument reports:
-2.85000e+02 TSP Syntax error at line 2: `end' expected (to close `if' at line 1) near `<eof>' 2.00000e+01 1.00000e+00
-2.85000e+02 TSP Syntax error at line 1: <eof> expected near `end' 2.00000e+01 1.00000e+00
0.00000e+00 Queue Is Empty 0.00000e+00 1.00000e+00

 

I am so comfused. It seems that there are syntax error of the lua language, but I fail to debug it. Please tell me the problem here!

 

Please find my LabVIEW code in attachment.

0 Kudos
Message 1 of 3
(227 Views)

I cannot comment on the LUA part and I a missing your drivers.

I assume that your instrument communication is correct and that it is safe to leave the communication settings unwired. Does the response include a termination character?

 

Some quick comments on your code:

 

  • There is a function to get a filename without extension.
  • A one-iteration-for-loop is just a built array.

 

Since this is mostly about controlling an instrument, there might be a better place for this discussion. I can move it if you want. Let me know.

0 Kudos
Message 2 of 3
(197 Views)

Thanks for your reply! I have solved my problem so I want to update my solution.

 

I appreciate for your comments. They are only for debugging, and not what caused my problem.

 

The problem is that: 'VISA write' seems to convert all my command to one line string. What's worse is that it even convert the line break ('\n') to '.'! This is truly fatal. I confirm my assumption via inspection on NI I/O Trace:

wt.png

 

Therefore, the solution is straightforward and not elegant: rearrange all the command in one line as 'if x and y then print("Both x and y are true") end'. Solved!  ... 

 

Even though I locate the problem, there's literally nothing I could change regarding the mechamism of 'VISA Write'. Is there better way to communicate with my instruments? Can I send them script in multiple lines?

0 Kudos
Message 3 of 3
(173 Views)