On Fri, 7 Mar 2003 11:35:02 -0500, Mark Stokes wrote:

>I have a macro:
>#define SPITXWAIT   while ( !( IFG1 & UTXIFG0 ) );  // Wait for the TX 
>That is expanding to this:

>    SPITXWAIT;                          // USART0 TX buffer ready?
>    1994:      c2 93 02 00             cmp.b   #0,     &0x0002 
>    1998:      fd 37                   jge     $-4     ;abs dst addr
>0x1994

>Even though this is seeminging to work, why is UTXIFG0 being expanded to
>"#0" instead of "0x80" as it should be.  Here is the macro definitions
>in the header file:
>#define UTXIFG0             (1<<7)

>Try as I might, I cannot get the cmp.b to compare w/ 0x80.  It seems
>stuck on only comparing Zero with IFG1.  This also happens when I use
>something else, like U0TCTL.  Or if I use this macro definition:
>#define SPITXWAIT   while ( !( IFG1 & 0x80 ) );  // Wait for the TX 

>Any ideas?
>-Mark


It is not doing a bit test, it is checking if the value is negative
i.e. if the high order bit of the byte is set

-Bill Knight
R O SoftWare



Reply via email to