News:

  • April 30, 2026, 10:41:27 PM

Login with username, password and session length

Author Topic: ASCII over tcp or udp  (Read 7443 times)

mactuan12

  • Newbie
  • *
  • Posts: 1
ASCII over tcp or udp
« on: January 11, 2020, 03:46:21 AM »
I have several of the same device that responds to ascii strings .  How could I communicate to these devices from a brx over a network. Will a serial Ethernet converter do the job ?
Let me offer the disclaimer that I haven't used one myself, but was just looking at a couple such devices. They look to be using a TCP port like a terminal, so yes, it should just be a matter of opening a TCP connection (Do-more TCP Client device) to it with OPENTCP and then using STREAMIN/STREAMOUT to read and write.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: ASCII over tcp or udp
« Reply #1 on: January 11, 2020, 07:16:20 AM »
Exactly.

Create a new PROGRAM code block that sequences through those steps.  You may want to create a TCP client device for each of these external devices, along with a PROGRAM per device also.

I would recommend getting just 1 working.  Also recommend using Stage programming for the protocol sequencing in the Program

SG S0
OPENTCP On success JMP to S1
SG S1
STREAMOUT On success JMP to S2
SG S2
STREAMIN On Success JMP to S3
SG S3
Process data from STREAMIN

Here, you can jump back to S1 if you are polling, or Jump to S4 to terminate the connection and the program.  So possibly next is
SG S4
CLOSE
EXIt

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: ASCII over tcp or udp
« Reply #2 on: January 11, 2020, 04:33:58 PM »
Regarding your first question - simple Ethernet will do.  Since your device supports TCP, I presume it has an Ethernet Port.  Most Do-more PLCs have Ethernet ports - just make sure you get one that does.

If you have one of your devices, you can actually test it out with your PC and the Do-more Simulator that runs under Windows.  No need to buy hardware (yet).  Get the program working via the Simulator (note - it only runs for 60 minutes, then goes to PGM mode - it's not meant for "actual" control).