Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to Format Serial Port Output Format

by wallisds (Beadle)
on Dec 08, 2010 at 16:48 UTC ( #876062=note: print w/replies, xml ) Need Help??


in reply to How to Format Serial Port Output Format

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.

  • Comment on Re: How to Format Serial Port Output Format

Replies are listed 'Best First'.
Re^2: How to Format Serial Port Output Format
by user2829 (Acolyte) on Dec 09, 2010 at 17:39 UTC
    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: note [id://876062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2023-01-29 15:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?