I am trying to pass a struct through an array to another array from one microprocessor to another microprocessor and then dereference that array to update the same exact struct on the other microprocessor.
My goal is to always have values inside of both structs while sending any updates to the struct on the other microprocessor in the mean time but I seem to be looping through the data and the members of the struct seem to be cleared out after every clock cycle. I can verify this by the flashing of my leds which the struct controls. I suspect it is how I am using the arrays but any input would be appreciated.
FIRST MICROPROCESSOR
Code:
extern struct i2c_data * TX_Data;
extern struct i2c_data TX_Data_1;
extern struct i2c_data TX_Data_2;
unsigned char data_tmp[30];
for(i=0;i<sizeof(TX_Data);i++)
{
data_tmp[i] = *(((char*)&TX_Data) + i);
data_tmp[i] = *(((char*)TX_Data) + i);
SSP1BUF = data_tmp[i];
SECOND MICROPROCESSOR
Code:
struct i2c_data * TX_Data;
struct i2c_data TX_Data_1;
struct i2c_data TX_Data_2;
unsigned char crap[4];
static char y;
for(y=0;y<sizeof(TX_Data);y++)
{
crap[y] = SSPBUF;
TX_Data = (char *)&crap[y];
SSPCON1bits.CKP = 1;//Release clock
}