Microprocessor and Interfacing 261313 PIC Code Execution II Slides: 19 Download presentation Microprocessor and Interfacing 261313 PIC Code Execution II http: //www. e-cpe. org/moodle Memory Mapped I/O MOVWF W 06 ขอดขอเสยของ Memory Mapped I/O MOVWF 06 MOVWF 21 Slow I/O Operation Fast Mem Operation ถา Memory และ I/O ใช data bus เดยวกน Access ชาลง อาจทำให Memory Machine Code Generation Methods Options n n n Write Machine Code Write Assembly Code Use a High-Level Compiler Writing Machine Code ENIAC Drawbacks of High-Level Compilers n Poor optimization n Non-Optimal Hardware Utilization Poor Optimazation. . . . . 001 A: BSF 03. 5 001 B: CLRF 06 001 C: BCF 03. 5 001 D: MOVF 21, W 001 E: MOVWF 06 while (1) { output_b(i); Poor Optimization Ex 2. . . . . 000 D: MOVLW 05 000 E: BCF 03. 5 000 F: MOVWF 21. . . . . 0010: DECF 21, F. . . . . 0011: MOVF 21, F 0012: BTFSS 03. 2 0013: GOTO 010 int i; i = 5; do { i--; } while (i>0); Non-Optimal HW Utilization RLF Equivalent Program in ASM BCF 03. 5 MOVF 0 x 21, W MOVWF 06 RLF 0 x 21, F GOTO 0 x 1 A File Register Map Status Register (Address 03)