PeterW50
Posts: 3
Joined: Thu Jul 20, 2017 11:26 am

Which programme language

Thu Jul 20, 2017 4:14 pm

I want to write a simple application to read a data stream from a USB input, select some record types and output to an Rs232 output. Which is the best programming language please? Any sample programmes welcome.
Thanks

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Which programme language

Thu Jul 20, 2017 4:33 pm

Please be more specific about what type of USB device you are reading data from.

There are many and the advice given will change depending on what type of USB device it is.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

timrowledge
Posts: 1348
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Which programme language

Thu Jul 20, 2017 10:07 pm

Well the obvious language to use is Smalltalk.

You know that you're going have a little hardware related fiddling to do to make use of RS232, right?
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

PeterW50
Posts: 3
Joined: Thu Jul 20, 2017 11:26 am

Re: Which programme language

Fri Jul 21, 2017 1:32 pm

Thanks both
This is a simpl? Boat application. The USB input is from a chart plotter interface which sends data to PCs etc. I can get the format of all possible records, but they are all simple records streaming out sequentially. The marine standard is NMEA.

I'll take a look at small talk.

timrowledge
Posts: 1348
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Which programme language

Fri Jul 21, 2017 8:36 pm

Whatever language you choose to use you'll basically be doing

open file /dev/{someusbserialthing}
open file /dev/{myrs232thing}
while still-going
read data from usb
process data to work out what it says
if it matches your rule
write to rs232
loop

I'm pretty sure someone will be a long to tell you to use something like
cat /dev/usbthing | sed `insane complex regex incantation` -o /dev/rs232
or something like that.

I'd choose to do it in Smalltalk because I'd choose to do pretty much anything in Smalltalk. You get the advantage of live debuggability, an option to log everything, to display stuff interestingly, total portability across platforms etc.

What do you want to end up with? Is this just a way to implement a filter of the data stream before passing it on somewhere else?
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Which programme language

Sat Jul 22, 2017 2:56 pm

PeterW50 wrote:I want to write a simple application to read a data stream from a USB input, select some record types and output to an Rs232 output. Which is the best programming language please? Any sample programmes welcome.
Thanks
Personally I'd probably use Ruby or Perl, others would likely suggest Python. In reality most common languages will probably do what you need, you should then choose the one you're happiest learning and think you can get the best support with when you get stuck (Python probably has the largest following in these parts).

jahboater
Posts: 5825
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: Which programme language

Sat Jul 22, 2017 3:03 pm

mfa298 wrote: others would likely suggest Python. In reality most common languages will probably do what you need, you should then choose the one you're happiest learning and think you can get the best support with when you get stuck (Python probably has the largest following in these parts).
And I would suggest C. But yes, Python is popular, well supported here, and would be a good choice if outright speed is not an issue (of course the low level library stuff you will use will likely be written in C anyway!!).

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Which programme language

Sat Jul 22, 2017 3:08 pm

jahboater wrote:And I would suggest C.
Heh, I did consider also listing C (and I've done nmea parsing in C, both on the pi and avr) but it's not such a beginner friendly language :ugeek:

Return to “Beginners”