Hi,
over the uart port I would like to send out following hexadecimal string
C5C301000000000076.
Below there is a snippet of the code I have written but at the receiving
end the leading 0's are dropped.
I receive C5C310000076 instead.
Could anyone give me a hint or a solution?
unsigned char tx_buf[9] =
{0xC5,0xC3,0x01,0x00,0x00,0x00,0x00,0x00,0x76}; //unsigned is 0<>255
signed is -128<>127
unsigned char *p_tx_buf = &tx_buf[0]; //points to the first element of
the tx_buf
int fd;
//open uart2 for tx/rx, not controlling device
if((fd = open("/dev/ttyO4", O_RDWR | O_NOCTTY | O_NDELAY)) < 0)
printf("Unable to open uart2 access .\n");
else
printf("uart2 opened succesfully.\n");
if(write(fd,&tx_buf,sizeof(tx_buf))<0)
printf("ERROR : tx not send.\n");
else
for(unsigned int i = 0; i < sizeof(tx_buf); ++i)
{
std::cout << std::hex << (int)tx_buf[i];
}
printf(" : tx send \n");
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.