It is possible, lets say that I have a struct:
Code:
typedef struct
{
unsigned a1:1;
.
.
.
.
.
unsigned a2000:1;
}Coils;
and i have a function like this:
Code:
void transferBytes(unsigned char *source, unsigned char *dest, unsigned short quantity)
{
for(int i = 0; i < quantity; i++)
dest[i] = source[i];
}
In the main function I just have to call the main function and write in the correct parameters:
Code:
int main()
{
Coils objCoils;
Coils *ptrCoils;
ptrCoils = &objCoils;
unsigned char dest[260];
unsigned short quantity = 20;
transferBytes((unsigned char*)&ptrCoils, (unsigned char*)&dest, quantity);
}
Thanks and best
regards,
BoSCHoW.