Gabor Hi, I am doing a few more changes and then I'll be able to deliver my code if it still doesn't work. I found earlier about the eof character, I don't think that changing this char to a different value will help me. I need the link to become fully transparent. Is there a way to achieve this goal? And Offer, thanks as well. Regards, Moshe Okman
-----Original Message----- From: Gabor Szabo [mailto:szab...@gmail.com] Sent: Monday, July 05, 2010 8:01 PM To: Perl in Israel Subject: Re: [Israel.pm] Using a serial port (rs-232) from perl. 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 <mo...@okman.name> 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 Perl@perl.org.il http://mail.perl.org.il/mailman/listinfo/perl _______________________________________________ Perl mailing list Perl@perl.org.il http://mail.perl.org.il/mailman/listinfo/perl