Micro-processor vs. Micro-controller

Click here to load reader

download Micro-processor vs. Micro-controller

of 18

  • date post

    24-Jan-2016
  • Category

    Documents

  • view

    32
  • download

    0

Embed Size (px)

description

Micro-processor vs. Micro-controller. PIC16F877. 40pin DIP CMOS technology RISC CPU 35 single word instructions DC-20MHz clock DC-200ns instruction cycle. PIC 16F877. Clock/Pipeline. Program Memory/Stack. Instruction Set. W EQU H'0000' ; standard definitions - PowerPoint PPT Presentation

Transcript of Micro-processor vs. Micro-controller

  • Micro-processorvs.Micro-controller

  • PIC16F87740pin DIPCMOS technologyRISC CPU35 single word instructionsDC-20MHz clockDC-200ns instruction cycle

  • PIC 16F877

  • Clock/Pipeline

  • Program Memory/Stack

  • Instruction SetDefault destination

    STATUS Register

    Subtraction (Borrow Flag)W EQU H'0000' ; standard definitionsF EQU H'0001'; ...to avoid having to write numbers

    incf var,W ; W = var + 1, var is unchanged incf var,F ; var = var + 1, W is unchangedaddlw -2sublw 2

  • Bit, Byte, Literal/Control Instruction Formats

  • Tool Chain (MPLAB/CCS)Programming facilitiesPre-processor functionsCode checking/warningPrepared include/library filesDebug without hardwarelimited programming cyclessafety -- bugs may blow equipmentDebug with equipmenton-line view of register values help to track down problems.

  • Lab Exercise:Failing loop test0000 3000 movlw 0x0 0001 008A movwf 0xA 0002 2804 goto MAIN 0003 0000 nop 0004 0184 MAIN clrf 0x4 0005 301F movlw 0x1F 0006 0583 andwf 0x3 0007 3009 movlw 0x9 0008 00A1 movwf 0x21 0009 0AA1 incf 0x21 000A 2809 goto 0x9 000B 0063 sleep #device PIC16F877 *=8 ADC=8void main(){int c;for (c=9;c
  • Working loop test (1)0000 3000 movlw 0x0 0001 008A movwf 0xA 0002 2804 goto MAIN 0003 0000 nop 0004 0184 MAIN clrf 0x4 0005 301F movlw 0x1F 0006 0583 andwf 0x3 0007 3009 movlw 0x9 0008 00A1 movwf 0x21 0009 30FF movlw 0xFF 000A 0221 subwf 0x21,W 000B 1803 btfsc 0x3,0x0 000C 280F goto 0xF 000D 0AA1 incf 0x21 000E 2809 goto 0x9 000F 0063 sleep #device PIC16F877 *=8 ADC=8void main(){int c;for (c=9;c
  • Working loop test (2)0000 3000 movlw 0x0 0001 008A movwf 0xA 0002 2804 goto MAIN 0003 0000 nop 0004 0184 MAIN clrf 0x4 0005 301F movlw 0x1F 0006 0583 andwf 0x3 0007 01A2 clrf 0x22 0008 3009 movlw 0x9 0009 00A1 movwf 0x21 000A 08A2 movf 0x22 000B 1D03 btfss 0x3,0x2 000C 2811 goto 0x11 000D 0AA1 incf 0x21 000E 1903 btfsc 0x3,0x2 000F 0AA2 incf 0x22 0010 280A goto 0xA 0011 0063 sleep #device PIC16F877 *=8 ADC=8void main(){long c;for (c=9;c
  • Another loop Fails#device PIC16F877 *=8 ADC=8void main(){int c;c=9;do{}while (c++
  • While Loop OK!0000 3000 movlw 0x0 0001 008A movwf 0xA 0002 2804 goto MAIN 0003 0000 nop 0004 0184 MAIN clrf 0x4 0005 301F movlw 0x1F 0006 0583 andwf 0x3 0007 3009 movlw 0x9 0008 00A1 movwf 0x21 0009 0821 movf 0x21,W 000A 0AA1 incf 0x21 000B 00F7 movwf 0x77 000C 0A77 incf 0x77,W 000D 1D03 btfss 0x3,0x2 000E 2809 goto 0x9 000F 0063 sleep #device PIC16F877 *=8 ADC=8void main(){int c;c=9;do { } while (c++!=255);}