One more serial issue

When I am reading data, every third zero is degree symbol. I am not sure why. For example:

0000.426 reads as 00°0.426

It is very strange. Just wondering if there is something I’m missing.

What version of the serial module do you have? What does your code that you’re reading with look like? What are you reading from?

I’m using 1.5.1. Right now I’m just doing some testing by reading in through Hyperterminal.

It happens with both readUntil() and readLine().
For example

readSOH = system.serial.readUntil(port, chr(2), 0)

It’s been happening ever since I’ve started using the serial module (and the one before), and occurs even when I write to myself through Ignition using system.serial.write().

Ok, I’ll look into it.

You should notice that readUntil() is not implemented correctly right now; It just returns each byte as a literal string appended to the next, basically you just get back a string of numbers. I’ve fixed this already, should be in the next beta and release.

Did a little more testing and this is what I discovered.

It is actually three in a row of any character that will shift it, even using readBytes().

any characters of three or more will produce a funny character on the third, and then every other character after.
wwwwwww -> ww÷w÷w÷w÷

or something similar. It is like they are getting shifted, it is confusing though that it only happens to a series of the same characters.

It’s only an issue because some of the data that we need to read is small. eg 0.00005

Not sure what to make of it. Other than this, it works great.


I’m not able to reproduce this. Can you show me the script you’re using to read from the serial port, including how you’re configuring the port?

It almost sounds like your serial port is in a data compression mode. Or a NRZ reception mode.

Here is the little test project I’m working on. I apologize if it is not that easy to decipher. The code is in any of the “read” buttons. I may suggest the readRawData window.

Essentially I have been writing to the project using Hyperterminal and running a loop that looks for EOTs.

I have also included some screenshots of example outputs that I’ve been getting.

serialMalfunc.doc (1.05 MB)
QTM.proj (68.5 KB)

Did you have any luck with this?

No, I couldn’t really figure out what your project was doing. I did take a look at the scripts though, and I never found a place where you configure the serial port via the system.serial.configureSerialPort() call? Are you doing that somewhere?

Yes I am. I do it in another button, it should be under the SerialConfig docked window. It grabs the parameters from some dropdown boxes and configures the port.

The program just sits there and reads as I feed stuff into Hyperterminal and displays it below. Depending on which window it is, it parses it differently.

I know I have been irregular posting about this. I have been working on another project as well as this one. If there is a better way of communicating about the project and the issue please let me know.

I think what I’m going to need from you is a very simple self-contained example that reproduces the behavior you’re seeing, because I haven’t been able to get anything like it to happen (and no reports from any other serial users either).

Something like a project with one window, a couple buttons, very very clear what it does, e.g. “press configure, press read, go to terminal and write ‘wwwwwww’, watch as the wrong result comes in”.

Figured it out. It was a stop bit issue.