Sign in

username:

password:



Not a member?

Search c28x



Search tips

Subscribe to c28x



Ads

Discussion Groups

Discussion Groups | TMS320C28x | sending /receiving data through UART

Technical discussions about the TI C28x DSPs (including the C2810, C2811, C2812, F2801, F2806, F2808, F2810,, F2811, F2812, R2811 and R2812).

  

Post a new Thread

sending /receiving data through UART - tal....@gmail.com - Oct 18 14:30:35 2007



Hi,
I need to send / receive  binary data to / from PC through UART.
The problem is that the data is a struct containing asci (char) information as well as
"short int" "long int" ...
for example 
struct s_x
{
   char x[6];
   short y;
   long z;
}
char * x_msg = &s_x;
for (int i=0;i< sizeof(s_x);i++)
  send(s_x[i]); // this routine send byte through uart.
There are three problems: 
1. The size of the message is not the same as in PC.
2. The "short" here is 1 byte, and in PC it is 2 bytes.
3. The long z is aligned so ther is a hole in the middle (which on PC I solve with pragma
pack)

can anyone tell me how to solve this problem? I can solve it for each message apart but is
there a general solution ?
thanks,

You can post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/c28x/1.php

_____________________________________

 


(You need to be a member of c28x -- send a blank email to c28x-subscribe@yahoogroups.com )