Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using driver in Parallel Loop

Solved!
Go to solution

In my VI, I have two parallel loops communicating to the same DC supply through RS485.  The 1st loop will issue command to read the set pont of the DC supply, and the 2nd loop will issue command to set the set point of the DC supply.  There is a potential that they will try to commmunication with the DC supply at the same time.  If so, would there be a conflict?  Or would LabVIEW and VISA be able to handle something like that?  If there is a conflict, I was thinking about using a semiphore.  Any other ideas?  

 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 13
(4,523 Views)

Statemachine with Initialize, read, wait, write, wait, Stop commands looks good to me. I use semaphores when there is a potential of race condition happening on queues.

Message 2 of 13
(4,519 Views)
Solution
Accepted by topic author jyang72211

A very simple functional global that handles all the communication with your supply handles this.

A functional glabal can only execute one command at a time and LabVIEW by default schedules the command from the other while after the first command.

functional globals are also called action engines and these mad life in LabVIEW possible before we had objects.

greetings from the Netherlands
Message 3 of 13
(4,515 Views)

FG is what I am going to do.  Thanks!

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 4 of 13
(4,511 Views)

Actually, I changed my mind.  I ended up using a semaphore instead.  As I started to build my action engine, I realized that I had way too many functions that I need to implement.  Semaphore is much simpler for my context.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 13
(4,505 Views)

Hi

Did you search for a driver for your power supply on instrumentdriver.net

http://www.ni.com/devzone/idnet/

greetings from the Netherlands
0 Kudos
Message 6 of 13
(4,495 Views)

A driver doesn't exist for my instrument.  However, I have coded all the driver functions that I need.  To use the AE approach, I need put all the 10 functions that i coded into the AE (5 functions for the 1st loop and 5 for the 2nd loop).  Each function has its own inputs and outputs, so it is a lot work for a one time deal.  Making the AE is not hard, but it is a little bit too much work compared to the semaphore approach.  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 7 of 13
(4,488 Views)

I understand your problem.

greetings from the Netherlands
0 Kudos
Message 8 of 13
(4,485 Views)
I'm late here and I see you got it working which is good. But it should not be necessary to implement all the functions in an AE. You just need one with initialize, write, read and close. Your other VIs will create commands and parse results. I do something similar with an additional function - "ask". That function sends a command and returns the result. I know you said that you are writing in one loop and reading in the other. But the point is that the AE can and probably should just do the low level communications. In my case the actual functions are VIs that contain the AE. These VIs are the only things that use the AE which is scoped private to them in a library.
=====================
LabVIEW 2012


0 Kudos
Message 9 of 13
(4,469 Views)

In the write command, you send exact command through serial, right?  In this way, the driver can't be used, correct?  What did you mean by other vis will create commands and parse results?  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 10 of 13
(4,462 Views)