List out addressing Modes in MCS-51
- Direct Addressing
- Register Addressing
- Register Indirect Addressing
- Implicit Addressing
- Immediate Addressing
- Index Addressing
How much total external data memory that can be interfaced to the 8051?
64K data memory
What is Special Function Registers (SFR)?
The memory addresses from 80H to 0FFH are called SFR. These are 128 bytes registers specially designed for interrupts and few other operations.
Give example of bit address and byte address?
Example: bit address 87h –> byte address 80h, bit #7
What are the types of interrupts in 8051?
- External interrupt 0 (IE0) has highest priority among interrupts.
- Timer interrupt 0 (TF0)
- External interrupt 1 (IE1)
- Timer interrupt 1 (TF1) has lowest priority among other interrupts.
- Serial port Interrupt
- Reset.
What are the four distinct types of memory in 8051?
- Internal RAM
- Special function registers
- Program memory
- External data memory
Internal RAM is located from address 0x00 to ___?
Internal RAM in 8051 is located from address 0 to address 0xFF. IRAM from 0x00 to 0x7F can be accessed directly. IRAM from 0x80 to 0xFF must be accessed indirectly.
Tell the addresses which are bit addressable?
The bit addressable memory in 8051 is compose from 210 bits: bit address space: 20H – 2FH bytes RAM = 00H – 7FH bits address, SFR registers.
Write a program to toggle all bits of P1 every 200ms.
MOV A,#55H AGAIN: MOV P1,A ACALL DELAY CPL A SJMP AGAIN DELAY: MOV R5,#9 HERE1: MOV R4,#242 HERE2: MOV R3,#255 HERE3: DJNZ R3,HERE3 DJNZ R4,HERE2 DJNZ R5,HERE1 RET
Here the delay produced is 9*255*4MC*90=199,940 micro seconds.
- CPL is used to toggle the bits of P1.
- Short jump is just to produce a continuous loop.
What is lst file?
- This file is also called as list file.
- It lists the opcodes, addresses and errors detected by the assembler.
- List file is produced only when indicated by the user.
- It can be accessed by an editor and displayed on monitor screen or printed.
Programmer uses this file to find the syntax errors and later fix them.
How is a program executed’ bit by bit’ or’ byte by byte’?
EXAMPLE
ADDRESS | OPCODE | PROGRAM |
1 0000 | ORG 0H | |
2 0000 | 7D25 | MOV R5,#25H |
3 0002 | 7F34 | MOV R7,#34H |
4 0004 | 2D | ADD A, R5 |
5 0005 | END |
- A program is always executed byte by byte.
- Firstly, 1st opcode 7D is fetched from location 0000 and then the value 25 is fetched from 0001.
- 25 is then placed in the register R5 and program counter is incremented to point 0002.
- On execution of opcode 7F, value 34 is copied to register R7.
- Then addition of contents of R5 and accumulator takes place.
- Here all the opcodes are 8 bit forming a byte
Explain DB.
- DB is called as define byte used as a directive in the assembler.
- It is used to define the 8 bit data in binary, hexadecimal or decimal formats.
- It is the only directive that can be used to define ASCII strings larger than two characters.
- DB is also used to allocate memory in byte sized chunks.
- The assembler always converts the numbers into hexadecimal.
What is EQU?
- EQU is the equate assembler directive used to define a constant without occupying a memory location.
- It associates a constant value with data label.
- Whenever the label appears in the program, constant value is substituted for label.
- Advantage: The constant value occurring at various positions in a program can be changed at once using this directive.
- Syntax: label EQU constant value
How are labels named in assembly language?
- Label name should be unique and must contain alphabetic letters in both uppercase and lowercase.
- 1st letter should always be an alphabetic letter.
- It can also use digits and special characters?,.,@,_,$.
- Label should not be one of the reserved words in assembly language.
- These labels make the program much easier to read and maintain.