[PIC] PIC18F4550 unable to do per-byte addressing (mikroC PRO)

Status
Not open for further replies.
The sprintf function uses variable argument list (va_start,va_arg,va_end...).
It seems that the sprintf pops from the stack 2bytes (0xba, 0xdc, 0x?0, ...) for each %c.
That meens that it thinks that every char has 2 byte width.
It may be an option of the compiler or you may have wrong library version.

Try this code and tell me the results:

Code:
   sprintf(txt,"%c %c %c %c\r\n",(int)a,(int)b,(int)c,(int)d);
 
The sprintf function uses variable argument list (va_start,va_arg,va_end...).
It seems that the sprintf pops from the stack 2bytes (0xba, 0xdc, 0x?0, ...) for each %c.
Embedded C compilers don't necessarily use the stack for passing arguments. It's unlikely particularly for 8-bit PICs due to limited stack space.
 


Thanks. It works. Take a look:


I am not closing the topic because I suspect that I have experienced a similiar issue with the different function, but I don't know more now.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…