|
Posted by jis on July 13, 2007, 1:48 pm
Please log in for more thread options
> jis wrote:
> > I have got a very strange looking issue. I have a perl code which
> > reads the serial port.
> > I have the following configuration for the port
>
> [...code...]
>
> > Now the code was not reading serial port . So I open a VB window and
> > wrote a code using commport and my serial port works fine.
>
> > Now I tried my perl code again. The perl code could read the serial
> > port now and it works fine after that!!!!
>
> Sounds to me like some initialization issue.
>
> When I use Device::SerialPort (same as Win32:SerialPort, but for Linux) I
> use the following statements for complete init of the serial device:
>
> $ser->baudrate($baud) || die 'fail setting baudrate, try -b
option';
> $ser->parity("none") || die 'fail setting parity to none';
> $ser->databits(8) || die 'fail setting databits to 8';
> $ser->stopbits(1) || die 'fail setting stopbits to 1';
> $ser->handshake("none") || die 'fail setting handshake to
none';
> $ser->datatype('raw') || die 'fail setting datatype raw';
> $ser->write_settings || die 'could not write settings';
> $ser->error_msg(1); # use built-in error messages
> $ser->user_msg(1); #
> $ser->read_const_time(100); # important for nice behaviour,
otherwise hogs
> cpu
> $ser->read_char_time(100); # dto.
>
> Especially the write_settings seems to be missign in your code. AFAIUI this
> routine actually sets the previously selected values.
>
> Cheers,
> Ekki
Ekki,
You are absaolutely correct. write_settings solved my problem. Thanks
a lot. It did save a lot of time.
regards,
Jis
|