09-05-2019 02:19 AM
Hi,
I need to write to many visa instruments as fast as possible and get measurements. Is writng the vi this way will ensure all the commands will be send to the instruments almost at the same time, and than each device will send it response?
Also the code is very messy, is there a way to write it better?
Thanks.
Solved! Go to Solution.
09-05-2019 07:52 AM
Personally, I like having a loop for each instrument and then you command that loop to do whatever via a queue. You can get the data back via a queue, notifier, global variable, etc. This helps to segregate each part and allow for continuous measurements. Do a good search for Queued Message Handler for some ideas.
09-05-2019 08:23 AM
This is what I am using now, but each time I measure I need to measure with all the instruments almost at the same time. So i have this sub-vi that calls all of them together. But is there a way to write the code better?
If I will use separate loop for each instruments they wont be synchronized.
09-05-2019 08:51 AM - edited 09-05-2019 08:53 AM
@PokiBono5 wrote:
This is what I am using now, but each time I measure I need to measure with all the instruments almost at the same time. So i have this sub-vi that calls all of them together. But is there a way to write the code better?
If I will use separate loop for each instruments they wont be synchronized.
Honestly, there really is no way to write the code better. You must depend on hardware to synchronize your system!
I see that you have implemented VISA sessions of class instr. If these instruments are on a single GPIB bus a *GET would trigger each instrument to start at the exact same time if they were set to trigger on a bus trigger. If you are on a parallel serial bus (RS-485, CAN....) you could send a broadcast message to start a software triggered event, If they are on a 1:1 serial bus (TCP/IP raw socket, USB, RS-232....) you need a hardware trigger.
09-05-2019 09:00 AM
Thank you.