[Tinyos-help] "UARTOutput" a uint32_t error

Steve McKown rsmckown at yahoo.com
Mon Jan 15 06:56:09 PST 2007


On Thursday 11 January 2007 02:43, Stephen Chow wrote:
>    char OutputMsg[100];
>     sprintf(OutputMsg, "Received Time = %d\r\n", (uint32_t) Ptime);
>
> But the data display on  "hyper terminal" is abnormal such as:
>
> Received Time = 2445
> Received Time = -27399

I guess this would depend on the compiler and library implementation of 
sprintf.  Generally, the token '%d' expects a pointer to a signed integer.  
Based on your comments and output snippet, your compiler may use 16-bit 
integers.  If this is the case, use "%ld" instead of "%d" to tell the sprintf 
routine you are passing a pointer to a long integer instead.


More information about the Tinyos-help mailing list