Pages

Saturday, October 30, 2010

8051 Simulator

For many students of TE Comp. Sci. and others too this could be useful, a 8051 simulator. There are many available on internet but many of them don't work. I tried this and it worked well for me.
Download 8051 simulator here
Follow simple steps given in the install.txt file in the download.

After that to make a new project follow these simple steps:-
1. Open keil uvision 3 from startup.

2. Project->New uVision Project

3. Give it a name and save.

4. Select IC Atmel 89C51, looks good for our 8051 simulation. You can choose the one you want, details about it are given on right hand side.

5. Press OK.

6. File->NEW

7. A text file will open. Write your asm code here and save it as ".asm"

8. Add the saved file to the project we just created on the left, using right click and add file. You need to show all files in order to see ".asm" files , the default is ".c" files.
For eg.
MOV R0,#04
MOV A,#01
LABEL:
MOV B,R0
MUL AB
DJNZ R0,LABEL
RET
END
This was my code for Factorial of 4, you can see some changes than what we use to write on kit. a) we have to use label here instead of address for jump
b) register B which has address F0 is also changed on line 4.

9. Project-> Translate Current File
Project-> Build Target File
Project-> Rebuild all Target File
This will show you errors if any in the bottom of the software.

10. Go to debug and press start debugging session.

11. Debug->Run
You can see all the registers changing on the left.
In my program the register 'a' got a value 0x18 i.e 24 .. factorial of 4.

Well this is kinda useful for practicing 8051 extra assignment list. You can explore more.. like while in debugging mode you can see the timer of the micro controller and even SCON and SBUF register values. ( goto peripherals and select what you need).


Still have a doubt feel free to ask a question. Only 8051 related queries please.


No comments:

Post a Comment