hi i am using keil uVision3. i have written a simple code in assemply language which contains jump instructions like sjmp,jnz jb . when i generate the hex file from this asm file all the other values in the hex file are correct except for the jump addresses corresponding to these instructions
my asm file is as follows
reset: ljmp start nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop start: mov A,#00h -- mov P0,#0ffh -- mov P1,#0ffh -- jb p1.0,jump1 jump1: jnz jump2 -- mov a,P0 -- mov R0,a -- mov a,#00h -- inc a -- ret jump2: mov a,P0 -- mov R1,a -- sjmp jump3 -- ret jump3: mov A,R1 -- add A,R0 -- mov P0,A -- clr P1.2 -- setb P1.2 -- clr P1.2 -- ret -- end
(i have used "--" for formatting this msg its not part of actual .asm file ) and the hex file i get is like this
:1000000002001D00000000000000000000000000D1 :1000100000000000000000000000000000740075F7 :1000200080FF7590FF2090007007E580F874000451 :1000300022E580F9800122E928F580C292D292C29D :0200400092220A :00000001FF
here u can see that hex corresponding to jb is 20 (3rd line) after that address of port p1.0 which is 90 but the address that it should jump comes out to be 00 which is incorrect. the address should be 28(hex)
{you can calculate the address by writting one byte per line or generate a dua file from the hex file}
please tell me if i am missing out on something.......and tell me how to generate a correct hex file
sir,
i have checked the data sheets and found out that the 3rd byte should be the jump address of instruction stored in rom when condition is met.
sir are you an employee of arm or someone who is part a of uVision team ? if not then some seniors or experts please reply ..
the hex corresponding to the first jump LJMP works as after reset the program jumps to location start which is evident from the hex file . but for instructions JB and JNZ the correct addresses are not generated properly
i have checked the data sheets and found out that the 3rd byte should be the jump address of instruction stored in rom when condition is met. incorrect
WHY do you refuse to work with chapter 2 of "the bible" instead of making incorrect statementsin the forum.
Erik
found out that the 3rd byte should be the jump address of instruction stored in rom when condition is met.
You found out incorrectly, then. I'll give you a hint: you found something called 'raddr' in your description before. What do you think that spurious 'r' before 'addr' might be about?
but for instructions JB and JNZ the correct addresses are not generated properly
You're still every bit as incorrect about that as you've been days ago.
I'm not entirely sure why there's so much hostility in this thread.
The "bible" Erik is referring to can be found here (he was nice enough to point me that direction with a problem I had in another thread):
www.8052.com/.../120112
As he mentioned, it gives information regarding the jump commands in chapter 2. If you read that portion, it should give you some insight on what the problem could be. I hope this helps!
I'm not entirely sure why there's so much hostility in this thread. I would not know about that, butwhen soneone post i have made 8051 core in vhdl and am prototyping it to xilinx fpga and show that (s)he has not even taken the time to understand the instruction set of the processor (s)he is synthesizing, "politically correct" responses is not to be expected. Especially when the post is not "I do not understand", but "incorrect hex generation from keil"
It is a relative address, Not absolute.
I have realized my mistake. and the core is working fine
I do understand that the title of the post was a little offensive specially to those who have designed the compiler. i will be careful in choosing title in future.
i am a student so i am used to a little admonishing but i appreciate the fact that seniors came out to help me and that is what really matters.
for others go through the docs carefully
jb b,raddr
raddr is the relative address here its 00000000 which then gets added to the program counter plus 1 to generate the rom address.
that's YOUR job
heve you even downloaded chapter 2? much more explicit that any datasheet
I think what he's saying is to anyone else that might read through this post, his advice is to go through the documents carefully. I don't think he's directing that at anyone in particular. In fact, I think he's confirming what you've been telling him.
one could easily see that the so called seniors are very rude. this guy might be wrong with the title of his post but than this is what he probably thought. Just because you know something doesn't mean that you have to be rude to others as it must have taken long time for you guys to learn.i didn't see any straight answers or clear reference to anything that these guys have given.
be nice to newbies as once you were also one
one could easily see that the so called seniors are very rude. There is, today an expectation that every statement is wrapped in pink cotton.
e.g. I posted "WHY do you refuse to work with chapter 2 of "the bible" instead of making incorrect statementsin the forum" instead of posting "I will gladly read the manual for you, find the relavant paragraph and quote it here, please come back when you need me to read the manual for you again"
if thst is what is supposed to be posted to not be "rude" expect rudeness (as you define it).