Thanks. Like some of the approaches I've tried, it works for values that are not assigned to printable ASCII characters. If the value is assigned to a printable character in the ASCII set, then Perl will send the character from the ASCII set. So:
syswrite( $SERIALPORT, pack 'C', 44 );
#writes 0x2C onto the wire, so Perl evidently sees ASCII character 0d4
+4 in this case, not number 0d44
I have studied the pack, unpack, and packtut extensively, and conclude that they do not get the chance to come into play: Perl is tinkering with the write. | [reply] [d/l] |
0x2c and 0d44 are just different representations of the same number.
| [reply] |
I think my head has been in this too long, quite right. I do know the difference between numbers and radixes.
| [reply] |
I have studied the pack, unpack, and packtut extensively, and conclude that they do not get the chance to come into play: Perl is tinkering with the write.
Sorry, but you are wrong. Your problem is one of your perception. Perl doesn't "tinker with the write".
A byte with the numeric value of 44 is simply the bit pattern 00101100. It will only be interpreted as an ascii character by whatever you are using to look at it.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
I'm using interceptty to watch the serial port, so I am confident about what is really happening, and understand why you pointed out that trap.
syswrite(FH, 45); #puts 0x34 0x35 onto the wire, as if I said '45'
and I do call that tinkering. I'm probably wrong in here somewhere, though, usually am.
I'm not sure what I've done, but now syswrite(FH, pack('C', $packet)) is working. Will test more.
| [reply] [d/l] |
Since I have a logic analyzer available to me, I connected it to my PC's serial port, ran your code and captured a trace, which I put as the image on my profile node.
(I thought the monks might be curious to see what a byte on a serial port "looks" like.)
| [reply] |