Re: help on win32::serialport



On Jun 5, 5:10 am, "Sisyphus" <sisyph...@xxxxxxxxxxxxxxxxx> wrote:
"jis" <jisma...@xxxxxxxxx> wrote in message

news:1180991545.660022.273750@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Can anybody help with examples on reading a serial port.
Even after reading through the win32::serialport CPAN pod my attempt
to write a working code is gone futile.
I am trying to read a barcode with a scanner.

I think your best chance of success would be to post to "Seekers of Perl
Wisdom" at perlmonks. Another option would be the 'perl-win32-users' mailing
list hosted by ActiveState, though it's really low volume these days. That's
not to say that there's no-one here who can help, but you've given us very
little to work with.

Wherever you post, it's better to provide a copy'n'paste of some code that
you've tried (along with a copy'n'paste of the error messages it generates).
That way, even if there's no-one around who can actually answer the
question, there might be someone lurking about who can see a fault in your
code and provide a correction.

Google might also be able to help out. I triedhttp://www.google.com.au/search?hl=en&q=Win32%3A%3ASerialPort+barcode...

I couldn't see anything there that stood out as a likely solution, but I
didn't actually follow any of the links.

Cheers,
Rob

Atast i could figure out how it works.if anyobdy else searching for
the same here is the code.
This reads the barcode with the help of scanner.This is a basic
code.Ofcourse need to be modified for realtime use.

use strict;
use Win32::SerialPort;
sub openPort($);
sub closePort($);

my $bar;
my $DEVICE = "COM1";
my $data=0;
my $serial =openPort($DEVICE);
while(!($data=~/\r/))
{
$data=$serial->input;
$bar=$bar.$data;
}
print $bar;
closePort($serial);

sub openPort($)
{
my ($device) = @_;


my $serial = Win32::SerialPort->new ($device, 1);
die "Can't open serial port $serial: $^E\n" unless ($serial);

$serial->user_msg(1);
$serial->databits(8);
$serial->baudrate(9600);
$serial->parity("none");
$serial->stopbits(1);
return $serial;
}

sub closePort($)
{
my ($serial) = @_;
$serial->close();
}


.



Relevant Pages

  • Re: intermec multiple barcode read events
    ... private void TransporterForm_Deactivate(object sender, EventArgs e) ... > Form2 has it's own instance of a barcode reader object. ... > Public Sub New ... > Private Sub Form1_Load(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: Barcode scanner and quantities
    ... Private Sub Worksheet_Change ... MsgBox "barcode doesn't match cell C27!" ... I put the cursor in cell C89 and scan a barcode. ...
    (microsoft.public.excel.setup)
  • RE: automated cursor movement in Excel
    ... Sub barCode() ... Dim RowCount As Long ... 'enter the code for barcode ... Following the third entry I want to move down to the next row and enter data ...
    (microsoft.public.excel.programming)
  • Re: FindFirst and SetFocus
    ... If there barcode is not found, ... to the next client record instead of staying on the ... If IsNullThen Exit Sub ... Dim varOnlyClient As String ...
    (microsoft.public.access.formscoding)
  • RE: Query in VB/Passing it to a form/query
    ... Make the space below the bar with Form Footer nothing by dragging the ... You can make the form header larger by dragging the Detail bar down. ... insert your check boxes and check box labels. ... Private Sub Check1_AfterUpdate ...
    (microsoft.public.access.modulesdaovba)