LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

communication via USB-RS232 and command format

Solved!
Go to solution

Hello everyone,

 

I have a pump (model 07551-20) and the manual is attached below. The pump is connected to my laptop via a USB - RS232 adaptor. Manual link: 

https://pim-resources.coleparmer.com/instruction-manual/mf-lns-manual-enga-1299-1127b.pdf

 

In the manual, I learned baud rate etc. for configuration (Page 44, section 3-3). So I change USB port setting of my laptop. (Device manage--> Port Settings). I use the same configuration in .vi file. Please see the attached .vi file.

Since the satellite number is required nearly all the command, see Page 46. So the first step is to get the number.

I read the manual again and again, I think the only way to know the number is to send command <ENQ> to the pump. In HEX display 050D in which 0D is CR Carriage Return to indicate the line end. With the Table 2(Page 51), I hope the pump send back 2 lines, line one is <STX>P?x<CR>, line two is <STX>PnnIxxxxx<CR> where nn is the number I need. 

However, I only get the line one. Anyone can help me please? Thank you.

 

 

 

Qun

 

0 Kudos
Message 1 of 12
(6,914 Views)

@chalkwu wrote:

Hello everyone,

 

I have a pump (model 07551-20) and the manual is attached below. The pump is connected to my laptop via a USB - RS232 adaptor. Manual link: 

https://pim-resources.coleparmer.com/instruction-manual/mf-lns-manual-enga-1299-1127b.pdf

 

In the manual, I learned baud rate etc. for configuration (Page 44, section 3-3). So I change USB port setting of my laptop. (Device manage--> Port Settings). I use the same configuration in .vi file. Please see the attached .vi file.

Since the satellite number is required nearly all the command, see Page 46. So the first step is to get the number.

I read the manual again and again, I think the only way to know the number is to send command <ENQ> to the pump. In HEX display 050D in which 0D is CR Carriage Return to indicate the line end. With the Table 2(Page 51), I hope the pump send back 2 lines, line one is <STX>P?x<CR>, line two is <STX>PnnIxxxxx<CR> where nn is the number I need. 

However, I only get the line one. Anyone can help me please? Thank you.

 

 

 

Qun

 


First of all, thank you so much for including just about everything we need to know to help you!!!  🙂

 

Unfortunately, I only have LV 2014 on my computer I'm using right now so I can't see the VI, but I can make a general comment.  Since you can read one line, you probably know how to read two.  That's the key.  It is two lines that you need to read, so try to read twice after the command.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 12
(6,871 Views)

I think you have to read the manual more closely. The pump replies with the first OR the second replay depending on the situation. According to the manual <STX>P?x<CR> means that the pump is not yet numbered. I believe you have to send a command to issue a number to the pump, not the other way around. The pump does not yet have a number.

0 Kudos
Message 3 of 12
(6,866 Views)

Communicating with serial devices is often a challenge, particularly since this is such an old protocol, the conventions are peculiar (it's rare for an instrument to use so many Control characters, such as <STX>, <ACK>, etc. in their commands), it is slow, and fewer computers have a native Serial Port.

 

However, the way to "learn how" your instrument works and to get a feel for the communications is to start with MAX.  Open MAX, find the COM port you are using, and open a Test Panel.  Open a VISA Test Panel, and set the Data Frame Settings (in your case, 4800, 7, 1, and Odd).  I don't think your unit used Flow Control (though they did talk about RTS/CTS), so you can leave this off for now (but read your manual and change if necessary).  Look at I/O settings -- I recommend setting the Termination Character, which they tell you is <CR> (or \r in LabVIEW, value xD).  I must confess I'm a bit unclear about what seem to be similar choices -- Send End on Writes, Enable Termination Character, End Mode for Writes, etc., but that's why you use MAX to experiment with your device and "see what works".  Don't forget to "Apply Changes".

 

Once you have Configuration set up, you can go to Input/Output.  Here you can input your command, e.g. <ENQ> (hex E -- I forget how to send arbitrary single hex, perhaps \0E).  It's unclear if you need the terminating \r or not.  I'd try with just the <ENQ>, then do a Write.  [I haven't done this in about a year, and don't have a test system in front of me, so I'm "making educated, remembered, guesses for some steps here ..."].  Once you've written to the device, you should be able to Read its response.  If there is none, try sending the <CR> terminator and see if that fixes things.

 

Note that because you enabled the Termination Character for Reads, you should set up the Read as defaulted for 1024 bytes, knowing you'll get a single line.  You can leave the <CR> in the input string, or you can choose to supress it on the I/O settings page (to simplify your processing).  Look at what comes back and see if it makes sense.  You can then try other commands "by hand" with MAX until you are comfortable with the Protocol.

 

Now, notice that you opened VISA once, set up everything, then did I/O multiple times.  This is how you want your code to go.  You want a While loop where all the VISA Writes and Reads take place, but only a single Configure Port, which belongs outside (before) the loop (use a Shift Register to hold the VISA Resource line).  Be sure to change the Enable Termination Character to True, and wire the other Top terminal to 0xD, <CR> (\r).  When you do VISA Reads, wire 1024 to the Byte Count, as you'll be using a Termination Character, so you just need a "big enough" buffer.

 

I recommend that you not set String Constants with the "Hex" attribute turned on, as this makes it confusing to readers (such as I) who worry that you are typing 0D when you mean <CR> or \r.  I recommend using the back-slash form, which will be easier to distinguish from "ordinary strings" used to transmit letter commands and numeric parameters.

 

Finally, I recommend structuring your code as a State Machine, with the first state being "Start VISA", the next being "Start-Up Sequence", then having other states to do whatever you want this system to do, ending with a "Shut down pumps" that finally closes the VISA port and exits.  [Note that a few paragraphs earlier, I said to do an Open VISA outside the loop -- now I've put it inside the loop in the Start VISA state, with the VISA Reference still going to a Shift Register for all the other States to use].

 

Good luck.  Come back with other questions.

 

Bob Schor

0 Kudos
Message 4 of 12
(6,852 Views)

I donot know how to read twice, anyway I tried to use for loop structure. Please see the attached picture. Still get only one line response from the pump, like P?0 which is depending on the pump model number and version. 

 

Some people gives me advice that I have to send a command asigning a number to the pump just like initialization process. That makes sense. However, I donot find any command like this. From the Table 1 (Page50) in the manual I find something like that is command U which is for changing the number.

Manual link: https://pim-resources.coleparmer.com/instruction-manual/mf-lns-manual-enga-1299-1127b.pdf

0 Kudos
Message 5 of 12
(6,842 Views)

That's what I am thinking about. However, I donot find command like that.They give a command to change the number, but donot give a command to asign a number firstly. That seems ridiculous, I know. Thanks for your help.

This is the manual link: https://pim-resources.coleparmer.com/instruction-manual/mf-lns-manual-enga-1299-1127b.pdf

The command set is in page 50, Table 1.

 

0 Kudos
Message 6 of 12
(6,838 Views)

When you send the initial message <ENQ>, you should get a response something like <STX>P010<CR>, which means Pump #01, running at 600 rpm.  It has "told you its number", namely "01".

 

Now, as the manual says, you can send a Command to this pump, P10, or even several commands.  The example they show you, <STX>P09S+0500.0V08255.37G<CR>, means "Tell Pump 09 [<STX>P09] to set its speed to 500 rpm, clockwise [S+0500.0], set 8255.37 revolutions [V08355.37], and start moving [G<CR>]".  The command starts with <STX>, identifies the Pump according to the number it returned to you when you sent <ENQ>, you send commands, and terminate the string with <CR>, which sends it to the pump.

 

Have you modified your loop yet?  Did you understand what I was saying about making it a State Machine, where you give it a "high order command" (like "Start up" or "Move to here" or "Quit and exit") and it does much of the work for you?  Note that this idea works better for "single" commands, like "Set Speed", "Set Revolutions", "Go" rather than the "triple example" of the previous paragraph, though with a little thought and experience, you could be more creative and make the State Machine more flexible ...

 

Bob Schor

0 Kudos
Message 7 of 12
(6,821 Views)

I know you give me a big picture what my interface looks like in the end, I really appreciate it. But I am stucked in the first step. As you said, when I send<ENQ>, I should get a response like <STX>P010<CR>, however, I only get <STX>P?0<CR>. (see attached pic) So I donot know the pump number and I can not manipulate the pump further. That drives me crazy. I read the manual again and I find some information maybe useful (Page 42). It says that USB needs to be selected within WINLIN in order for the drive to be recognized by the host computer. And the WINLIN software is sold separately. It costs $286 USD and only 1 star out of 5. It can only operate on Window XP 32 bit. I am not sure is it necessary. 

Pump manual: https://pim-resources.coleparmer.com/instruction-manual/mf-lns-manual-enga-1299-1127b.pdf (Page 42)

WINLIN sofeware manual: 

http://www.coleparmer.com/Assets/manual_pdfs/07551_Drives_and_WinLIN_3_FAQs.pdf (something maybe useful in the end Page 6)

WINLIN sofeware (buy online): http://www.coleparmer.com/Product/Masterflex_Linkable_Instrument_Control_Software_CD_ROM/EW-07551-70

 

0 Kudos
Message 8 of 12
(6,814 Views)
Solution
Accepted by topic author chalkwu

So neither one of us read the manual carefully!  [I "forgive" myself since this isn't my machine, my manual, nor my problem ...].  A more careful reading of the manual says that this is what should come back, and that the next step is for the PC to send out another command, <STX>P01<CR>, and hoping for an <ACK> back (bottom of page 3-30).  Now, if I read the manual correctly, you should be able to send additional commands as I suggested earlier.

 

I see you are using MAX as your initial tool for exploration -- good!  Keep it up until you get everything understood.

 

Bob Schor

0 Kudos
Message 9 of 12
(6,805 Views)

Hi Bob,

Thanks for your help, I never take it for granted.  I donot know how to repay it, maybe when the interface is almost done, I  can share it with you and ask you some advice for making it much better.

I read the manual a lot, but I am far away from understanding the concept behind it. I am still wondering why you can give me advice such as "send out another command, <STX>P01<CR>," , it works. Famazing.

Last night, I turned the pump on and switch it to remote control mode using the button on the front panel, and then connect it to my laptop. Using .vi file (not using MAX), I sent <ENQ><CR> to the pump, I only got "P?0" in the read buffer indicator. And there is no change on the pump display(see pic1). So when I follow the manual as you said page 3-30, I totally get lost. I ask myself "is it all you have?" Then I change the pump mode to local control mode, just for fun just for my curiousity. And do the same thing, sending <ENQ><CR> to the pump, and I find "P00" on the pump display(see pic2). I guess this is something like initialization but there is no explaination in the manual. And according to the 3-30, "Put a P and the satellite number received in the first 3 positions on the satellite display." I will never take it as sending my favorate number to the pump and the pump will be numbered. But you can understand it correctly. So there is no excuse. I understand this is one difference between masters and a bad student.

Anyway, thanks for your patience, thank you so much. My language sucks, so I can not express simple and direct, I am sorry.

 

Have a good night,

Qun

 

Download All
0 Kudos
Message 10 of 12
(6,789 Views)