Hi!
Can you please tell me what is wrong in here:
/* An example from Cx51 userÂ's guide */ #include<stdio.h> #include<float.h> void main(void) { code char buf[100]; int n; int a,b; float pi; a = 123; b = 456; pi = 3.14159; n = sprintf(buf, "%f", 1.1); }
It builds fine but when I start debugging the program throws me into disassembly window after first step. And nothing happens.
I need the sprintf function in my own project, and obviously, it doesnÂ't work in it. so I tried it in this simpler code and it doesnÂ't work here either.
Regards Aki
code char buf[100];
How do you suppose that an 8051 is going to write to CODE space...?!
True, my bad! But fixing it for example to
char buf[32];
wonÂ't be much of help. And after consulting the manual very thoroughly I canÂ't understand why it doesnÂ't debug.
"won't be much of help."
I don't agree with that prediction.
"why it doesn't debug."
What does that mean?
I agree with Dan. You must explain your problem before asking a question. About entering the assembly window, anytime you attempt to step into a routine that does not have a symbol table connection with the source, you will enter the assembly window. Since you do not have the source code of the sprintf library call, you will enter the assembly window.
Problem was/is that after I inserted sprintf function in the code I found myself in dissassembly window after first step.
#pragma SYMBOLS #include<AT898252.h> #include<stdlib.h> #include<float.h> #include<stdio.h> Init(); char tulos[32]; void main() { sprintf(tulos,"%f",20.0); Init(); } Init() { ... }
Code was basically like that. I noticed that sprintf consumes more than 2k of space! Is the answer to my problem that I overlap the evaluation versions 2k code size limit?
" Is the answer to my problem that I overlap the evaluation versions 2k code size limit?"
Also, the Evaluation version doesn't support floating point