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 am a computer engineering student using Microvison2. I am trying to create a small program that uses an sjmp loop comand but I don't know how to make labels in the software. Any help would be greatly appreciated.
The Manual?
I have looked in the manual and cannot find what I am looking for.
I have looked in the manual and cannot find what I am looking for. There is more than one manual. Which manual did you look in? The "Macro Assembler and Utilities" manual (a51.pdf) describes the (Keil) assembler syntax relatively well.
If you are using an SJMP, then you are programming in assembly language.<br> Open the "Macro Assembler and Utilities" manual. <br> Look in the index.<br> On page 440, it says "Labels.....73"<br> On page 73, labels are fully described.
First of all thank you. I was looking in the C51 manual. I understand how to use labels. The problem I am having is entering them in. I am unfamiliar with this software so bear with me. <br><br> <br><br> I am entering in all my code in at the command line. My code looks something like this. <br><br> <br><br>
mov P1,#10010011 loop: mov c, P1.0 cpl c andl c, P1.1 orl c, P1.7 mov P1.4, c sjmp loop END
asm mov P1,#10010011
asm Loop: mov c, P1.0 Loop: asm asm [loop:] mov c, P1.0 loop:
If you are really keen to write assembly language, the path of least resistance is to write an assembly language module explicitly and avoid coding it in in-line assembly. Use the SRC option to build an assembly language template if you must.
Ahhh, so you are trying to embed some assembly language in a C program. (Hint, supply more information in future). I haven't tried it in the Keil C, but this works in Borland C: ======================= asm mov P1,#10010011 loop: asm mov c, P1.0 asm cpl c asm andl c, P1.1 asm orl c, P1.7 asm mov P1.4, c asm sjmp loop ======================= i.e. the label is just a C statement, it is not ASM'ed.
I am not trying to embed it in a C program. What you saw was pretty much all my code. My teacher wants us to write a program in-line (he didn't show us any other way) That is why I am having so much trouble. I know of another assembly program. He said he wants the listing file and the hex file. I know of a unix compiler that I can use. I need to play with microvision some more and hopefully figure out how to bypass the in-line compiler. By the way loop: as a command is not valid. I would really like to thank you for all the help you guys have provided me.
"My teacher wants us to write a program in-line (he didn't show us any other way)"<br> <br> Talk to him!