Skip to main content

ASM51.EXE assembler

8051 Assembly Language Programming

*The step of Assembly language program are outlines as follows:

1) First we use an editor to type a program, many excellent editors or word processors are available that can be used to create and/or edit the program.
Notice that the editor must be able to produce an ASCII file. For many assemblers, the file names follow the usual DOS conventions, but the source file has the extension “asm“ or “src”, depending on which assembly you are using

2) The “asm” source file containing the program code created in step 1 is fed to an 8051 assembler. The assembler converts the instructions into machine code.

The assembler will produce an object file and a list file. The extension for the object file is “obj” while the extension for the list file is “lst”. 3) Assembler require a third step called linking. The linker program takes one or more object code files and produce an absolute object file with the extension “abs”. This abs file is used by 8051 trainers that have a monitor program

4) Next the “abs” file is fed into a program called “OH” (object to hex converter) which creates a file with extension “hex” that is ready to burn into ROM. This program comes with all 8051 assemblers Recent Windows-based assemblers combine step 2 through 4 into one step

ASM51.exe

The cross assembler ASM51.exe used to create hex files from assembly language programs written on editors like notepad. The ASM51.exe is came from Philips semiconductors bulletin board system(bbs) on the Internet, the software originates from Metalink corporation. ASM51.exe available on Philips bulletin board ftp://ftp.IBSystems.com/pub/Philips-MCU/bbs/ .However now it is not available on this ftp. You can download it from Internet. This DOS based cross assembler supports up to Windows 7 successfully. I will explain how to use this assembler and simulator;
1.Open the notepad and write your 8051 assembly language program.
2.Save the file with extension .ASM in the folder where ASM51.exe contains unless the ASM51 assembler will show "fatal error occurred" during assembling.
3.Open the file ASM51.exe(I emphasize the program and the exe file should be on the same folder)
4.Type the file name on ASM51.exe and hit on enter key
5.If any error, it will indicate the number of errors or else indicate zero errors
6.For finding errors you need to open  the .LST file in notepad created during assembling.
7.If there is any error you need to correct in the .ASM file and again repeat the process from step 3 after editing our erroneous .ASM file using notepad.
8.After completion of programming you will get another file with extension .HEX. Open this file using simulator for simulating it.

Note: You can use any simulator after generating hex file. I can't say which simulator is best. But I will prefer Esimd51 if you have java run time environment on your computer and ASM51.exe is not working on your computer. Since it has its own editor, no hex file generation is required  for Edsim51 and it has following virtual peripherals;
  • Analogue-to-Digital Converter (ADC)
  • Comparator
  • UART
  • 4 Multiplexed 7-segment Displays
  • X 3 Keypad
  • 8 LEDs
  • DC Motor
  • 8 Switches
Digital-to-Analogue Converter (DAC) - displayed on oscilloscope. 
Click here to download EDsim simulator .

Comments

Popular posts from this blog

8051 Simple Programs

Sum of 8-bit Numbers Stored in Memory Here  we will discuss about 8051 programs but we can't discuss about all of the 8051 instructions. For programming 8051 we should know about assembler directives as well as instruction set. Click  here to download Atmel c51 user guide that will discuss about 8051(c51 family microcontroller) instruction set, assembler directives, c51 cross assembler from Atmel.  Program ORG 00H MOV R0,#50H   ; get memory location in memory pointer R0 MOV R1,#51H   ; get memory location on memory pointer register R1 MOV A,@R0       ; get content of memory location 50H to accumulator ADD A,@R1        ; add content of A with content of memory location 51H and store result in A MOV R0,#52H    ; get 52H to memory pointer R0 MOV@R0,A         ; copy content of A to memory location 52H END Add 16-bit Numbers Program ORG 00H MOV DPTR,#2040H   ; get 2040H into DPTR MOV A,#2BH              ; get lower byte of second 16-bit number on accumulator MO

Introduction to 8051 embedded C

For 8051 we need to include the file reg51.h. This file contains the all the definitions of 8051 registers. With this information C compiler produces hex file that can be downloaded into the ROM of the microcontroller. It is important to note that the size of the hex file produced by the assembly language is much larger than the hex file produced by C compiler. Apart from this fact, there is many reasons for writing programs in C instead of assembly: ●It is much easier and less time consuming to write programs in C assembly. ●C is more flexible; it is easier to modify and update. ●Programming in C allows to use code available in function libraries. ●Program written inC for one microcontroller is portable to other microcontrollers with little or no modifications. Data Types in 8051 Embedded C The table shown below lists the data types that are available in typical C51 compiler. The gives information about the size of the data variable and it's value range. Data type

8051 Keyboard Interfacing

Keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and columns through ports. Therefore, with two 8-bit ports, an 8 x 8 matrix of keys can be connected to a microprocessor. When a key is pressed, a row and a column make a contact. Otherwise, there is no connection between rows and columns. In IBM PC keyboards, a single microcontroller takes care of hardware and software interfacing. A 4x4 matrix connected to two ports. The rows are connected to an output port and the columns are connected to an input port. Grounding Rows and reading Columns:- 8051 keyboard interfacing It is the function of the microcontroller to scan the keyboard continuously to detect and identify the key pressed. To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, then it reads the columns. If the data read from columns is D3 – D0 =1111, no key has been pressed and the process continues till key press is detected. If one of t