This is for MPLABXC8 compiler I have researched and found number of topics related. But not able to solve my issue. My Array typedef
typedef volatile struct OneStageOpTag
{
unsigned DevID1: 4;
unsigned SetCmd1 : 4;
unsigned RdyResponse1 :4;
unsigned DevID2: 4;
unsigned SetCmd2 : 4;
unsigned RdyResponse2 :4;
unsigned DevID3: 4;
unsigned SetCmd3 : 4;
unsigned RdyResponse3 :4;
}OneStageOpType[3];
Now my variable
OneStageOpType CurOperPlan={0};// I checked this one -
//-in Simulator 3 element array of structure created
Now I am passing pointer to my function
GetOperationSeqForTransportReq(1,1,&CurOperPlan);
below is the function
void GetOperationSeqForTransportReq(StationIDType SourseStnID,StationIDType DestiStnID,
OneStageOpType *CurTransportPlan)
{
NOP();
CurTransportPlan[0]->DevID1=5; // This is Ok
CurTransportPlan[1]->DevID1=5; // This is Not working
}
only the 0th element is accessable. Also compiler complaints that structure pointer passed to structure array pointer.
I tried by incrimenting the pointer in function. It seems incrimenting the whole Array pointer.
It seems to me that &CurOperPlan is adress pointer to 0th index structure only. The whole array is not contained it.
please help.
GetOperationSeqForTransportReq(1,1,&CurOperPlan);either useGetOperationSeqForTransportReq(1,1,CurOperPlan);or(*CurTransportPlan)[0]->DevID1=5;with the typeOneStageOpTag *.typedefed an array.