Ralph Riggs

size of byte

Discussion created by Ralph Riggs on Jul 14, 2006
Latest reply on Jul 24, 2006 by CompilerGuru
I am attempting to install another persons files into my portion of the project.
 
He has defined the following 2 sections of code.
 
Section 1 compiles properly
 
section 2 has a problem.
 
I have included the #define statements also.
 
What I think is happening is that the compiler has a problem fitting the high 8 bit define values into the 8 bit byte space since there is no problem with the lower 8 bits.
 
Any ideas/comments?
Bud
 
#defines
#define Bit0  (0x0001)
#define Bit1  (0x0002)
#define Bit2  (0x0004)
#define Bit3  (0x0008)
#define Bit4  (0x0010)
#define Bit5  (0x0020)
#define Bit6  (0x0040)
#define Bit7  (0x0080)
#define Bit8  (0x0100)
#define Bit9  (0x0200)
#define Bit10 (0x0400)
#define Bit11 (0x0800)
#define Bit12 (0x1000)
#define Bit13 (0x2000)
#define Bit14 (0x4000)
#define Bit15 (0x8000)
section 1
/*** DBGCAL - Debug Comparator A Low Register; 0x00001811 ***/
typedef union {
  byte Byte;
  struct {
    byte Bit0        :1;                                       /* Debug Comparator A Bit 0 */
    byte Bit1        :1;                                       /* Debug Comparator A Bit 1 */
    byte Bit2        :1;                                       /* Debug Comparator A Bit 2 */
    byte Bit3        :1;                                       /* Debug Comparator A Bit 3 */
    byte Bit4        :1;                                       /* Debug Comparator A Bit 4 */
    byte Bit5        :1;                                       /* Debug Comparator A Bit 5 */
    byte Bit6        :1;                                       /* Debug Comparator A Bit 6 */
    byte Bit7        :1;                                       /* Debug Comparator A Bit 7 */
  } Bits;
} DBGCALSTR;
section 2
/*** DBGCAH - Debug Comparator A High Register; 0x00001810 ***/
typedef union {
  byte Byte;
  struct {
    byte Bit8        :1;                                       /* Debug Comparator A Bit 8 */
    byte Bit9        :1;                                       /* Debug Comparator A Bit 9 */
    byte Bit10       :1;                                       /* Debug Comparator A Bit 10 */
    byte Bit11       :1;                                       /* Debug Comparator A Bit 11 */
    byte Bit12       :1;                                       /* Debug Comparator A Bit 12 */
    byte Bit13       :1;                                       /* Debug Comparator A Bit 13 */
    byte Bit14       :1;                                       /* Debug Comparator A Bit 14 */
    byte Bit15       :1;                                       /* Debug Comparator A Bit 15 */
  } Bits;
} DBGCAHSTR;
 
The error message is
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3307  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3308  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3308  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3308  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3309  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3309  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3309  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3310  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3310  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3310  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3311  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3311  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3311  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3312  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3312  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3312  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3313  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3313  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3313  
Error   : C1008: Typedef name expected
MC9S08GT16.h line 3314  
Error   : C1007: Type specifier mismatch
MC9S08GT16.h line 3314  
Error   : C2450: Expected:  ~ ( IDENT 
MC9S08GT16.h line 3314  
Error   : Compile failed
Warning : C1420: Result of function-call is ignored
radio.c line 108  
Warning : C1420: Result of function-call is ignored
radio.c line 113  
Warning : C2705: Possible loss of data
radio.c line 559  
 

Outcomes