Hi everybody I want to test the speed of my algorithm. I'm setting the values in asm, and doing the printf and defining my array in C to get a valid register value. I want the array to be in memory. But when I change a value in asm, the values of array in C does not change. Here is my code:
asm code: mov a,#11 ...
C code: static char polyside[20] asm("a")={0}; printf_xy(10,10,"%d",polyside[0]); ...
and it dosen't show up in the print function. Can somebody show me how to do this?Thx
You didn't read the instructions for posting source code, did you? www.danlhenry.com/.../keil_code.png
You also haven't stated what toolset you're using - so it's impossible to answer your question, because it will depend entirely on what you're using!
Have you read the relevant section(s) in your manual(s) about interfacing 'C' to assembler...?
Hi Andy Niel and Thanks for your answer.
At the start I write code on a POC to test the code and make it fast and then i Go to a C51 so i Want to make all dificult jobs on the POC and then move working code to the board.
What is a "POC"?!
POC is what we here call the simulator enviroment. it is for Proof Of Concept.
Never assume that outsiders will automagically recognise your internal terminology and/or abbreviations!
Whatever your target ("POC", target PCB, etc) you still need to state what Toolset you're using to build the code!
And you still need to start by reading the relevant section(s) in your manual(s) about interfacing 'C' to assembler....
Hello again Andi,
the POC is using visual c++ 2007 but i dont kno wwhat the baord is yet.
Visual C++ is an entirely different compiler for an entirely different target architecture - any "optimisation" you do on this will almost certainly be irrelevant to any 8051-based target - and possibly even counter-productive!
You can use it to test that your algorithms produce correct results, but it will tell you absolutely nothing about your target's performance.
There is no point in even thinking about optimisation here!
"i Want to make all dificult jobs on the POC and then move working code to the board."
Your most difficult job in that approach is likely to be re-writing code that worked in VC into something appropriate to an 8051!
A far better approach, if you must start with simulation, would be to use the uVision simulator or perhaps some 3rd-party simulator that actually simulates an 8051
yeuch
Sorry, but optimisation and portability are almost always mutually exclusive!