AnsweredAssumed Answered

Unsigned long int to ASCII conversion  - failed

Question asked by Andrzej Goralczyk on Mar 29, 2011
Latest reply on Apr 5, 2011 by Andrzej Goralczyk

Hi,

 

I'm playing with small project based on JM60 and developed in CW 10.1.

 

Rough description:

uC reads four 8-bit registers from peripherial (HCTL-2032 Quadrature-decoder/counter) connected to rotary encoder and display result on LCD.

 

To this point everything works fine. I can observe register contetnt on LCD  in four groups eg. 255-255-255-255 (B4-B3-B2-B1)

 

Now I'm trying to convert this 8-bit groups to unsigned long int (eg 0xFF FF FF FF) and then to ASCII using :

 

 

unsigned long int result_unsigned_int;

char out_ASCII[11];

 

result_unsigned_int=(BYTE4*0x1000000)+(BYTE3*0x10000)+(BYTE2*0x100)+BYTE1;

sprintf(out, "%lu", result);

WriteStringToLCD(out);

 

 

It works in ordinary c complier on PC but it doesn't in CW - something stucks nothing happens

 

Can you tell me why? (Is there some restricions in sprintf in CW)

 

PS

Of  course I use same WriteStringToLCD() to display other inforation and it works fine....

 

Regards

Outcomes