Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

How to Format Serial Port Output Format

by user2829 (Acolyte)
on Dec 08, 2010 at 03:50 UTC ( [id://875935]=perlquestion: print w/replies, xml ) Need Help??

user2829 has asked for the wisdom of the Perl Monks concerning the following question:

Hi I am Developing a Perl script to transfer data Between Bluetooth firmware ( BT connected through USB ) and Test equipment ( connected through Serial Port ). I am using Perl module Win32::SerialPort. I can get data from Equipment in special ASCII format ( ☻ Black Smiley..♥ Black heart...). When i covert it back to Hex I get the opcode that my firmware can process. In return BT Firmware sends Command complete opcode back. Problem starts here... When I try to write back to Serial Port using $PortObj->write(opcode(hex)) the test equipment doesnot recognize it :(... what should I Do here. Please do reply back, USER2829
  • Comment on How to Format Serial Port Output Format

Replies are listed 'Best First'.
Re: How to Format Serial Port Output Format
by Corion (Patriarch) on Dec 08, 2010 at 08:24 UTC

    Have you tried rebooting?

    You don't show any code. How are we supposed to diagnose your problem without seeing your code, your input and your output data, and how the output data differs from what needs to be sent instead?

Re: How to Format Serial Port Output Format
by wallisds (Beadle) on Dec 08, 2010 at 16:48 UTC

    I've used Perl to retrieve rft (really f****** cold) freezer temperatures and one of the things I needed to do was send hex to the unit through the serial interface. I was able to do this using Perl's 'pack'.
    Check out:
    http://perldoc.perl.org/functions/pack.html
    Maybe that will help.

      ok I guess pack function in perl works for me :).. @input=(0x04,0x0e,0x04,0x01,0x03,0x0c,0x00); $ascii = pack("C*", @input); print "the value is $ascii"; $PortObj->write($ascii)|| die "Can't write to $PortName: $^E\n";; Thanks, -USER2829

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://875935]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 01:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found