LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-20-2009, 02:50 PM   #1
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Rep: Reputation: 16
Serial Communication help


Hi,

I have a projector that has a RS232 port. I am working on building a script so my HTPC can control it.

I have basic functionality working. I wrote this basic scirpt:

Code:
#set baud rate
stty -F /dev/ttyUSB0 115200

echo "* 0 IR "$1"\r" > /dev/ttyUSB0
i can call it with:
pj_chan cmd#


there are many cmd's but to list a couple:
002 --> power off
017 --> SrcHDMI_1

So when i send

echo "* 0 IR 002\r" > /dev/ttyUSB0

it powers off. All cmd's are in the format of "* 0 IR ###" except for power on which is OKOKOKOKOK

Here are my list of issues i need help with:

1. I cant see the ACK return from the serial port. I can in Secure CRT on windows. What do i need to do so i can view the ACK statement. This isnt so important for setters but for my Get'ers it is a requirement.

2. How can i build an array or the like so instead of sending the cmd ### i can just say "pj_chan poweroff" and the script translates that to 002.

PJ is a Optoma HD80. Manual is located at http://marketing.optomausa.com/PDFs/...D80_Manual.PDF

RS232 cmd are near end.

Thanks,
Mitchell
 
Old 03-20-2009, 07:18 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
On the one hand, you're using a terminal emulator to send/view data, but on the other you're using a series of (unknown) shell commands. I suggest that you use either a good, scriptable terminal emulator, such as C-Kermit, or a more full functioned programming language that potentially has a ready-made package of functions and tools for the purpose, such as Perl and the Device::SerialPort module. Then you will be able to get around the issues of redirecting both stdin and stdout concurrently to/from a single device.
--- rod.
 
Old 03-20-2009, 08:41 PM   #3
mitchell2345
Member
 
Registered: Aug 2008
Posts: 55

Original Poster
Rep: Reputation: 16
i know nothing about perl scripts. would some one give me a clue or a start on how to begin this script?

Thanks,
Mitchell
 
  


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
Serial (RS232) communication is one-way anroy Linux - Hardware 5 08-25-2007 01:35 PM
Serial Communication On Linux...... kimbosung Programming 3 04-08-2007 08:26 PM
Serial Communication freeindy Programming 2 04-04-2007 08:24 AM
Serial port communication.. brianbek Linux - Software 2 01-23-2006 12:43 PM
Serial communication - minicom sg3 Linux - Networking 0 07-17-2003 12:00 AM


All times are GMT -5. The time now is 01:54 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration