Reading client serial data... slow performance writing tag?

I’m reading serial data from a scale using the client serial module. I can print to the console what I read from the scale and read it at a 100ms interval just fine viewing on the client diagnostics console view.

However, I try to write this value from the scale back to a tag. I can successfully write the tag at 1000ms interval… however anything under 1000ms the client will halt and lockup. I can close the client and after a couple minutes the project on the client will close.

How can I validate the performance of writing tags back to the gateway? Is it unreasonable to want to write a tag at a 250ms interval? How could I boost performance for writing tags? Can I add something to the script to allow the tag to timeout and not halt the client?

Client Event Script



Timer: - 100ms, Fixed Rate, Dedicated Thread

value = system.serial.readLine(“COM1”)
if index !=-1:
print value

I’m running Ignition 7.5.5 with Serial Client Module 1.5.2

I’d start by adding something to your script that times how long the call to system.serial.readLine() is taking and print that value out to the console.

Also, switch the timer script to be “fixed delay” instead of “fixed rate” to ensure that the calls to your script don’t end up stacking in the case that it’s taking longer than 100ms.

Edit: Read this wrong… I see now that it’s the calls to system.tag.write that seem to be problematic… What kind of tag is it that you’re writing back to?

It is writing back to “string” data type tag

Try switching to “fixed delay” instead of “fixed rate”.

If that doesn’t work, time the amount of time it takes this code to run from start to finish (start timing before you read, stop timing after you call write).


Thanks I’m changing that now. I should also add it’s a memory tag.

Alright here is where I’m at.

Figured something out that I didn’t realize before. The problem doesn’t happen from writing to the tag as I thought. It’s happening I believe when reading the serial data from the client.

I changed the timer to 1000ms and fixed delay. It worked. I then kept changing the value smaller. 750, 500, 250, 150, 100ms… everyone of them worked fine. The value keeps writing to the tag at that rate and works fine. So long as I have the client open and I’m saving and updating with the client open already.

As soon as I close the client and re-open it halts and never reads the value once.

I can then close the client, edit in the designer back to 1000ms, save/update and reopen the client and it works again. I can then once again change the delay to 100ms, save/update the already open client and it keeps working. Again… only until I close the client and re-open it.

This locking up happens with simply reading the serial data and printing it to the console. Both the printing to the console and writing to the memory tag work as long as I start the client with the timer set to 1000ms. I can then change the timer value to 100ms… save/update the client… and the client works printing to the console at 100ms and writing to the memory tag at 100ms. But… as soon as I close the client and go to open it again, it will lockup.

I can then close the client… edit the timer back to 1000ms… save/update … I can open the client again and it works at 1000ms and I can edit to make it 100ms save/update and it works until I close the client.

I worked with this a bit this afternoon. I loaded a new instance of Ignition in trial mode to test out from scratch using the current release 7.6.1, the issue I’m having exists then also.

I then deactivated a portion of the script which I have using the index find and strip functions. After doing so, I can set the timer to 100ms save/update, close the client, start the client again and the serial stream is written to the tag and printed to the console without issues.

Is there something wrong with the way I’m removing the various characters and spaces from the serial stream? Is there a way to write it so that it’s more efficient?

I’m still confused though why these functions (when left active) would still work though at 100ms as long as I start with the timer set at 1000ms, then edit to 100ms… save and update a project and don’t close and reopen it.

value = system.serial.readLine(“COM1”)
#if index !=-1:






print value

No clue why that would make a difference… this is all very mysterious :scratch:


Alright, I stepped back and tested a different approach. I decided to try connecting to another scale which is using a Digi Serial/Ethernet converter and a virtual comm port at 9600 baud. Every which way I try, this works. It works just fine. No issues what so ever on the client.

When I go back to using the physical comm port on the client instead of the virtual comm port then I have issues but I’m also using 38400 baud in this configuration. There is really no need me to utilize that high of a baud rate so I will adjust it down to 9600 in the scale indicator and see the issue I’m having goes away.

If the problems still exist using the physical comm port, I’ll try adjusting the FIFO TX/RX buffers for the port.