win32::SerialPort; Sending Raw Data

S

Schmigz

I am writing a program to send data to a Digital Picture Frame I am
currently designing. It has a serial port that I have configured and
I have successfully sent data using the win32::SerialPort module. The
problem I am having is I need to send a raw bit stream out the serial
port. I have an array of strings that contain raw binary data (eq.
"00101001") that is the color information I need to send. When I send
the string, it converts the bit stream to ascii for sending. My code:

foreach $color (@RGB)
{
$PortObj->write($color);
}

What must I do to be able to send the data so that it is not converted
to ascii before being sent and the raw data is sent.

Thanks.
 
W

Walter Roberson

:I am writing a program to send data to a Digital Picture Frame I am
:currently designing. It has a serial port that I have configured and
:I have successfully sent data using the win32::SerialPort module. The
:problem I am having is I need to send a raw bit stream out the serial
:port. I have an array of strings that contain raw binary data (eq.
:"00101001") that is the color information I need to send. When I send
:the string, it converts the bit stream to ascii for sending. My code:

:foreach $color (@RGB)
: {
: $PortObj->write($color);
: }

:What must I do to be able to send the data so that it is not converted
:to ascii before being sent and the raw data is sent.

foreach $color (@RGB)
{
$PortObj->write(pack 'B*', $color)
}

Or, more shortly,

$PortObj->write pack 'B*', $_ foreach @RGB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top