1 / 18

Micro-processor vs. Micro-controller

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

kin
Télécharger la présentation

Micro-processor vs. Micro-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. Micro-processorvs.Micro-controller

  2. PIC16F877 • 40pin DIP • CMOS technology • RISC CPU • 35 single word instructions • DC-20MHz clock • DC-200ns instruction cycle

  3. PIC 16F877

  4. Clock/Pipeline

  5. Program Memory/Stack

  6. Instruction Set W EQU H'0000' ; standard definitions F 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 unchanged • Default destination • STATUS Register • Subtraction (Borrow Flag) addlw -2 sublw 2

  7. Bit, Byte, Literal/Control Instruction Formats

  8. Tool Chain (MPLAB/CCS) • Programming facilities • Pre-processor functions • Code checking/warning • Prepared include/library files • Debug without hardware • limited programming cycles • safety -- bugs may blow equipment • Debug with equipment • on-line view of register values help to track down problems.

  9. Lab Exercise:Failing loop test #device PIC16F877 *=8 ADC=8 void main() { int c; for (c=9;c<=255;c++); } 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 0AA1 incf 0x21 000A 2809 goto 0x9 000B 0063 sleep

  10. Working loop test (1) #device PIC16F877 *=8 ADC=8 void main() { int c; for (c=9;c<=254;c++); } 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

  11. Working loop test (2) #device PIC16F877 *=8 ADC=8 void main() { long c; for (c=9;c<=255;c++); } 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

  12. Another loop Fails #device PIC16F877 *=8 ADC=8 void main() { int c; c=9; do{}while (c++ <= 255); } 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 2809 goto 0x9 000A 0063 sleep

  13. While Loop OK! #device PIC16F877 *=8 ADC=8 void main() { int c; c=9; do { } while (c++!=255); } 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

More Related