On Tue, 2008-01-22 at 07:58 +0000, vulcansh wrote: > --- In [email protected], Giovanni <[EMAIL PROTECTED]> wrote: > > > > I use the following command to send hexadecimal values to the serial > port: > > > > [EMAIL PROTECTED] /root]111# printf \x20 > /dev/ttyUSB0 > > (sending 20 hexadecimal to the serial port) > > > > Then I used this command for sending the hexadecimal value 30: > > [EMAIL PROTECTED] /root]111# printf \x30 > /dev/ttyUSB0 > > > > But the result is exactly the same as sending hexadecimal value 20. > > > > It seems that "printf" command from the shell is not interpreting > correctly the "\xNN" > option. See the man page for the correct description. > > > > I used the commands above on my Slackware computer and it is working > well, as > expected. > > This worked for me: > > /usr/bin/printf "\x30" | od -X -c > > printf is a shell builtin in the bourne shell (sh), > but /usr/bin/printf is provided by busybox. > > Steve > > > > >
Try: printf '%02X' 20 printf '%02X' 30 chris
