1. MPLAB. , 1. , , . .asm.
2. . include, . PIC16F877.inc, , PIC16F877. :
#include P16F877.inc
3. equ, , Dat 0x20 ( , 32):
Dat equ 0x20; 20h
; 1-
4. .
#include p16f877.inc
Dat equ 0x20; Dat = 20h
org 0x000; org
;
goto Start; Start
; goto
org 0x006;
Start: bcf STATUS, RP1; 0
bcf STATUS, RP0;
clrf PORTB;
bsf STATUS, RP0; 1
movlw b'00000000';
movwf TRISB;
bcf STATUS,RP0; 0
movlw 0x0F;
; , W = 0Fh
movwf Dat; Dat
; Dat = W = 0Fh
movf Dat, 0; Dat
movwf PORTB;
clrf Dat; Dat
end; ,
; ,
;
5. Save File . Project Build All, , . , Build completed successfully ( 3.10), , , Build Failed ( 3.11).
, . : , , , , .
3.10 ( )
6. . Reset Run Debug . , (, Reset F6). , 0x00.
|
|
3.11 ( )
7. () Special Function Register Window . , , ( , , ). File Register Window ( 3.12).
8. Run Debug. Step, , ( ). , , , , .
9. RES(F6) Run Debug, PCL(02h-) 00h. STATUS, TRISB, PORTB . (F7), 06h. PCL, PR1(6) PR0(5) STATUS, W, , PORTB(06h-C).
10. Halt.
11. : LAB- \ Lab_Digital \ Mps_2\ \ dat.asm.
3.12
1. , ? ? ?
2. ?
3. ?
4. , MPASM?
5. ?
6. ?
7. :
DAT equ 0x51
movlw DAT
movwf STATUS
3.3 3
ջ
.
. . :
1. , , :
MOVWF STATUS; (W)→(STATUS) MOVF PORTB,W; (PORTB)→(W);
2. , 8- () , :
MOVLW A0h; A0h→(W)
3. , . PIC INDF. INDF , FSR.
|
|
: movlw 21h;
movwf FSR; 21h
clrf INDF;
.