Hello
I am trying to compile this DAC code with KDS3.0.0
---------------------------------------------------------------------------------------------------
typedef union
{
unsigned long Word;
struct
{
unsigned char DACDATx_L;
unsigned char DACDATx_H;
}Bytes;
}DACDATx_FULL_REG;
__no_init DACDATx_FULL_REG DACDATx @0x400CC000;
---------------------------------------------------------------------------------------------------
I got the following error: unknown type name '__no_init'
can someone help please.
Solved! Go to Solution.
Hi Theodore,
First have a look at following post to see if it helps:
Second could you declare a the following:
// __no_init DACDATx_FULL_REG DACDATx @0x400CC000;
volatile DACDATx_FULL_REG *DACDATx_FULL_REG_ptr;
In your code then:
DACDATx_FULL_REG_ptr = 0x400CC000;
unsigned char read_DAC_DATx_L;
read_DAC_DATx_L = DACDATx_FULL_REG_ptr->Bytes.DACDATx_L;
Assuming the DAC had been initialized then it should read the correct register value.
One observation though is I think you want to change unsigned long Word; to unsigned short Word;
My code example:
typedef union
{
unsigned short Word;
struct
{
unsigned char DACDATx_L;
unsigned char DACDATx_H;
}Bytes;
}DACDATx_FULL_REG;
//DES __no_init DACDATx_FULL_REG DACDATx @0x400CC000;
volatile DACDATx_FULL_REG *DACDATx_FULL_REG_ptr; //DES test
After DAC initialized:
#if 1 | //DES 1=test, 0=default code |
DACDATx_FULL_REG_ptr = 0x400CC000;
unsigned char read_DAC_DATx_L, read_DAC_DATx_H;
read_DAC_DATx_L = DACDATx_FULL_REG_ptr->Bytes.DACDATx_L;
read_DAC_DATx_H = DACDATx_FULL_REG_ptr->Bytes.DACDATx_H;
DACDATx_FULL_REG_ptr++;
read_DAC_DATx_L = DACDATx_FULL_REG_ptr->Bytes.DACDATx_L;
read_DAC_DATx_H = DACDATx_FULL_REG_ptr->Bytes.DACDATx_H;
#endif
This seemed to read the correct L/H pair.
Regards,
David
Hi Theodore,
First have a look at following post to see if it helps:
Second could you declare a the following:
// __no_init DACDATx_FULL_REG DACDATx @0x400CC000;
volatile DACDATx_FULL_REG *DACDATx_FULL_REG_ptr;
In your code then:
DACDATx_FULL_REG_ptr = 0x400CC000;
unsigned char read_DAC_DATx_L;
read_DAC_DATx_L = DACDATx_FULL_REG_ptr->Bytes.DACDATx_L;
Assuming the DAC had been initialized then it should read the correct register value.
One observation though is I think you want to change unsigned long Word; to unsigned short Word;
My code example:
typedef union
{
unsigned short Word;
struct
{
unsigned char DACDATx_L;
unsigned char DACDATx_H;
}Bytes;
}DACDATx_FULL_REG;
//DES __no_init DACDATx_FULL_REG DACDATx @0x400CC000;
volatile DACDATx_FULL_REG *DACDATx_FULL_REG_ptr; //DES test
After DAC initialized:
#if 1 | //DES 1=test, 0=default code |
DACDATx_FULL_REG_ptr = 0x400CC000;
unsigned char read_DAC_DATx_L, read_DAC_DATx_H;
read_DAC_DATx_L = DACDATx_FULL_REG_ptr->Bytes.DACDATx_L;
read_DAC_DATx_H = DACDATx_FULL_REG_ptr->Bytes.DACDATx_H;
DACDATx_FULL_REG_ptr++;
read_DAC_DATx_L = DACDATx_FULL_REG_ptr->Bytes.DACDATx_L;
read_DAC_DATx_H = DACDATx_FULL_REG_ptr->Bytes.DACDATx_H;
#endif
This seemed to read the correct L/H pair.
Regards,
David
Hi David
Thank you very much. It compiles fine.
I haven't yet test it to see if it reads correctly. Once I finish building up the code I will check.
Once again Thank you.
Best Regards,
--
Theo