Hi, i am trying to make some sort of communication between two home made PLC's "micro controllers". Since my communication protocol will send the bits first and only then the registers i need two tables one for bits and the other for registers. In my code there is a single structure called TNNvvar. This structure can access to other structures like inputs, outputs , pid ... See example below: Code: typedef struct { TNSA_DigitalInputs DigitalInputs; TNSA_DigitalOutputs DigitalOutputs; TNSA_AnalogInputs AnalogInputs; TNSA_AnalogOutputs AnalogOutputs; }TNSA_MainModule; typedef struct { TNSA_MainModule MainModule; TNSA_Module01 Module01; TNSA_Module02 Module02; TNSA_Module03 Module03; }TNNvar; Each of this "sub" structures has registers and bits as show in the example for digital inputs: Code: typedef union { struct { unsigned a_bs:1; //digital input status unsigned s_ac:1; // digital input active simulation unsigned s_enb:1; // digital input simulation enable unsigned alm_enb:1; // digital input alarm enable unsigned t_od_enb:1; // digital input enable timer on delay }bit; unsigned int all; // i put here 16 bits beacuse maybe i will need to add addicional bits ... }TNSA_DigitalInputs_BBN; typedef struct { TNSA_DigitalInputs_BBN bb_var; unsigned int t_od; //timer on delay unsigned long t_al; //alarm timer }TNSA_DigitalInputs; My idea of communication table for bits is : Code: #define NUMBER_OF_COILS 1600 typedef struct _PDU_COIL_MAP { unsigned char *base_addr; unsigned char byte_index; unsigned char bit_index; }PDU_COIL_MAP; TNNvar coils; PDU_COIL_MAP server_coil_map[NUMBER_OF_COILS]={ {&coils.MainModule.DigitalInput.bb_var.bit, 0, 0}, {&coils.MainModule.DigitalInput.bb_var.bit, 0, 1}, {&coils.MainModule.DigitalInput.bb_var.bit, 0, 2}, {&coils.MainModule.DigitalInput.bb_var.bit, 0, 3}, {&coils.MainModule.DigitalInput.bb_var.bit, 0, 4}, {&coils.MainModule.DigitalInput.bb_var.bit, 0, 5} }; My idea of communication table for registers is : Code: #define NUMBER_OF_REG 2000 typedef struct _PDU_REG_MAP { unsigned int *reg; }PDU_REG_MAP; TNNvar registers; PDU_REG_MAP server_reg_map[NUMBER_OF_REG]={ {®isters.MainModule.DigitalInput.t_od}, {®isters.MainModule.DigitalInput.t_al} }; The function for data transher has a prototype like this: Code: signed int CSS_SocketSent(int socket, const unsigned char *data, unsigned int length); My problem is thati dont know how to make the pointer for data transfering, and if my idea of communication tables is the correct one. Can somebody help me with this. Best regards, BoSCHoW.