LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting a pump over rs232 for real time control

Solved!
Go to solution

Gee, I completely missed the wire between the VISA Write and VISA Read. Damn old eyes. Thanks for catching that, Ravens Fan. Smiley Wink

 

I don't think sending that command without sending a number is a way to query. In fact, there seems to be a different set of commands for querying, and I think the command for querying the current rate is RAT. At least, that's not how I read it in the manual.

0 Kudos
Message 31 of 46
(5,494 Views)

As Smercurio said, take a look at the syntax for what you are trying to do with that first command, and look up in the manual for what the response should be that you are looking for in the VISA read as I don't think you have that wired up properly.

 

 

Ok, here is how i interpret it, after the program initiates the pump to RUN:

 

Blue Circle: Write to pump  a rate value

Green: Read back the value the pump is set at and store in the buffer

Red: Dial to change pump rate and compare value to the buffer

Black:  If the values are different write to the pump the new value as it appears on the dial. 

 

syntax for what you are trying to do with that first command

 

so i guess this should really be checking what the pump is set at prior to my adjusting it with the dial, not writing a value as it states now

 

manual for what the response should be that you are looking for in the VISA read

 

the query RAT should work here, so does this mean i should switch the position of the VISA read and VISA write?  so visa read checks the value and then stroes that as the initial in the buffer, does this mean i can delete the first VISA write (blue circle)? 

0 Kudos
Message 32 of 46
(5,488 Views)

I may be able to assist you by providing contact information for a researcher that is very experienced in setting up custom software for the GENIE Plus syringe pump. If you would like, please email me at dmiller@kentscientific.com.

 

Dave Miller

Kent Scientific Corporation

0 Kudos
Message 33 of 46
(5,479 Views)
In order to determine whether you need to change the rate you first have to find out what the rate is. The easiest way to do this is to open up the old trusty HyperTerminal and send those query commands that are listed in the manual. Most notably the RAT command. What do you get back? Change the rate manually. Send the command again. Does it match? If so, that's the command to find out what the current rate is. Remember that you have to send a query command first, wait a bit for the communications, and then read the response (setting the correct number of bytes, which can easily be done by using the VISA Number of Bytes at Serial Port property). You also have to take into account that the pump is not going to respond instantaneously. Thus, you don't want the program to loop around again immediately after sending the command to set the new rate and query the rate, only to find out it's not where you said you wanted to be. It probably won't be because you have to wait for the instrument.
0 Kudos
Message 34 of 46
(5,472 Views)
Solution
Accepted by topic author superomario

superomario wrote:

As Smercurio said, take a look at the syntax for what you are trying to do with that first command, and look up in the manual for what the response should be that you are looking for in the VISA read as I don't think you have that wired up properly.

 

 

Ok, here is how i interpret it, after the program initiates the pump to RUN:

 

Blue Circle: Write to pump  a rate value

OK, but the syntax doesn't match what you are doing in the black circle.  Here you are writing 0 ULM <CR>.  In the black circle, you are writing 0 ULM (rate) <CR> 

 

Green: Read back the value the pump is set at and store in the buffer

When you write a new rate value to the pump, what does it send back?  Does it send back 5 bytes worth of data which is how many bytes you had written out with the VISA Write?  I am 99.9% sure you do not want the blue wire that connects the VISA write and VISA read.  If you want to read the pump value, then you should be using the RAT command like Smercurio says.

 

Red: Dial to change pump rate and compare value to the buffer

OK

 

Black:  If the values are different write to the pump the new value as it appears on the dial. 

OK

 

syntax for what you are trying to do with that first command

 

so i guess this should really be checking what the pump is set at prior to my adjusting it with the dial, not writing a value as it states now

 

manual for what the response should be that you are looking for in the VISA read

 

the query RAT should work here, so does this mean i should switch the position of the VISA read and VISA write?  so visa read checks the value and then stroes that as the initial in the buffer, does this mean i can delete the first VISA write (blue circle)? 

 

No.  don't switch anything.  Change your initial VISA Write to RAT.  Then do your VISA Read.  Either read the correct number of bytes, or use set a termination character for your serial port.  Then do the comparison with the dial and do the VISA Write for the new rate.  When you set a rate, does the pump respond with any kind of acknowledgement?  If so, you should be reading that using a VISA read.


 

0 Kudos
Message 35 of 46
(5,472 Views)

@Ravens Fan - good catch on the bad wiring. Supermario is working off my example code in message 8 of this thread (I did it in about 2 minutes!).

 

I just want to point out, I hope I haven't caused any confusion with that example code - it was based on my knowledge of a different syringe pump. With that syringe pump (not a genie), when you send "RAT<CR>" - that functions as a query, the pump will return the current rate. When you send "RAT2<CR>" you are in fact setting the rate to a value of 2. So same "command", but different syntax, for different results.

 

I have not had time to read the genie manual, so I don't know if it is similar, or maybe even the same command structure.

0 Kudos
Message 36 of 46
(5,459 Views)
It works! Thank you everyone for your help
0 Kudos
Message 37 of 46
(5,447 Views)
one more quick question if you guys have time. since i only have one serial port on the computer, controlling 2 or more pumps from one program will mean i have to chain them together. Now, i assume that chaining them together with just the one program i have now will just rate control both with one dial if they are set to the same address. if i set the address of the chained pump to 01, while the main pump is at 00, will it work if i simply make another pump rate button within case structure, only instead of 0, i place a 1, and then wire those strings to the same visa write as the original dial?
0 Kudos
Message 38 of 46
(5,424 Views)

Then please mark whichever post helped you the most for the solution instead of your own thank you message.  (You can unmark your post from the options menu to the upper right of your post.)

 

When you say "chain them together", do you mean both pumps serial communications are on one port like in an RS-485 setup?

 

I don't think you want want to set both of them to the same address.  They should each have their own address.  Yes you would write them to the same serial port.  Exactly which VISA write you wire the command to all depends on how you lay out your program architecture now that you are looking to expand it from a simple communication.  Whatever architecture you use, you want to make sure the commands you want to send to one pump don't interfere with the commands for the second pump.  You will want to write to 1, read from 1, write to 2, read from 2, repeat. 

 

 

0 Kudos
Message 39 of 46
(5,421 Views)
oh ok, i thought the solution was just to close out the thread, thanks for telling me. also on the pump there is a serial in, and a serial out port. so I would chain the "out" from the main pump to the "in" of the second pump.
0 Kudos
Message 40 of 46
(5,418 Views)