Discussion in "Software" started by    Persian    Mar 29, 2009.
Sun Mar 29 2009, 09:58 pm
#1
Hello
Hope everyone is ok.
I have a program in assembly and i will need to add comments to it, i have left coment line by line but i dono wat does te over all section does.
I'd appriciate if some1 could help plz.
thnx

Sun Mar 29 2009, 10:26 pm
#2
Edited


[ Edited Mon Mar 30 2009, 11:31 am ]
Mon Mar 30 2009, 05:10 am
#3
The 8051 has several key characteristics.

Firstly,
After a reset signal, the microcontroller will start executing instructions from address 0000h - this notation is referred to as hexidecimal.

Your first statement is: ORG 0000h, which can be thought of as ORIGIN. You are telling the linker that the next line of code should be located at address 0000h, and this is often referred to as the "power on vector location"

so, what is the first instruction? It is SJMP OVER

SJMP is referred to as a "short jump", and you are telling the microcontroller to jump to the label "OVER". Now your example code above doesn't have this label shown, but it would occur somewhere later and look like this

OVER:

Hopefully this explains the first two lines of code...

Secondly, the 8051 has 5 standard interrupt vectors, and they are as follows:

Source Vector Address
IE0 0003H
TF0 000BH
IE1 0013H
TF1 001BH
RI+TI 0023H



Basically, this means that whenever an interrupt occurs, depending on which one it is, the microcontroller will start executing instructions from a specific address. Take for example, if the interrupt source is IE0. The microcontroller will "jump" to address 0003h and start executing the instructions there...

If you look at your source code, you can see that the instruction that will be executed at address 0003h is RETI.

Why? because you have the ORG 0003h instruction to the linker, which tells it that the next instruction is suppose to be located at address 0003h, and what is the next instruction? RETI

In fact, you have the same instruction for all of the 5 interrupt vector addresses, which simply means that if ever you get an interrupt, you will just return to whatever you were doing prior to the interrupt, essentially ignoring it...

If you'd like to learn more about the fundimentals of the 8051 microcontroller, I suggest you do some reading.

Here are some links to start with...

http://www.nxp.com/acrobat_download/various/80C51_FAM_HARDWARE_1.pdf

http://www.nxp.com/acrobat_download/various/80C51_FAM_ARCH_1.pdf

http://www.nxp.com/acrobat_download/various/80C51_FAM_PROG_GUIDE_1.pdf

I hope this helps,
 Persian like this.
Mon Mar 30 2009, 05:17 pm
#4
	        clr 00h				 
	        cpl 00h				   


What does this mean?
Tue Mar 31 2009, 01:15 am
#5


	        clr 00h				 
	        cpl 00h				   


What does this mean?

Persian


If you are serious about programming you will have to learn your
micro's instruction set.

These are simple instructions and easy to look up.




 Persian like this.
Tue Mar 31 2009, 01:23 am
#6
Ok I have looked it up and it says:

Clear bit
Complement bit

So does this mean that it is trying to clear the 00h bit in the Data RAM ?
Tue Mar 31 2009, 01:23 am
#7
it means you haven't read the links I gave you, otherwise you would know...

In order to learn, one must be willing. In order to understand, one must study...

Try reading the last link from my previous post. If you don't understand what you have read, perhaps I can help you with that...

 Persian like this.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

AntoniaRoons
Fri Apr 19 2024, 09:59 pm
carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am