Tuesday, 6 August 2013

Serial Read with ORSSerial / Xcode

Serial Read with ORSSerial / Xcode

I am trying to read a serial port in an XCode Cocoa app using the
ORSSerialPort Library. I got everything working where I can open a serial
port and start reading data, but there is a glitch with the format when
reading data:
When I run the demo code, it works just fine and the readings look like
this (X,Y values):
1,0
2,999
3,1999
4,3000
5,4000
6,5001
However, when running my app, the readings appear like this (using NSLog):
2013-08-06 19:53:59.649 TestApp[87361:303] Data: 1,0
2013-08-06 19:54:00.649 TestApp[87361:303] Data: 2,999
2013-08-06 19:54:00.653 TestApp[87361:303] Data:
2013-08-06 19:54:01.652 TestApp[87361:303] Data: 3,1999
2013-08-06 19:54:02.651 TestApp[87361:303] Data: 4,3000
2013-08-06 19:54:03.651 TestApp[87361:303] Data: 5,400
2013-08-06 19:54:03.655 TestApp[87361:303] Data: 0
2013-08-06 19:54:04.654 TestApp[87361:303] Data: 6,5001

Notice that the 3rd log is blank, the 6th log is incomplete, and the 7th
log should be the end of the 6th log. It appears as if random return
characters are sent, but I don't know what is causing it. I haven't
noticed a pattern yet in how/when the formatting goes bad.

No comments:

Post a Comment