Potentially super-basic C question

Discuss Programming
Post Reply
worker201
guru
guru
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Potentially super-basic C question

Post by worker201 » Fri Nov 24, 2006 10:48 pm

I'm thinking about possibly considering thinking about designing a navigation program. My company uses a proprietary Windows one, but I think that in my mind, I could make a better one, more suited to our needs.

So what a navigation program does is read in 3 basic things: position, heading, and pitch/roll. These come into the system as data telegrams, usually via serial cables. Nearly half the non-graphical part of the program function will be decoding these telegrams, which can be updated as often as every second. The other half is applying the information to the ship's attitude, to determine course, bearing, and speed. After that it's all survey modules and trigonometry. The input processing is the key.

Here's what I would like real quick: an example, like 3 lines, of how one would listen for, read, and decrypt a continuous stream of data on a comport. In C preferably. Just something I can wrap my hands around, for prototyping. Would this be like a filestream, or is there something else involved?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sat Nov 25, 2006 11:58 am

I wrote a hillclimb timing system that we use at our dirt bike club. We have a timing light and sensors that connect to my laptop via serial cable and I Just read the times in off the serial line. You could look at how I do it which maybe isn't the best but works for me:

http://voidmain.is-a-geek.net/hts/

I basically have a little C program that sets the serial port up and then I just read directly from /dev/ttyS0 with a Perl program. The C program might not actually be necessary as I think the "setserial" command might also be able to set the port up as needed. I would suggest setting the serial port and then just reading some data from it and see if you can figure out the format.

Post Reply