Serial port connection

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&release_id=308 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 :frowning:
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-forum.com/.

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.rubyforge.org/ 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 :frowning:

[...]

路路路

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-forum.com/\.

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-forum.com/\.

B. Randy wrote:

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.rubyforge.org/ 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 :frowning:

[...]

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

Hello,
         I installed the gem and ran the code. Message was written
successfully. But I can't read the written data. It is waiting there.
The device I opened was /dev/ttyS0. Help me to read the data from serial
port.

Thanks,
Stalin .T

路路路

--
Posted via http://www.ruby-forum.com/\.

Hello,

I never used serial-port communication with Ruby, but I collected some
informations on this. (It's likely that I'll need it in the future...)

Maybe, the following is usefull for you:

"
聽聽# ...All I had to do was set a seemingly
聽聽# arbitrary read_timeout value. With the timeout,
serialport.gets just returns
聽聽# whatever was in the input buffer.
"

My collection:

路路路

###########################################################################
聽聽# 2008-12-08: According to comp.lang.ruby, there is no easy-to-use
library,
聽聽# for serial port usage under windows. But: This should work:
聽聽# http://grub.ath.cx/win32serial/
聽聽# which worked fine on my system (Windows XP sp3, using cygwin
ruby, but I
聽聽# think it'll work with the one-click version of Ruby)
聽聽# Small, but must be compiled first. Compilation made problems,
according to
聽聽# comp.lang.ruby
聽聽#
聽聽# 2009-06-09: Somebody got library working (comp.lang.ruby,
2008-06):
聽聽# Nevertheless, it seems to be working today! All I had to do
was set a seemingly
聽聽# arbitrary read_timeout value. With the timeout,
serialport.gets just returns
聽聽# whatever was in the input buffer.
聽聽#
聽聽# Other thread (2008-06):
聽聽# ...in my experience Ruby serialport library for Windows is in
most cases
聽聽# not usable. I suppose the problem is Ruby's implementation of
threads
聽聽# (green threads) under Windows.
聽聽#
聽聽# For serial communication under windows I now use a
RS-232/422/485
聽聽# connections over Ethernet (i.e. Ethernet to serial) - so from
windows
聽聽# (Ruby) perspective I use TCP/IP communication which works fine.

Regards,
Axel