NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
PIC16F877A PIC16F874ARAM PIC16F877ARAM - Datasheet Archive
MPASM PIC 35 "" 35 #include include #include MPASM "include" PIC MPLAB " C:\Program Files\MPLAB
3.2.3 MPASM PIC 35 "" 35 #include include #include MPASM "include" PIC MPLAB " C:\Program Files\MPLAB IDE\MCHIP_Tools" PIC ".inc" "" 3-01 #include ; PIC16F877A PIC16F877A #include "math.asm" ; 3-01 MPASM MPLAB "" 3-01 "math.asm" math.asm MPLAB 3-01 #include PIC list list list p=16f877a, r=DEC ; PIC16F877A PIC16F877A 3-02 list list _config 2.5 _idlocs PIC _idloc _idloc 0x1234 ; 0x1234 3-03 _config _idloc HEX errorlevel errorlevel Error (Warning) Message HEX 3-14 errorlevel 3-14 01 2 0 3-14 1 3 3-14 "[]" errorlevel "+" "-" errorlevel 0, -302, -305 ; 302 305 errorlevel 1, +305 ; 305 3-04 #define / #undefine #define #define DELAY_TIME 1000 ; DELAY_TIME 1000 #define KEY1 PORTB,7 ; KEY1 PORTB 7 3-05 #define "btfss PORTB,7""btfss KEY1" 3-05 #define KEY1 KEY1 #define #define #define equ equ ""#define #define equ #define MyCount 0x70 ; MyCount 0x70 w_temp equ 0x20 ; w_temp 0x20 count1 equ MyCount ; count1 MyCount ; MyCount 3-06 equ 3-06 w_temp equ #define equ 3-07 w_temp w_temp equ 0x20 ; w_temp 0x20 movlw 0x55 ;W=0x55 movwf w_temp ; W w_temp 0x20 0x55 movf w_temp, w ; w_temp W W=0x55 movwf FSR ; W FSR FSR=0x55 movlw w_temp ; w_temp W W=0x20 movwf FSR ; FSR w_temp FSR=0x20 0x55 3-07 cblock / endc equ equ cblock/endc cblock endc cblock/endc ":"":1" 3-08 cblock 0x20 ; 0x20 w_temp ;w_temp 0x20 status_temp ;status_temp 0x21 buffer:8 ;buffer 0x22 8 var1 ;var1 0x2a var2 ;var2 0x2b endc ; 3-08 cblock equ bank cblock org org 3-09 org 0x0000 ; 0x0000 goto main ; org 0x0004 ; 0x0004 movwf w_temp ; w ;. org Sub1 ; 0x0800 ; page1 page1 return 3-09 org org dt dt PIC "retlw xx" "retlw" "retlw""dt" "retlw" 3-10 addwf PCL,f ;PC dt 0 ;retlw 0 dt Table 1, 2, '3' ;retlw 1 ;retlw 2 ;retlw 0x33 ('3' ASCII ) dt "ABC" ;retlw 'A' ;retlw 'B' ;retlw 'C' 3-10 de de EEPROM EEPROM PIC16F87xPIC16F62x PIC PIC16F7x Flash EEPROM EEPROM EEPROM EEPROM 0x2100 "org""de" EEPROM HEX EEPROM 3-11 org 0x2100 ; ; EEPROM de 0, 1, 2, 3 ;EEPROM [0]=0, [1]=1, [2]=2, [3]=3 de "ABCD" ;[4]=0x41, [5]=0x42, [6]=0x43, [7]=0x44 3-11 3-11 EEPROM 0x00 0x00 0x01 0x02 0x03 0x41 0x42 0x43 0x44 EEPROM 0xff EEPROM MPLAB Microchip "de" EEPROM fill fill fill fill 0x0000, 5 fill (goto $), NEXT_BLOCK-$ ; 5 0x0000(NOP ) ; NEXT_BLOCK ;goto $ org 0x0800 NEXT_BLOCK 3-12 3-12 fill "goto $" "" "goto 0x0000" goto PCLATH PCLATH[4:3] 00 0x0000 PCLATH 0 end end end "end" end 3.2.4 MPASM MPASM MPASM C #define equ $ "$" 3-12 3-13 ; Here goto Here ; Delay decfsz count, f ; 1 0 goto Delay ; ;$ goto $ ; decfsz count, f ; 1 0 goto $-1 ;1 3-13 16 high low 16 8 8 8 PC PCLATH MPASM high low 3-14 ; #define DELAY_TIME .1000 ; movlw low(DELAY_TIME) ; 0xe8 movwf count ; movlw high(DELAY_TIME) ; 0x03 movwf count+1 ; ; PCLATH PC 1.5.2 movlw high(Table) ; movwf PCLATH ; PCLATH movf index,w ; call Table ; 3-14 + - * / "+""-" "*""/" 3-15 ; BPSFosc/(16(X+1) ; X = Fosc/(BPS*16) 1 #define BPS .9600 ; #define Fosc .4000000 ; 4MHz ;. ; movlw Fosc/(BPS*.16) 1 ;.2510 25 movwf SPBRG ; 3-15 #define >> >1 ;W=0x2a movlw xxx