Skip to content

Latest commit

 

History

History
127 lines (120 loc) · 5.88 KB

Midterm Exam Keynote.md

File metadata and controls

127 lines (120 loc) · 5.88 KB

Microcontrollers:

  • Microprocessors, such as 8086 family, have only CCU and ALU in them. External RAM, ROM, and I/O are required.
  • Microcontrollers, such as 8051 family, encompass CCU, ALU, RAM, ROM, and I/O in a single chip.
  • Microcontrollers have limited computational power, but their low-cost make them prevalent in comsumer products and small-scale control systems.

Features:

  • 8-bit CPU optimized for control applications
  • 128 bytes of on-chip Data RAM, 4K bytes of on-chip Program Memory (Flash Memory/ROM)
  • 64K Program Memory address space, 64K Data Memory address space
  • 32 bidirectional and individually addressable I/O lines
  • Two 16-bit timer/counters
  • Full duplex programmable UART
  • 6-source/5-vector interrupt structure with two priority levels

Pin Configurations:

  • Pin Configurations
  • Vcc, GND: supply voltage (5V), ground
  • XTAL1, XTAL2: crystal connections for system clock
  • RST: reset input
  • EA: External Access, EA=5V to enable internal ROM.
  • P0.0~P0.7: Port 0, bidirectional bit-addressable with open drain
  • P1.0~P1.7: Port 1, bidirectional bit-addressable with internal pullups
  • P2.0~P2.7: Port 2, bidirectional bit-addressable with internal pullups
  • P3.0~P3.7: Port 3, bidirectional bit-addressable with internal pullups
  • Alternative Functions of Port 3
  • PSEN: Program Store Enable, read strobe for external program memory
  • ALE: Address Latch Enable, for multiplexing AD0~AD7
  • A8A15(P2.0P2.7): high-byte address bus for external addressing
  • AD0AD7(P0.0P0.7): multiplexed low-byte address bus and data bus for external addressing

Special Function Registers:

  • ACC: Accumulator
  • B: B Register
  • SP: Stack Pointer
  • DPTR(DPH,DPL): Data Pointer
  • P0: Port 0
  • P1: Port 1
  • P2: Port 2
  • P3: Port 3
  • TH0: Timer/Counter 0 High Byte
  • TL0: Timer/Counter 0 Low Byte
  • TH1: Timer/Counter 1 High Byte
  • TL1: Timer/Counter 1 Low Byte
  • SBUF: Serial Data Buffer
  • PWS: Program Status Word
  • PCON: Power Control Register
  • IE: Interrupt Enable Register
  • IP: Interrupt Priority Register
  • TCON: Timer/Counter Control Register
  • TMOD: Timer/Counter Mode Control Register
  • SCON: Serial Port Control Register
  • PC: Program Counter

Interrupt Mechanism:

Addressing Mode:

  • Immediate: MOV A,#20h
  • Register: MOV A,R0
  • Direct: MOV A,30h
  • Indirect: MOV A,@R0
  • External Data Indirect: MOVX A,@DPTR
  • Code Indirect: MOVC A,@A+DPTR

8051 Development Tools:

  • Assembler (ASEM-51)
    • An assembler is a program which creates object code by translating combinations of mnemonics and syntax for operations and addressing modes into their numerical equivalents.
  • Simulator (JSIM-51, Emulator 8051, Emily 8051/8052)
    • 8051 Microcontroller Simulator is one such application which through a simple and well organized interface offers the necessary tools and functions for emulating a physical microprocessor at work.
  • Programmer
    • USB programmer to burn AT89S series 8051 microcontroller through USBasp.
  • In-Circuit-Debugger (NoICE Remote Debugger)
    • With NoICE Remote Debugger, a monitor "MON8051.HEX" is programmed into ROM, which is controlled by "NoICE51.EXE" (running on PC) via RS232 to debug user program loaded into RAM.
  • Disassembler (DIS8051 Cross-Disassembler)
    • A disassembler is a computer program that translates machine language into assembly language—the inverse operation to that of an assembler.
  • Editor (MIDE-51 Studio, Crimson Editor, MCU 8051 IDE)
    • MCU 8051 IDE is a free software integrated development environment for microcontrollers based on 8051. MCU 8051 IDE has its own simulator and assembler (support for some external assemblers is also available). This IDE supports 2 programming languages: C and Assembly language. For C language it uses SDCC.
    • Advanced text editor with syntax highlighting and validation.
  • Terminal Emulator (Tera Term Pro)
    • RS232 Emulator

Alphabetical List of Instructions (OPcodes):

  • ACALL - Absolute Call
  • ADD, ADDC - Add Accumulator (With Carry)
  • AJMP - Absolute Jump
  • ANL - Bitwise AND
  • CJNE - Compare and Jump if Not Equal
  • CLR - Clear Register
  • CPL - Complement Register
  • DA - Decimal Adjust
  • DEC - Decrement Register
  • DIV - Divide Accumulator by B
  • DJNZ - Decrement Register and Jump if Not Zero
  • INC - Increment Register
  • JB - Jump if Bit Set
  • JBC - Jump if Bit Set and Clear Bit
  • JC - Jump if Carry Set
  • JMP - Jump to Address
  • JNB - Jump if Bit Not Set
  • JNC - Jump if Carry Not Set
  • JNZ - Jump if Accumulator Not Zero
  • JZ - Jump if Accumulator Zero
  • LCALL - Long Call
  • LJMP - Long Jump
  • MOV - Move Memory
  • MOVC - Move Code Memory
  • MOVX - Move Extended Memory
  • MUL - Multiply Accumulator by B
  • NOP - No Operation
  • ORL - Bitwise OR
  • POP - Pop Value From Stack
  • PUSH - Push Value Onto Stack
  • RET - Return From Subroutine
  • RETI - Return From Interrupt
  • RL - Rotate Accumulator Left
  • RLC - Rotate Accumulator Left Through Carry
  • RR - Rotate Accumulator Right
  • RRC - Rotate Accumulator Right Through Carry
  • SETB - Set Bit
  • SJMP - Short Jump
  • SUBB - Subtract From Accumulator With Borrow
  • SWAP - Swap Accumulator Nibbles
  • XCH - Exchange Bytes
  • XCHD - Exchange Digits
  • XRL - Bitwise Exclusive OR