Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 03 Sep 2014, 01:20
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
How to talk to serial device via command line?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
Rickrandom

Joined: 21 Jan 2006
Posts: 195
Location: Bedfordshire, UK

PostPosted: Sun 16 Jan 2011, 05:21    Post subject:  How to talk to serial device via command line?  

I am trying to communicate with an electronics device with a serial connection, and I have two different USB to serial adaptors. If I plug either in to my Puppy 511 machine, it shows up as ttyUSB0, so that seems promising.

I thought I would just use the command line, and I think I know how to set the baud rate (stty -F /dev/ttyUSB0 ispeed 2400) and how to log the response into a file (cat /dev/ttyUSB0 > /root/my-documents/log_file.txt) (by cribbing from http://www.futuretimes.webfreehosting.net/USB_multimeter.html).

However what I have no idea about is how to send anything out, e.g. the commands that I need to send to my electronics device, so it then replies with the data that I can log.

Any help gratefully received.
Back to top
View user's profile Send private message 
MagicZaurus

Joined: 05 Jan 2009
Posts: 88

PostPosted: Sun 16 Jan 2011, 06:43    Post subject: Serial communication  

You can send something (ABC) to the device with the following command.

Code:
echo "ABC" > /dev/ttyUSB0


More interactive would be the use of a terminal program like minicom.
Back to top
View user's profile Send private message 
Rickrandom

Joined: 21 Jan 2006
Posts: 195
Location: Bedfordshire, UK

PostPosted: Sun 16 Jan 2011, 06:51    Post subject:  

Thanks.

I will look at Minicom, but thought I'd simply start with the command line.
Back to top
View user's profile Send private message 
MagicZaurus

Joined: 05 Jan 2009
Posts: 88

PostPosted: Sun 16 Jan 2011, 09:20    Post subject: Serial communication  

You are right to try from the command line first to see if the communication with your device works fine. I only have the experience with some of these USB-To-Serial adapters under Windows and my experience is that not all of them work with all devices. The best way is still a good old COM port, but they are getting more difficult to find.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0433s ][ Queries: 11 (0.0056s) ][ GZIP on ]