It is currently Sat Apr 19, 2014 6:32 am




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 
 One more serial issue. 
Author Message
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post 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.


Mon Jul 23, 2012 5:04 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 1905
Location: Folsom, CA
Post Re: One more serial issue.
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?

_________________
Kevin Herron
Software Developer
Inductive Automation


Mon Jul 23, 2012 6:23 am
Profile WWW
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post Re: One more serial issue.
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().


Mon Jul 23, 2012 6:31 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 1905
Location: Folsom, CA
Post Re: One more serial issue.
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.

_________________
Kevin Herron
Software Developer
Inductive Automation


Mon Jul 23, 2012 7:15 am
Profile WWW
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post Re: One more serial issue.
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.

Mike


Mon Jul 23, 2012 9:50 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 1905
Location: Folsom, CA
Post Re: One more serial issue.
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?

_________________
Kevin Herron
Software Developer
Inductive Automation


Mon Jul 23, 2012 10:10 am
Profile WWW
General
General

Joined: Tue Feb 24, 2009 1:30 pm
Posts: 887
Location: Calgary
Post Re: One more serial issue.
It almost sounds like your serial port is in a data compression mode. Or a NRZ reception mode.


Mon Jul 23, 2012 12:38 pm
Profile WWW
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post Re: One more serial issue.
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.

Thanks!


Attachments:
serialMalfunc.doc [1.05 MiB]
Downloaded 68 times
QTM.proj [68.49 KiB]
Downloaded 53 times
Thu Jul 26, 2012 6:50 am
Profile
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post Re: One more serial issue.
Did you have any luck with this?


Mon Jul 30, 2012 10:36 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 1905
Location: Folsom, CA
Post Re: One more serial issue.
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?

_________________
Kevin Herron
Software Developer
Inductive Automation


Mon Jul 30, 2012 10:46 am
Profile WWW
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post Re: One more serial issue.
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.


Wed Aug 01, 2012 9:43 am
Profile
Moderator
Moderator

Joined: Mon Oct 27, 2008 4:10 pm
Posts: 1905
Location: Folsom, CA
Post Re: One more serial issue.
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".

_________________
Kevin Herron
Software Developer
Inductive Automation


Wed Aug 01, 2012 10:10 am
Profile WWW
Captain
Captain

Joined: Thu Jun 28, 2012 5:59 am
Posts: 85
Post Re: One more serial issue.  Topic is solved
Figured it out. It was a stop bit issue.


Thu Aug 02, 2012 9:52 am
Profile
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: