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.

EZ430 RF2560 Circular Buffer Question

Hello to all,

I am currently programming the ez430 rf2560, and it is my first delve into embedded systems using a RTOS. Overall, my project is to alter the accelerometer application to send raw three axis data over the spp so I can log it to a file and analyze it from there. My question is about the circular buffer. Specifically in the sdk_pl.c file the assignments:

buffer[0] = accl_x;

buffer[1] = (accl_x >> 8);

buffer[2] = accl_y;

buffer[3] = (accl_y >> 8);

I realize (unless i'm wrong) that this simply inserts the x axis data into the first byte of the array buffer, and then it gets shifted a whole register down. My question is why is it done this way? Is it the same as simply assigning buffer[1] = accl_x?

My second question is that since the accelerometer program only sends x and y axis data over spp, I realize I will have to alter the buffer length to make room for the z data (which is read from the accelerometer in halAccread() function, but never used). My question is, is the buffer to alter in the appl_sdk.c file (specifically the code below)?

static UCHAR appl_spp_data_buffer[4];

Thanks in advance for your help, I greatly appreciate it.

  • Hi, Mark,

    without looking at all definitions of variables, it seems the buffer is defined as an unsigned char -- 8 bits -- while the axis data is a 16-bit register. Therefore when loading the buffer, the lower 8 bits get transferred to position 0 while the upper 8 bits have to be shifted right to load buffer position 1.

    Adding the z axis should be as simple as defining your buffer with 6 positions instead of 4. Again, I say that without looking at the rest of the code and without evaluating whether you have enough memory to do that.

**Attention** This is a public forum