Python Forum
Issue to read commands with pyvisa
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue to read commands with pyvisa
#1
Hello,

I am trying to communicate with a piezoelectric controller. The communication is fine, as I can read the correct set values of the parameters. The problem is that I need to run multiple times the code in order to have the full information. I try to explain better. Here is my code:

import pyvisa
rm = pyvisa.ResourceManager()
my_instrument = rm.open_resource('ASRL3::INSTR')
print(my_instrument.query('geta 4')) #the command 'geta 4' asks for the actual piezo voltage set on channel 4
If I run the first time the script (using Spyder), I got "get 4" as output.
By running a second time (without closing the tab), I got "voltage = 1.000000 V", which is correct.
By running the third time, I got "OK".

I am not sure this is normal. Also, if I now update the command to 'geta 3' and run the script again, he doean not update it, it still gives me 'get 4' as output, and all as before.

Any help would be very much appreciated. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple Read File Issue blackjesus24 4 2,722 Feb-09-2020, 12:07 AM
Last Post: blackjesus24
  File Read Issue Blade2021 4 3,177 Aug-06-2018, 10:46 PM
Last Post: Larz60+
  Setting Byte Count in pyVisa Read Function mike505 0 5,051 Nov-17-2016, 07:43 PM
Last Post: mike505

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020