Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
Problem with struct and Cosmic compiler - folg...@yahoo.com - Mar 11 8:48:50 2009
Hello,
I am using cosmic Compiler.
I have this struct:
typedef struct
{
unsigned int IDAC;
unsigned int CANidar0;
unsigned int CANidmr0;
unsigned int CANidar1;
unsigned int CANidmr1;
unsigned int CANidar2;
unsigned int CANidmr2;
unsigned int CANidar3;
unsigned int CANidmr3;
unsigned int CANidar4;
unsigned int CANidmr4;
unsigned int CANidar5;
unsigned int CANidmr5;
unsigned int CANidar6;
unsigned int CANidmr6;
unsigned int CANidar7;
unsigned int CANidmr7;
}FILTER;
Now I wnt to fill the struct like this:
FILTER stConfig;
stConfig=
{
0x00, 0xFF, // Filter 0
0x00, 0xFF, // Filter 0
0x00, 0xFF, // Filter 1
0x00, 0xFF, // Filter 1
0x00, 0xFF, // Filter 2
0x00, 0xFF, // Filter 2
0x00, 0xFF, // Filter 3
0x00, 0xFF // Filter 3
};
This does not work. I get the error "missing expression" in line "stConfig="
Could anybody tell me, what I am doing wrong?
Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
RE : Problem with struct and Cosmic compiler - Jean-Pierre Lavandier - Mar 11 8:57:59 2009
The initialization must be part of the declaration, so simply write:
=20
FILTER stConfig =3D {
0x00, 0xFF, ...
=20
Best Regards,
Jean-Pierre Lavandier
=20
-----Message d'origine-----
De : 6...@yahoogroups.com [mailto:6...@yahoogroups.com] De la part de
f...@yahoo.com
Envoy=E9 : mercredi 11 mars 2009 13:48
=C0 : 6...@yahoogroups.com
Objet : [68HC12] Problem with struct and Cosmic compiler
Hello,
I am using cosmic Compiler.
I have this struct:
typedef struct
{
unsigned int IDAC;
unsigned int CANidar0;
unsigned int CANidmr0;
unsigned int CANidar1;
unsigned int CANidmr1;
unsigned int CANidar2;
unsigned int CANidmr2;
unsigned int CANidar3;
unsigned int CANidmr3;
unsigned int CANidar4;
unsigned int CANidmr4;
unsigned int CANidar5;
unsigned int CANidmr5;
unsigned int CANidar6;
unsigned int CANidmr6;
unsigned int CANidar7;
unsigned int CANidmr7;
}FILTER;
Now I wnt to fill the struct like this:
FILTER stConfig;
stConfig=3D
{
0x00, 0xFF, // Filter 0
0x00, 0xFF, // Filter 0
0x00, 0xFF, // Filter 1
0x00, 0xFF, // Filter 1
0x00, 0xFF, // Filter 2
0x00, 0xFF, // Filter 2
0x00, 0xFF, // Filter 3
0x00, 0xFF // Filter 3
};=20
This does not work. I get the error "missing expression" in line "stConfig=
=3D"
Could anybody tell me, what I am doing wrong?
Best regards
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.
(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with struct and Cosmic compiler - Rob Milne - Mar 11 8:58:26 2009
The type holds 17 ints. Your instantiation has only 16.
-rob
f...@yahoo.com wrote:
>
> Hello,
>
> I am using cosmic Compiler.
> I have this struct:
>
> typedef struct
> {
> unsigned int IDAC;
> unsigned int CANidar0;
> unsigned int CANidmr0;
> unsigned int CANidar1;
> unsigned int CANidmr1;
> unsigned int CANidar2;
> unsigned int CANidmr2;
> unsigned int CANidar3;
> unsigned int CANidmr3;
> unsigned int CANidar4;
> unsigned int CANidmr4;
> unsigned int CANidar5;
> unsigned int CANidmr5;
> unsigned int CANidar6;
> unsigned int CANidmr6;
> unsigned int CANidar7;
> unsigned int CANidmr7;
> }FILTER;
>
> Now I wnt to fill the struct like this:
> FILTER stConfig;
> stConfig=
> {
> 0x00, 0xFF, // Filter 0
> 0x00, 0xFF, // Filter 0
> 0x00, 0xFF, // Filter 1
> 0x00, 0xFF, // Filter 1
> 0x00, 0xFF, // Filter 2
> 0x00, 0xFF, // Filter 2
> 0x00, 0xFF, // Filter 3
> 0x00, 0xFF // Filter 3
>
> };
>
> This does not work. I get the error "missing expression" in line
> "stConfig="
>
> Could anybody tell me, what I am doing wrong?
>
> Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem with struct and Cosmic compiler - folg...@yahoo.com - Mar 11 11:20:52 2009
Hello,
thank you very much. It works fine now!
Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )