Introduction to Edsim51
Edsim51 is a widely used simulation software for programming of 8051. This article describes the environment of edsim51 software and a simple program of 8051. To download edsim51 click here
When the edsim51 is opened it looks like
The above picture has several parts
1. Registers and Internal RAM
2. Program section
3. Port connections
4. Sensors and Actuators ( 7 segment display, LCD, Converters, keyboard…. )
Registers and Internal RAM:
The upper part depicts different registers such as general purpose registers ( r0-r7 ) , SFRs. Below part is a memory map of internal RAM which is 128 bytes meaning 128 locations, starting from 0x00, 0x01, 0x02…. 0x0F ( row -1 ) , similarly there are 8 rows ( 8 x 108 = 128 locations ).
Once the program is written, save the program into the PC’s local storage. Program also can be loaded from the memory.
After typing the program, run it.
Check the register values and memory locations.
Click RST to come back to the edit part.
Here all the connections are visible, connections made from port to external devices.
Other peripheral devices:
Here all the components can seen, serial communication and other modules.
Basic Program to ADD two numbers:
To enter any value in the RAM, we have to click on addr box and enter the address where we have to write the numeric values and enter the data number beside it.
Explanations of program:
Org 0 ; This is written so that program stores from 0000 location in program memory or else it would store from random location. start : ; From here program execution starts MOV A, 00H ; move one operand to A register ADD A,02H ; add operand in register and from memory, result will be stored in ACC loop : SJMP loop ; By this instruction ( refer instruction set, execution does not proceed to next address end ; Here program ends
While run time, ROM addresses are specified beside the instruction.
Check PC register, to know the where execution stopped
Check on top of the program to see execution time ( here 1ms and 558micros ).
In this example values of R0 and R1 also changed because R0 is the register stored in 00H location