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

Reply via email to