Sending ASCII over Ethernet from Ignition

Greetings. Any recommendations on how to use Ignition to send ASCII over Ethernet to a device such as a LED display on the factory floor? Thanks!

EDIT: Refresh links and code format.
Hi there! Welcome to the forums! :smiley:

It just so happens I have a bit of code I use in a gateway timer script. I use it to display data on an EZAutomation Marquee Display.

The message string is generated through SQLTag expressions. This lets me see what the message format looks like and is a bit easier to troubleshoot rather than generating it within the script. :wink:

import socket


pointer = "[]3701_Rampf/Marquee/Message Pointer"          # SQLTag stroing pointer value
pointerval = system.tag.getTagValue(pointer)              # Get Value of pointer SQLTag

if pointerval < 1:                                        # Set initial limits of pointer value
	pointerval = 1
if pointerval > 3:
	pointerval = 1


tagname = "[]3701_Rampf/Marquee/Message"+ str(pointerval) # Grab message by pointer value (ex. Message1, Message2, Message3, etc)
val = system.tag.getTagValue(tagname)                     # Messages are generated elsewhere through Tranaction Groups and expresions.

HOST = '192.168.140.206'                                  # The remote host
PORT = 49999                                              # Remote host's port

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)     # Create a socket
s.connect((HOST, PORT))                                   # Connect the socket

s.send(val)                                               # Send Message

s.close()

pointerval += 1                                           # Increment pointer value

system.tag.writeToTag(pointer,pointerval)                 # Write pointer value back to its SQLTag

Nice Jordan,

I do the exact same thing except I use the UCON driver in Kepware to actually send the message and then I just write to a tag in Ignition. Your way is less troubleshooting when something isn’t working though. Maybe I’ll switch to that!

Could the Ignition TCP Driver be used for this?

Probably, but doing it in scripting seems pretty appropriate to me since there’s no data coming back.

Hello everybody, In response to this:

Probably, but doing it in scripting seems pretty appropriate to me since there’s no data coming back.[/quote]

I should give some back story.

I’m working to install an ethernet enabled EZAutomation LED display for use on the plant floor. I called the vendor to ask some questions regarding their product’s capatability with Ignition. The vendor said that the displays facilitate a Modbus TCP protocol with ASCII controlling what prints on the display.

The vendor said that connecting to the device should not be a problem since Ignition connects to Modbus TCP devices.

Does anybody have any advice to share about what I need to know as I get this part of my project going.What are the potential problems based upon your experience? Thanks.

Sorry to resurrect this, but I just noticed it wasn’t really resolved.

Dave, did you get this resolved? Did you see my example was for the same units?

I solved the problem by using a ViewMarq Marquee and writing the ascii string to an OPC tag in Ignition. A gateway script would poll tags in Ignition to gather the information. The gateway script would then assemble the ascii string in accordance with what the ViewMarq would expect. Teh gateway scripts would update the OPC tags that were addressed to the holding registers in the ViewMarq resulting in the message displaying.

One pitfall is that the ViewMarq would only take 150 characters therefore I would have to write to 3 OPC tags to create the entire 450 character message. Also, each string had to be an exact length to work therefore I would have to pad the strings with spaces as needed. Python string manipulation worked for this.

1 Like

Hi, how are you? I saw that you could connect to an LED screen, could you give me an example please.