1 / 20

PIC Controller

PIC Controller. Instruction format. RISC (Reduced Instruction Set Computing) or ‘Risk’. Is a CPU design method that gives an instruction set reduced both in size and complexity of addressing modes . Every small operation needs an instruction.

joella
Download Presentation

PIC Controller

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PIC Controller Instruction format

  2. RISC (Reduced Instruction Set Computing) or ‘Risk’ • Is a CPU design method that gives an instruction set reduced both in size and complexity of addressing modes. • Every small operation needs an instruction. • Load data from memory to working register, Add some data, Store the data in to memory – needs 3 instructions. • Ex. ARM, PIC, AVR, SPARC, etc.

  3. CISC (Complex Instruction Set Computing) or ‘Sisk’ • Is a microprocessor architecture that gives an instruction set which can execute many low level operations. • Load data from memory to working register, Arithmetic/Logical operation, Store data into memory – can be done in 1 instruction. • Ex. Intel, AMD, Motorola, etc.

  4. Introduction • Instructions do data transfer between the data memory [SFR (control/configuration registers), GPR, repetitive registers] and working register (W). • Instructions do Arithmetic, logical operations on the data. • Instruction can check the status of each operation and decide the next operation using the status register.

  5. Working Register (Accumulator) • Whenever a double operand instruction is executed, one operand comes from the instruction or from a register. The other operand comes from a register called working register. • This is a special register in CPU (not a part of data memory) • This is the default destination for any instruction.

  6. StatusRegister

  7. StatusRegister

  8. Introduction • Each instruction is 14 bit wide • Opcode • Specifies instruction type • One or two operands • Specifies operation of instruction • Three basic categories • Byte oriented • Bit oriented • Literal and control operations

  9. Instruction Formats

  10. OPCODE Field Descriptions

  11. Byte Oriented Operations

  12. Instructions

  13. Assembly Language • Each instruction typically consists of an operation or opcode plus zero or more operands. • A label can be specified before each instruction. • Labels are case sensitive and start with an alphabetic or underscore character only.

  14. Assembly Language • The instructions must be written in proper case. The MPASM is case sensitive. • All function registers and their bits are specified in upper case, because upper case is used in the included PIC file. • Use comment for every instruction.

  15. Assembly Language • Sample Instruction: NEXTMOVFFSR,W;move the contents of FSR to W. • ‘NEXT’ is called the Label. • ‘MOVF’ is called the Mnemonic. • ‘FSR,W’ are called the Operands. • ‘;move thecontents….’ is the Comment.

  16. Assembly Language • Sample Instruction: _OP1IORLW0xFF;Inclusive OR the contents of W with 1111 1111. • ‘_OP1’ is called the Label. • ‘IORLW’ is called the Mnemonic. • ‘0xFF’ are called the Operands. • ‘;InclusiveOR the….’ is the Comment.

  17. Assembler Directives • An assembler directive is a command given to an assembler. • Looks like assembly instructions • These directives may do anything from telling the assembler to include other source files, to allocate memory for constant data, etc. • Specific for each assembler software • Ex: RIGHTEQU1;equ is an assembler directive.

  18. Program Structure: • All programs must have the following structure. List p=16f877A ; List directive mentioning the PIC ; Microcontroller part number #include‘C:\my_name\pic_lab\P16f877A.inc’ ; file having standard definitions of SFR’s of this PIC ORG 0x20 ; The address 0x20 at which the ; next instruction 'goto' will be stored GOTO start ; Go to the beginning of main program start --------------------------- ;Program Logic --------------------------- ;Program Logic END

More Related