LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-13-2005, 07:15 AM   #1
ar1
Member
 
Registered: Nov 2003
Location: Bloomington, IL, USA
Distribution: Fedora Core 3
Posts: 126

Rep: Reputation: 15
serial port programming: Java or C?


I want to write a program to control a robot arm (a Lynxmotion 5, specifically) using the serial port. Now, I've often been told that serial port programming is a lot easier using Java (with the javax.comm package) as opposed to using C.

I was wondering if you guys had any suggestions or experience to share. Another thing to keep in mind is whether the java code will later be able to be used as part of a device driver which I may write for the same robotic arm.

Thanks
 
Old 05-13-2005, 07:56 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
If you are planning on writing a device driver for Linux then it must be written in C.

However... if the robot speaks RS-232 then I don't see a good reason for writing a driver in the first place. All you really need is a user space program that users the serial driver already in the kernel. In this case it comes down to a matter of personal preference, as it is quite easy to write to the serial port driver in both C and Java.
 
Old 05-13-2005, 08:24 AM   #3
ar1
Member
 
Registered: Nov 2003
Location: Bloomington, IL, USA
Distribution: Fedora Core 3
Posts: 126

Original Poster
Rep: Reputation: 15
Hmm. The driver can provide some additional functionality I think. For example, I can have control timing in kernel space so that I can have 2 servos moving but appearing to move together (I guess like multi-processing). Of course, a side reason is that it'll give me an excuse to write a driver and thus understand the kernel better
 
Old 05-14-2005, 04:03 PM   #4
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
It's not that nice to program in kernel space. And the only reason to do that is... to modify or improve the kernel. Now I understand that you want to learn, but wouldn't be nicer if you would do 2 separate things ? Something more meaningfull for kernel space, and a user space program that control the robotic arm.

In any case good luck with your robotic arm! I've done something vaguely similar on serial port, and it's really nice when something it's moving controlled by the computer.
 
Old 05-17-2005, 12:54 PM   #5
ar1
Member
 
Registered: Nov 2003
Location: Bloomington, IL, USA
Distribution: Fedora Core 3
Posts: 126

Original Poster
Rep: Reputation: 15
Quote:
All you really need is a user space program that users the serial driver already in the kernel.
The driver is serial_core.c right? I don't understand anything in it. I could try reading the source code of a serial driver already in the kernel, but looking at their sizes I doubt if I'll get anywhere anytime soon. Since I'm working for on a college project the main aim is to get the robot moving, to be honest I don't care for perfection (deadlocks, race conditions and the likes :/)

So, do you guys have any suggestions on how to go about it, would you recommend Java for my purpose then? Or perhaps some source code or documentations that would help me?

Thanks
 
Old 05-19-2005, 02:55 PM   #6
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
My program was made for DOS, and I don't have it on my computer (it must be somewhare bt it wasn't interesting).

This is a tutorial on tldp.

http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/

The examples there are just as complicated as my program was (but of course mine, also transmitted simple commands).

Hope it helps, it's really nothing complicated to be explained. You initialize it and you send charachtesrs, depending on what you want to control.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem of serial port programming fingerling54 Linux - Software 4 05-18-2005 03:22 PM
serial port programming!!! novice_din Programming 4 02-03-2005 08:50 PM
Serial Port Programming Question Darktyco Programming 8 03-23-2004 05:13 PM
Programming the Serial Port karans Linux - Networking 2 11-03-2003 01:54 AM
Modem programming and serial port Drickx Linux - Networking 2 04-24-2002 09:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration