This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem with #define and debug printing - migrated from other C-compiler and doesn't work on Ti ?

Hi,

I've implemented one bigger project on MPLAB and MCC18 tools from Microchip. Now I'm trying to organize code in similar manner also for 2274 under CCSv4. But there seems to be some relevant differences between those two compilers....

1.I have this :

#define TRACE_PRINT(...)     { sprintf (text_str, __VA_ARGS__); UART_Buf_Pointer=0;    IE2 |= UCA0TXIE; UCA0TXBUF = text_str[UART_Buf_Pointer++]; }

char text_str[200]= { "Hello World\r\n\0" };

and now I've done this under MCC18 and it worked, but doesn't on TI compiler :

            TRACE_PRINT("*** I2C: IO16:STATUS[%d] Starting sending!!\r\n",Current_i2c_io_for_status );

What am I doing wrong ?

 

2. I have this declaration in code :

volatile union FlagBits {                //Receive buffer structure
    unsigned char byte;        //It has to be a bit messy/strict for
    struct {
    unsigned Timeout:1;         //flag to indicate a TMR0 timeout
    unsigned Serial_received:1;         //flag to indicate a 2 secs interval
    unsigned Send_status_nodes2:1;         //flag to indicate a 0.5 secs interval
    unsigned Key_changed:1;         //flag to indicate a key status change on rb4-rb7
    unsigned Send_status:1;         //flag to indicate a key status change on rb4-rb7
    unsigned Send_ADC_status:1;         //flag to indicate a key status change on rb4-rb7
    unsigned Pir_status:1;
    unsigned RC5_received:1;
  } ;
};

and then :

volatile union FlagBits Flags;

and now am trying like this :

    if (Flags.Serial_received == 1)

but doesn't work (union "FlagBits" has no field "Serial_received")

 

I'd kindly ask for some help, advice, pointer to more info ?

Is there some exhaustive reference document for TI C-compiler ? I haven't found it...

 

Thanks in advance,

regards,

Bulek.