Hi.
One of the things you will need to check is whether the connecting cable
is wired correctly. Do you need a straight through cable or a crossed
cable?
As for raw mode, you could do worse than to look at the man page for
stty. Essentially, it nullifies all the special settings of a serial
port, and lets you pass binary data.
cooked same as brkint ignpar istrip icrnl ixon opost isig icanon, eof
and eol characters to their default values
-cooked
same as raw
There is an implementation of stty in the Win32::SerialPort package.
Does it do what you want? I don't know.
The other thing to consider is what handshake you are going to use if
you do use raw mode. You have disabled CTS-RTS. CtrlQ/CtlrS isn't going
to work. If the protocol is short and reliable, you may get away without
one.
Peter
On Mon, 2010-07-05 at 23:42 +0300, Moshe Okman wrote:
> Peter thanks,
> The target that I'll eventually be connected to requires only Rx,Tx and Gnd.
> (On my side I intend to add short connections over CTS-RTS and DTR-DSR).
> My test script is intended to assure that I know how to create info,
> transmit it to the peer and to get its responses. Currently I consider the
> echo from the server side as a response from the peer.
> The transmitted information should be part of a frame and I guess that the
> data field can use any bit combination. Info is transferred as binary
> (Non-ASCII) values. Calculated CRC signature will later be added by me and
> any combination here should also be considered valid.
>
> Your last question was about RAW mode - what is it?
> Thanks,
> Moshe Okman
>
>
>
> -----Original Message-----
> From: Peter Gordon [mailto:[email protected]]
> Sent: Monday, July 05, 2010 11:13 PM
> To: Perl in Israel
> Subject: Re: [Israel.pm] Using a serial port (rs-232) from perl.
>
> Moshe,
>
> I can try to help.
>
> What hardware is connected to the other side? What protocol does the
> other side need? What are the valid characters that the other side can
> read?
>
> Do you need to work in raw mode?
>
> Really we need much more information.
>
> Peter
>
>
> On Mon, 2010-07-05 at 20:01 +0300, Gabor Szabo wrote:
> > Hi Moshe,
> >
> > I don't think there are many Win32 and Serial port experts here but I
> guess
> > some of us might be able to help a bit more if you shared the full
> > scripts you wrote
> > or at least the smallest working (or rather not working) example you have.
> >
> > Anyway, see below:
> >
> > On Mon, Jul 5, 2010 at 4:23 PM, Moshe Okman <[email protected]> wrote:
> > > Hi Friends,
> > >
> > > I have a problem with using a serial port and I hope that someone will
> be
> > > able to help me here.
> > >
> > > I am new to Perl and I wrote two scripts as a tutorial that uses the
> serial
> > > link for communication.
> > >
> > >
> > >
> > > The first script gets some info from the keyboard (represented as HEX
> > > values) converts it to integer values
> > >
> > > and then transmits it toward the serial port.
> > >
> > > The peer script is expected to get these values, to printf them and to
> echo
> > > it back to the first script.
> > >
> > >
> > >
> > > I am using Win32::SerialPort, both my ports are configured as 115200
> Baud, 8
> > > data bits, 1 stop bit, no parity and no handshake signals.
> > >
> > >
> > >
> > > I face two main problems:
> > >
> > > 1) When the value I try to transmit is 0x00 the script will get stuck.
> > >
> > > Assuming that $ch = 0;
> > >
> > > $ob->write($ch); ====> This will
> cause
> > > the script to freeze.
> > >
> > > From my point of view the 0x00 value is a valid data byte and I must
> be
> > > able to pass it through.
> >
> >
> > looking at the documentation I found this:
> >
> > Configuration Parameter Methods
> > ...
> > $PortObj->eof_char(0x0)
> > $PortObj->event_char(0x0);
> >
> > that confused me a bit but it might mean that 0x0 has some special
> meaning.
> > At least by default.
> >
> >
> >
> > >
> > >
> > >
> > >
> > >
> > > 2) When I send successively several values, the peer side will get a
> problem
> > > to distinguish between these values.
> > >
> > > Consider the following lines:
> > >
> > > @txArray = (0x83, 0x95, 0x17, 0x2A,
> > > 0xB2);
> > >
> > > foreach $k (@txArray) {
> > >
> > > $ob->write($k);
> > >
> > > }
> > >
> > > The required values are sent to the peer side and are
> > > temporarily stored into a system buffer that serves the $ob.
> > >
> > > When my script there does:
> > >
> > > If ($inBuffer = $ob->input) {
> > >
> > > printf
> > > $inBuffer; ===> This will show that $inBuffer ==
> "1311492342."
> > >
> > > }
> > >
> > > I need to be able to distinguish between the unique
> transmitted
> > > values and I don't know how the peer should be able to
> > >
> > > do so (e.g. 131 , 149, 23, .)
> >
> >
> > maybe you need to use $ob->read(2) instead of ->input ?
> >
> >
> >
> > Gabor
> > _______________________________________________
> > Perl mailing list
> > [email protected]
> > http://mail.perl.org.il/mailman/listinfo/perl
>
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl