C
cerr
Hi There,
I came up with following sample code to demonstrate my issue:
#include <18F87K22.h>
#device HIGH_INTS=TRUE, adc=16, ICD=TRUE
#fuses NOWDT //No Watch Dog Timer
#fuses WDT128 //Watch Dog Timer uses 1:128
#fuses HSM //Hi-Speed crystal oscillator
#fuses NOBROWNOUT //No brownout reset
#fuses NOPLLEN //No PLL enabled
#fuses BBSIZ1K //1K words Boot Block size
#fuses NOXINST //Extended set extension and
Indexed
typedef struct{
int8 foo,
test;
} TheStruct;
TheStruct mystruct[5];
int16 myarr[2];
void Func(TheStruct *data, int16 *arr);
void main (void)
{
myarr[0]=0xff;
myarr[1]=0xaa;
memset(&mystruct,0,sizeof(mystruct));
Func(myarr,&mystruct);
while(true);
}
//------------------------------------------------------------------------------
void Func(TheStruct *strdat, int16 *arr)
{
strdat[0]->foo=(*arr[0]);
strdat[0]->test=(*arr[1]);
}
This compiles just fine (CCS 4.119) but doesn't work, after the
function, foo and test are still 0 cause myarr doesn't seem to be
passed correctly to the function.... what am I doing wrong here?
Thanks,
Ron
I came up with following sample code to demonstrate my issue:
#include <18F87K22.h>
#device HIGH_INTS=TRUE, adc=16, ICD=TRUE
#fuses NOWDT //No Watch Dog Timer
#fuses WDT128 //Watch Dog Timer uses 1:128
#fuses HSM //Hi-Speed crystal oscillator
#fuses NOBROWNOUT //No brownout reset
#fuses NOPLLEN //No PLL enabled
#fuses BBSIZ1K //1K words Boot Block size
#fuses NOXINST //Extended set extension and
Indexed
typedef struct{
int8 foo,
test;
} TheStruct;
TheStruct mystruct[5];
int16 myarr[2];
void Func(TheStruct *data, int16 *arr);
void main (void)
{
myarr[0]=0xff;
myarr[1]=0xaa;
memset(&mystruct,0,sizeof(mystruct));
Func(myarr,&mystruct);
while(true);
}
//------------------------------------------------------------------------------
void Func(TheStruct *strdat, int16 *arr)
{
strdat[0]->foo=(*arr[0]);
strdat[0]->test=(*arr[1]);
}
This compiles just fine (CCS 4.119) but doesn't work, after the
function, foo and test are still 0 cause myarr doesn't seem to be
passed correctly to the function.... what am I doing wrong here?
Thanks,
Ron