This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi...
I am using TSM320f28035 controller for one of my application.
I am using a structure for my variables and want to extract 8-bit data from it in different register in a optimized way.
I have declared the variable as follows.
typedef struct DATA
{
Uint16 A1;
Uint16 A2;
Uint16 A3;
}Parameters;
typedef union DATA
{
Parameters B1;
Uint16 ARRAY16[ 3];
Uint8 ARRAY8[6];
}extract;
When compiled and try to extract data from the ARRAY16, the data of the element of the structure reflects in the buffer.
But I get some garbage value in the ARRAY8.
Will you please suggest what should I do to get the 8-bit data in the register in a optimized way?
Regards,
Kamal
I'm not sure where the Uint8 you're using is defined, but you can't have a Uint8 on the C28 that is truly 8 bits. Check out the "Data Types" section of the compiler user guide and note that a char is 16 bits.
To access data 8-bits at a time you can define a structure with 8-bit bit-fields, use the __byte() intrinsic on a Uint16, or do the somewhat more manual work of masking and shifting out the 8 bits you're interested in in a Uint16.
Whitney