# Reading/Writing Multiple Serial Inputs and Outputs using NMEA protocol

**URL:** <https://forum.inductiveautomation.com/t/reading-writing-multiple-serial-inputs-and-outputs-using-nmea-protocol/19600>\
**Category:** Ignition\
**Created:** [September 10, 2018, 5:37am UTC](https://forum.inductiveautomation.com/t/reading-writing-multiple-serial-inputs-and-outputs-using-nmea-protocol/19600 "2018-09-10T05:37:39Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 18, 2018, 1:57am UTC](https://forum.inductiveautomation.com/t/reading-writing-multiple-serial-inputs-and-outputs-using-nmea-protocol/19600/4 "2018-10-18T01:57:00Z")

</div>

> [@edwinnch](#):
>
> Is there a good reference to understand the threading concept used here ?

See the Java documentation for [Thread.enumerate()](https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#enumerate-java.lang.Thread:A-). The purpose is to relatively reliably iterate through other threads looking for a matching name. So it can be killed off.

> [@edwinnch](#):
>
> The monitorToledo(ctPath, myThread) function has 2 arguments but are not called anywhere

It is called from background as `callable`. You should expect to write a suitable monitor\*() function that suites your protocol requirements.

> [@edwinnch](#):
>
> The moment i clicked onto it in preview mode, ignition seems not responding

That's because background() must be called from a background thread, such as from invokeAsynchronous(). I should document that a bit better. In my actual usage of this code, I use the callAsync() function from later.py to wrap that for me:

> [@Update GUI via Asynchronous thread](http://forum.inductiveautomation.com/t/update-gui-via-asynchronous-thread/9666/3):
>
> Since this sort of thing pops up often, I created a set of wrappers that simplify this stuff, and allows you to directly use functions in your script modules. The wrappers take care of stuffing the arguments you supply into a temporary fuction’s default argument. For your case, try assignLater(). Nick’s example becomes: # In a script module in your project: import shutil def fileTransfer(label): path = system.file.openFile() newPath = "F:\NewFolder" shutil.copy2(path, newPath) sh…

---

_[View the full topic](https://forum.inductiveautomation.com/t/reading-writing-multiple-serial-inputs-and-outputs-using-nmea-protocol/19600)._
