Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 #include 16C84.INC
                      00001 ;
                      00002 ; Definice registru a zakladnich maker pro 16C84
                      00003 ;
                      00004                 processor       16f84
                      00005                 radix   D
                      00006 
0000                  00007 __16C84__:      ; Priznak modulu 16C84
                      00008 
                      00009 ; Definice registru
                      00010 
  00000000            00011 IND0            equ     00H     ; 0&1 Pristup na neprimou adresu
  00000001            00012 TMR0            equ     01H     ; 0   Real Time clock counter
  00000002            00013 PCL             equ     02H     ; 0&1 Spodni cast PC
  00000003            00014 STATUS          equ     03H     ; 0&1 Stavove bity
  00000000            00015 _CARRY                          equ     0
  00000001            00016 _DC                             equ     1
  00000002            00017 _ZERO                           equ     2
  00000003            00018 _PD                             equ     3
  00000004            00019 _TO                             equ     4
  00000005            00020 _RP0                            equ     5
  00000006            00021 _RP1                            equ     6
  00000007            00022 _IRP                            equ     7
  00000004            00023 FSR             equ     04H     ; 0&1 Ukazatel pro neprime adresovani
  00000005            00024 PORTA           equ     05H     ; 0&1 Data a rizeni portu A
  00000006            00025 PORTB           equ     06H     ; 0&1 Data a rizeni portu B
  00000008            00026 EEDATA_0        equ     08H     ; 0   Data EEPROM
  00000008            00027 EECON1_1        equ     08H     ;   1 Rizeni EEPROM
  00000000            00028 _EERD                           equ     0
  00000001            00029 _EEWR                           equ     1
  00000002            00030 _EEWREN                         equ     2
  00000003            00031 _EEWRERR                        equ     3
  00000004            00032 _EEIF                           equ     4
  00000009            00033 EEADR_0         equ     09H     ; 0   Adresa EEPROM
  00000009            00034 EECON2_1        equ     09H     ;   1 Aktivacni pseudoregistr
  0000000A            00035 PCLATH          equ     0AH     ; 0&1 Horni cast PC pro move
  0000000B            00036 INTCON          equ     0BH     ; 0&1 Rizeni preruseni
  00000000            00037 _RBIF                           equ     0       ;
  00000001            00038 _INTF                           equ     1
  00000002            00039 _T0IF                           equ     2
  00000003            00040 _RBIE                           equ     3
  00000004            00041 _INTE                           equ     4
  00000005            00042 _T0IE                           equ     5
  00000006            00043 _EEIE                           equ     6
  00000007            00044 _GIE                            equ     7
                      00045 
                      00046 page0   macro
                      00047         bcf     STATUS,_RP0
                      00048         endm
                      00049 
                      00050 page1   macro
                      00051         bsf     STATUS,_RP0
                      00052         endm
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00053 ;
                      00054 ; Sada maker pro porovnani a skoky
                      00055 ;
                      00056 
                      00057 ;--- Compare ---
                      00058 CMP     macro   ZNAK, PROCEDURA         ; if W=ZNAK then goto PROCEDURA
                      00059         xorlw   ZNAK                    ; if W#ZNAK then zachovej W a neskakej
                      00060         btfsc   STATUS,_ZERO
                      00061         goto    PROCEDURA
                      00062         xorlw   ZNAK
                      00063         endm
                      00064 
                      00065 ;--- Skip if Carry ---
                      00066 SC      macro
                      00067         btfss   STATUS,_CARRY
                      00068         endm
                      00069 
                      00070 ;--- Skip if not Carry ---
                      00071 SNC     macro
                      00072         btfsc   STATUS,_CARRY
                      00073         endm
                      00074 
                      00075 ;--- Skip if Zero ---
                      00076 SZ      macro
                      00077         btfss   STATUS,_ZERO
                      00078         endm
                      00079 
                      00080 ;--- Skip if not Zero ---
                      00081 SNZ     macro
                      00082         btfsc   STATUS,_ZERO
                      00083         endm
                      00084 
                      00085 ;--- Skip if Borrow ( Negative ) --- ( po odecitani )
                      00086 SB      macro
                      00087         btsfsc  STATUS,_CARRY
                      00088         endm
                      00089 SN      macro
                      00090         btfsc   STATUS,_CARRY
                      00091         endm
                      00092 
                      00093 ;--- Skip if not Borrow ( Positive ) --- ( po odecitani )
                      00094 SNB     macro
                      00095         btfss   STATUS,_CARRY
                      00096         endm
                      00097 SP      macro
                      00098         btfss   STATUS,_CARRY
                      00099         endm
                      00100 
                      00101         cblock  0CH             ; Prvni volny registr
                      00102         endc
                      00002 
  00000000            00003 PRYJM   EQU     0               ;portb
                      00004 
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0000                  00005         org     0
                      00006 
0000   2817           00007         goto    Start
                      00008         ;--------------------
0004                  00009         org     4
                      00010         ;--------------------
0004   2817           00011         goto    Start
                      00012 
                      00013 #include delay.asm
                      00001 ;Pro krystal 4Mhz
                      00002 
                      00003 ;--- Macro na spozdeni 1ms az 255ms ---
                      00004 Delay   macro   ms
                      00005         movlw   ms
                      00006         movwf   xxx
                      00007         call    Delay1ms        
                      00008         endm
                      00009 
                      00010 ;--- Macro na spozdeni 0,1ms az 2,5ms (10-250) ---
                      00011 Delay01 macro   us
                      00012         movlw   us
                      00013         movwf   yyy
                      00014         call    Delay10us
                      00015         
                      00016         nop
                      00017         nop                     ; Z duvodu vyrovnani poctu potrebnych taktu jako na Delay1ms
                      00018         nop
                      00019         return  
                      00020         endm
                      00021 ;--- Spozdeni v nasobcich 1ms+2us ----
                      00022 
0005                  00023 Delay1ms:
0005   3063           00024         movlw   99              ; 1 ms
0006   008C           00025         movwf   yyy             ; goto 2 takty decfsz 1 kdyz 1 jinak 2
0007   200C           00026         call    Delay10us
                      00027 
0008   0B8D           00028         decfsz  xxx, f
0009   2805           00029         goto    Delay1ms
000A   0000           00030         nop
                      00031 ;---------------------------------
000B   0008           00032         return                  ;2us
                      00033 
                      00034 ;--- Spozdeni v nasobcich 10us ----
000C                  00035 Delay10us:                      ; Prodleva (CT1 * 10us)
000C   0000           00036         nop     
000D   0000           00037         nop
000E   0000           00038         nop
000F   0000           00039         nop
0010   0000           00040         nop
0011   0000           00041         nop
0012   0000           00042         nop
0013   0B8C           00043         decfsz  yyy, f
0014   280C           00044         goto    Delay10us
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0015   0000           00045         nop
0016   0008           00046         return
                      00047         ;-------------------------
                      00048 
                      00049 ;----------------------------
                      00050 ; Definice promenych
                      00051 ;----------------------------
                      00052 
                      00053         cblock  
                      00054 
  0000000C            00055         yyy
  0000000D            00056         xxx
                      00057 
                      00058         endc
                      00059 
                      00014 
                      00015 
0017                  00016 Start:
                      00017         page1
0017   1683               M         bsf     STATUS,_RP0
0018   3028           00018         movlw   00101000B       ; inicializace citace a prescaleru
0019   0081           00019         movwf   TMR0
001A   3000           00020         movlw   00000000B       ; konfigurace preruseni
001B   008B           00021         movwf   INTCON
                      00022 
                      00023         page1
001C   1683               M         bsf     STATUS,_RP0
001D   30F7           00024         movlw   11110111B       ; nastaveni portu na vstup nebo vystup
001E   0085           00025         movwf   PORTA           ; 1=vstup 0=vystup
001F   30F1           00026         movlw   11110001B
0020   0086           00027         movwf   PORTB
                      00028 
                      00029         ;bsf    TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
                      00030 
                      00031         page0
0021   1283               M         bcf     STATUS,_RP0
                      00032 
0022   0103           00033         clrw                    ; vynulovani portu
0023   0085           00034         movwf   PORTA
0024   0086           00035         movwf   PORTB
                      00036 
0025   1585           00037         bsf     PORTA, 3        ; Pull-Up na tlacitka
                      00038 
0026   1086           00039         bcf     PORTB, 1        ; zhasnuti LED
0027   1106           00040         bcf     PORTB, 2
0028   1186           00041         bcf     PORTB, 3
                      00042 
0029                  00043 MainLoop:
0029   1C06           00044         btfss   PORTB, PRYJM    ;cekani na impuls1
002A   2829           00045         goto    MainLoop
                      00046 
002B   200C           00047         call    Delay10us
002C   200C           00048         call    Delay10us
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00049 
002D   1C06           00050         btfss   PORTB, PRYJM    ;potvrzeni impulsu1
002E   2829           00051         goto    MainLoop
                      00052 
002F   200C           00053         call    Delay10us
0030   200C           00054         call    Delay10us
0031                  00055 smycka:
0031   1806           00056         btfsc   PORTB, PRYJM
0032   2831           00057         goto    smycka
                      00058                                 ;sinchronizace
0033   200C           00059         call    Delay10us
                      00060 
0034                  00061 smycka1:                        ;2impuls
0034   1C06           00062         btfss   PORTB, PRYJM                    
0035   2834           00063         goto    smycka1
0036   200C           00064         call    Delay10us       
                      00065 
0037                  00066 smycka2:
0037   1C06           00067         btfss   PORTB, PRYJM
0038   2829           00068         goto    MainLoop
                      00069 
0039                  00070 mezera2:
0039   1806           00071         btfsc   PORTB, PRYJM
003A   2839           00072         goto    mezera2
                      00073 
003B                  00074 impuls3:
003B   1C06           00075         btfss   PORTB, PRYJM
003C   283B           00076         goto    impuls3
                      00077 
003D                  00078 mezera3:
003D   1806           00079         btfsc   PORTB, PRYJM
003E   283D           00080         goto    mezera3
                      00081 
                      00082 
                      00083         ;-------------------------
                      00084 
                      00085 ;----------------------------
                      00086 ; Definice promenych
                      00087 ;----------------------------
                      00088 
                      00089         cblock  
                      00090 
  0000000E            00091         CT1
  0000000F            00092         CT2
                      00093 
                      00094         endc
                      00095 
                      00096         end
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  6


SYMBOL TABLE
  LABEL                             VALUE 

CMP                               
CT1                               0000000E
CT2                               0000000F
Delay                             
Delay01                           
Delay10us                         0000000C
Delay1ms                          00000005
EEADR_0                           00000009
EECON1_1                          00000008
EECON2_1                          00000009
EEDATA_0                          00000008
FSR                               00000004
IND0                              00000000
INTCON                            0000000B
MainLoop                          00000029
PCL                               00000002
PCLATH                            0000000A
PORTA                             00000005
PORTB                             00000006
PRYJM                             00000000
SB                                
SC                                
SN                                
SNB                               
SNC                               
SNZ                               
SP                                
STATUS                            00000003
SZ                                
Start                             00000017
TMR0                              00000001
_CARRY                            00000000
_DC                               00000001
_EEIE                             00000006
_EEIF                             00000004
_EERD                             00000000
_EEWR                             00000001
_EEWREN                           00000002
_EEWRERR                          00000003
_GIE                              00000007
_INTE                             00000004
_INTF                             00000001
_IRP                              00000007
_PD                               00000003
_RBIE                             00000003
_RBIF                             00000000
_RP0                              00000005
_RP1                              00000006
_T0IE                             00000005
_T0IF                             00000002
_TO                               00000004
_ZERO                             00000002
__16C84__                         00000000
MPASM 02.80 Released         PRIJIMAC.ASM   8-8-2002  19:29:29         PAGE  7


SYMBOL TABLE
  LABEL                             VALUE 

__16F84                           00000001
impuls3                           0000003B
mezera2                           00000039
mezera3                           0000003D
page0                             
page1                             
smycka                            00000031
smycka1                           00000034
smycka2                           00000037
xxx                               0000000D
yyy                               0000000C


MEMORY USAGE MAP ('X' = Used,  '-' = Unused)

0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX-

All other memory blocks unused.

Program Memory Words Used:    60
Program Memory Words Free:   964


Errors   :     0
Warnings :     0 reported,     0 suppressed
Messages :     0 reported,     0 suppressed