We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I would like to us the ARRAY: DS 5 to set up the array in ASSEMBLY.But I don't know how to access the array,can someone help me?
A "DS 5" is not by any means an "array". It's just 5 bytes of space in what ever memoryspace you defined it in. Generally, to access *anything* from an assembly program, you have to give it a name, i.e. a "label":
myNameForThisThing: DS 5
mov DPTR, #myNameForThisThing movx A, @DPTR ; ... inc DPTR movx A, @DPTR ;...
OK,I got it. But I want to use it as a buffer, for example,I have a massage_data: db '01234567890' and I name the label as number_array: DS 5 if I want to pick up some numbers from massage_data and mov it to number_array,can I do that?and how to define the number_array: to be located at the DATA memory section.Thanks a lot!
[You really should sit down and learn some assembly from the books, tutorials and example programs --- that'd get you somewhere a lot faster than asking every question here.] On an 8051, how to move data from one place to the other depends on where both those places are, memory-wise. You don't say, so it's hard to advise. You place your memory reserved by DS in DATA memory by having that statement itself in a section of your assembler source that is marked as belonging to a segment that goes to data memory. For details, please do yourself a favour and read the manuals. That's what they are being made for, see?
Yes,I am with you. And thanks for your advise.I did read the manul,but you know ,the manual explain those words that are supported by the compiler,not the way to use these commands together to create the functions you need. Of course I understand if someone wants to learn something,he has to read and try,but it takes time,that's the only thing I don't have. Actually I have done what I need in C. But it can only work on the ICE not on the micro controller,I had tried for a long time to solve this problem,but in vain.So I have to reprogram everything in assembly.The experience I have in assembly is for PC,and you know,it doesn't fit in 8051.I know what you think of me,a lazy guy ,not study hard enough,and still want more.yah.I am with you and sorry for this,anyway,thanks for your help!
...Actually I have done what I need in C. But it can only work on the ICE not on the micro controller... Why not? Jon
I don't know,I guess it's the memory control. The memory space was full in DATA and even idata, I have tried to control the memory by myself not by the compiler,it worked better but still hang up somewhere.I tried to use the scope to find out where and why has something wrong,but I still could not tell why. And I was thinking I would rather write it again in assembly than debug the whole system.even it's a couple thoundsand lines program, was I right?
"Actually I have done what I need in C. But it can only work on the ICE not on the micro controller" Do you mean ICE, or simulator? Sounds like you have something wrong with your 'C' startup code. Have you checked everything in your startup.a51, and your uVision Project settings? In particular, do all your memory settings match the target hardware? Does your target hardware require some setup which is being done autonomously by the ICE, but you need to code manually for when the ICE is not present? (remember that the uVision project settings simply inform the tools - they do not generate any code which may be necessary to enable those features on your target hardware!)
It's the simulator. I have checked the startup setting ,but I can't tell there is anything wrong with that.I think it's the memory problem,I found that all the DATA and IDATA section are full,and my target board doesn't support the other memory type,I did try to setup the variables that I defined in the program,pity!I still can't change the situation I am facing.I have checked this problem with the simulator provider and KEIL C distributor in Taiwan,They also have no solution for this. So I think it should be my fault,that's why I want to use assembly to rewrite my code. BTW,I have found the way to solve my problem about the array issue.you did give me some ideas to get over this,thanks a lot ,I mean it.
You write it takes time,that's the only thing I don't have, but also you will reprogram everything in assembly Well --- you may not be aware of it, but these two statements are pretty strict contradictions to each other. Even more so if you don't have significant hands-on experience with assembler programming so far. If you're pressed for programmer time, rather than program execution speed, it's almost a certainty that going to assembler language is not going to solve your problem.
Have you read Application Note 101? http://www.keil.com/appnotes/docs/apnt_101.asp Jon
Kindly ypo respond me at my personal emailaddress nasirsadiq@msn.com nasirsadiq@email.com
"Kindly ypo respond me at my personal emailaddress" But what is your question? Stefan
"But what is your question?" It's probably an invitation to receive boundless quantities of email with irresistible offers on recreational and performance-enhancing pharmaceuticals, stock quotes, pictures of people with their clothes off, opportunities to share in the proceeds of multi-million dollar frauds, etc, etc, etc, etc,.....
"It's probably an invitation to receive boundless quantities of email with irresistible offers on recreational and performance-enhancing pharmaceuticals, stock quotes, pictures of people with their clothes off, opportunities to share in the proceeds of multi-million dollar frauds, etc, etc, etc, etc,....." And I'm sitting here hammering in code instead of having all that fun? Sign me up! Stefan
"Sign me up!" OK, the next time that nice man from Nigeria sends me his kind offer of a share in his country's missing oil millions, I'll pass you the details...