News:

  • October 14, 2025, 11:14:05 AM

Login with username, password and session length

Author Topic: DoMore serial comm to Pump via ASCII  (Read 7787 times)

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
DoMore serial comm to Pump via ASCII
« on: September 08, 2016, 11:43:23 AM »
Gentlemen,
I am looking for some examples of implementing serial communications(RS-232)from a DoMore to a device via ASCII.
I am possibly going to have to control a small pump used to fill chemical containers on a production line. I don't actually have the pump at this time,
but I wanted to get a primer on data manipulation and communication before it arrives. I have not previously used this method, but it appears that my only other option is TTL I/O, which is limited in what I can do. Also, my I/O is full at this point, so it just makes sense. I have the pump manual, and am just starting to digest it..

Thanks in advance....

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: DoMore serial comm to Pump via ASCII
« Reply #1 on: September 08, 2016, 01:38:24 PM »
For general ideas on how to do serial protocols, look at this: http://forum.hosteng.com/index.php/topic,1014.0.html

That example is the slave side and I'm guessing you would be doing the master, but the device usage and techniques are the same.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #2 on: September 08, 2016, 06:30:37 PM »

Thanks, Bob. (I should have started this in the DoMore section instead of General Discussion, but I'm not sure how to do that now.)

I will look at this tomorrow and see if I can get something going. I am unclear of exactly how to send data to the pump, and validate that the pump received the data correctly.

I appreciate the help!!

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: DoMore serial comm to Pump via ASCII
« Reply #3 on: September 08, 2016, 08:33:18 PM »
Set your serial port to General Purpose.

Use STREAMOUT to send a string to your device.

User STREAMIN to read a string from your device.

Do-more has a full range of string processing functions. Instructions are named STRxxx.

For something like this I would absolutely use a dedicated program block and stages to sequence the protocol.

Study the demo app I linked.

Ask questions!
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #4 on: September 15, 2016, 11:45:07 AM »
Bob,
  A couple of questions now that I have some time to look at this...

1. How is the code different when I need the DoMore to be the Client (Master)? As you mentioned, I will be using the DoMore as the Client, initiating commands to the pump. I also will need to verify that the pump received the correct volume when the amount is input.

2. Can I test this using the simulator? I will have the pump (hopefully) by the weekend, and planned on taking it home with my laptop. I cannot, however, take the machine with me.

3. I will need to use the RJ-12 port on the DoMore CPU to communicate with the pump. How do I set that up in the system configuration? If I set up the Serial Port Mode for Egneral Purpose (not Do-More Programming), will I still be able to program thru the USB port, AND communicate with the pump?

Sorry if some of these questions are obvious to you.......I remain somewhat in the dark.......

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: DoMore serial comm to Pump via ASCII
« Reply #5 on: September 15, 2016, 11:49:43 AM »
1. How is the code different when I need the DoMore to be the Client (Master)? As you mentioned, I will be using the DoMore as the Client, initiating commands to the pump. I also will need to verify that the pump received the correct volume when the amount is input.

Servers listen for incoming requests and then generate responses. Clients generate outgoing requests and then listen for responses.

2. Can I test this using the simulator? I will have the pump (hopefully) by the weekend, and planned on taking it home with my laptop. I cannot, however, take the machine with me.

If you have a serial port on your PC, the Sim will use it.

3. I will need to use the RJ-12 port on the DoMore CPU to communicate with the pump. How do I set that up in the system configuration? If I set up the Serial Port Mode for Egneral Purpose (not Do-More Programming), will I still be able to program thru the USB port, AND communicate with the pump?

USB port is always programming and is unaffected by the serial port's config.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #6 on: September 20, 2016, 10:01:51 AM »
Bob,

 I took the program you referenced, and, after changing the addresses(my program had already used those), I copied it into my current program.
I then made a code block with a streamout command containing the string (SS5)"RUN" to the device. I get a success bit there, but only a TX light on the DoMore, and no action from the pump.
Still trying to wrap my head around the protocol code, but I am having to break off for other plant emergencies, so staying on it is challenging. I may have to break down and do the TTL way just for now...

I do appreciate your help immensely....


plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
Re: DoMore serial comm to Pump via ASCII
« Reply #7 on: September 20, 2016, 10:17:28 AM »
@ElroyJetson,
I have done quite a bit of this type of thing. Could you post the manual (Or a link) for the manual for the pump controller you have?
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #8 on: September 20, 2016, 11:16:20 AM »
PM sent

plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
Re: DoMore serial comm to Pump via ASCII
« Reply #9 on: September 20, 2016, 01:05:10 PM »
This sample *should* elicit a response containing the firmware revision of your unit. I did not test this in any way, so please let me know if you run into any snags.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #10 on: September 20, 2016, 02:47:03 PM »
So after tweeking that program(to internal serial device, and setting the specifices to match the pump) PLCnut, it did return the version. Then I realized that my syntax had been wrong all along!  >:(
I had not put the 0D at the end of each string! Once I fixed that, all of my commands work fine!
Looks like she will be humming along fine in a while!
Now I can finish writing the code for this pump!

Thanks a bunch!!! You rock my friend!!!!

plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
Re: DoMore serial comm to Pump via ASCII
« Reply #11 on: September 20, 2016, 02:49:28 PM »
Cool beans!  8)
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #12 on: September 20, 2016, 03:03:21 PM »
So obviously you don't need the DirectNet Server program to do this, but I assume that it is a more robust and reliable method. I am new to ASCII, and serial in general, but I am slowly getting the gist of it. Seems like a lot of programming if you really want to exercise a lot of control over a device....

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: DoMore serial comm to Pump via ASCII
« Reply #13 on: September 20, 2016, 03:26:26 PM »
So obviously you don't need the DirectNet Server program to do this, but I assume that it is a more robust and reliable method. I am new to ASCII, and serial in general, but I am slowly getting the gist of it. Seems like a lot of programming if you really want to exercise a lot of control over a device....

I just pointed you to that app as an example of a functional serial app, with the intention of teaching concepts. It can be as simple as one STREAMOUT and one STREAMIN...but...robust is the key word. We see lots of cases where people get stuff 'working', and then a few minutes or hours or days later it quits 'working'. The way I approach problems like this is informed by having written comm code for nearly 30 years...although in fairness, I have written very little PLC-based comm code.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ElroyJetson

  • Full Member
  • ***
  • Posts: 36
Re: DoMore serial comm to Pump via ASCII
« Reply #14 on: September 20, 2016, 04:01:38 PM »
Bob,

 I know what you mean as far as robust. I am always thinking of how things can go wrong, and trying to make sure that it can be handled correctly. It gets quite messy sometimes, and I catch a lot of grief for being the devils advocate as far as making sure our process is as foolproof as it can be. I am always looking for how the system or process can be interrupted, and then re-think if we have all of our bases covered.
I really appreciate the help and the protocol information. This is what I have come to expect from AD and Host, and I am never disappointed. These things are my weak point (among many), so I am going to implement this along with more checks in the program for verification of the pumping status. A perfect example here is that I want to disable all of the pumps manual (faceplate) control settings to keep the operators from being able to make changes. The only problem is that the pump manufacturer doesn't allow the Start/Stop switch to be disabled, so if it is pressed, the pump will inject ANOTHER fill volume into the container!

Thanks again for your help, and keep it up....please!