[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

serial port connection

Sangeeta Huddar

3/13/2009 6:53:00 AM

Hi ,
currently i m using ruby telnet for connecting to HW board but
now i want to switch to serial port
for the same i have downloaded the
http://rubyforge.org/frs/?group_id=61&rele... and put the
serial.so at /ruby/lib/ruby/1.8/i386-mswin32

now i want to use this and access the board .i tried d simple ways i
could think but nothing worked :(
can anyone help me with simple program to use serial.so
or is there any other way i can connect to board via serial port


thanks in advance,
-sangeeta
--
Posted via http://www.ruby-....

2 Answers

B. Randy

3/13/2009 2:49:00 PM

0

Hello,
Very intersting ... I'll try it late.
Well, I suppose that you are under Win$ and you must notice that the
SERIAL link is a "funny" game.

1 - Use a modem-cable, to link the two RS232 ports of your PC or an
other RS232 on a other PC.

2 - Test with classics tools the communication. On Win$, there is "Hyper
Terminal", any other kind of tool is good. On Linux, "minicom" for
example. Configure the two tools : same speed, no hardware handshaking,
no software handshaking, same parity, same stop-bits.
After, when you type some words in one window, you must see the text in
the other. At this point, your link is good.

3 - Replace one of the tools (Hyper Terminal, minicom) by your Ruby
code.
Try to send some text. I'll take the example from :
http://ruby-serialport.ruby... and make some modifications.

require 'rubygems'
require 'serialport'
sp = SerialPort.new "COM1", 9600, 1, NONE
sp.write "Hello world !"
puts sp.read

You should see the text on the new window. At this point, the soft is
good.

You can play with a modem too.

4 - For you HW. I don't know the kind of your HW, so I'll be "large".
Don't forget to verify the protocol of your HW board. Some HW wants some
special escape caracters before and after the message, or special
sequence for initiate the link, or want work only in dialog mode. In
this later case when you send something you must read something, if you
don't make this the HW will block.

Sangeeta Huddar wrote:
[...]
> now i want to use this and access the board .i tried d simple ways i
> could think but nothing worked :(
[...]
> can anyone help me with simple program to use serial.so
> or is there any other way i can connect to board via serial port
> thanks in advance,
> -sangeeta

--
Posted via http://www.ruby-....

B. Randy

3/13/2009 5:05:00 PM

0

Oops ! Sorry there is a mistake.

1 - Use a NULL-MODEM cable , to link the two RS232 ports of your PC or
an
other RS232 on a other PC.

B. Randy wrote:
> Hello,
> 1 - Use a modem-cable, to link the two RS232 ports of your PC or an
> other RS232 on a other PC.

--
Posted via http://www.ruby-....