Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         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             MAIN.ASM   8-9-2002  12:26:04         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 
  00000001            00003 vys     EQU     1       ;vystupni portB protokol.asm
  00000002            00004 C1      EQU     2       ;pripojeni C1 na port B
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

  00000003            00005 C2      EQU     3       ;ptipojeni C2 na port B
                      00006 
0000                  00007         org     0
                      00008 
0000   284D           00009         goto    Start
                      00010         ;--------------------
0004                  00011         org     4
                      00012         ;--------------------
0004   284D           00013         goto    Start
                      00014 
                      00015 #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
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0013   0B8C           00043         decfsz  yyy, f
0014   280C           00044         goto    Delay10us
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 
                      00016 #include Protokol.asm
0017                  00001 Sinchro:
0017   1486           00002         bsf     PORTB, vys
0018   200C           00003         call    Delay10us               
0019   200C           00004         call    Delay10us       
001A   200C           00005         call    Delay10us       
001B   1086           00006         bcf     PORTB, vys              ; 1. impuls (30us)
001C   200C           00007         call    Delay10us
001D   200C           00008         call    Delay10us
001E   200C           00009         call    Delay10us               
001F   1486           00010         bsf     PORTB, vys
0020   200C           00011         call    Delay10us               
0021   200C           00012         call    Delay10us       
0022   1086           00013         bcf     PORTB, vys              ; 2. impuls (20us)
0023   200C           00014         call    Delay10us
0024   200C           00015         call    Delay10us                       
0025   1486           00016         bsf     PORTB, vys
0026   200C           00017         call    Delay10us               
0027   1086           00018         bcf     PORTB, vys              ; 3. impuls (10us)
0028   200C           00019         call    Delay10us
                      00020         
                      00021         ;return
                      00022 
                      00023         ;-------------------------
0029                  00024 Protokol:
0029   3008           00025         movlw   8
002A   008F           00026         movwf   Bity                    ; nastaveni slova
002B   2017           00027         call    Sinchro
002C                  00028 VysBit:
002C   1C10           00029         btfss   Ramec, 0
002D   2033           00030         call    frek0
002E   2040           00031         call    frek1
002F                  00032 Rotace:
002F   0C90           00033         rrf     Ramec, f
0030   0B8F           00034         decfsz  Bity, f
0031   282C           00035         goto    VysBit
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0032   0008           00036         return
                      00037 
                      00038         ;-------------------------
0033                  00039 frek0:
0033   303C           00040         movlw   60
0034   008E           00041         movwf   Frek
0035                  00042 smycka1:
0035   1486           00043         bsf     PORTB, vys                      ; 2000 Hz       60 impulsu      
                      00044         Delay   50
0036   3032               M         movlw   50
0037   008D               M         movwf   xxx
0038   2005               M         call    Delay1ms        
0039   1086           00045         bcf     PORTB, vys
                      00046         Delay   50
003A   3032               M         movlw   50
003B   008D               M         movwf   xxx
003C   2005               M         call    Delay1ms        
003D   0B8E           00047         decfsz  Frek,f
003E   2835           00048         goto    smycka1
003F   202F           00049         call    Rotace          
                      00050         ;-------------------------
0040                  00051 frek1:  
0040   302D           00052         movlw   45
0041   008E           00053         movwf   Frek
0042                  00054 smycka2:
0042   1486           00055         bsf     PORTB, vys                      ; 1500 Hz       45 impulsu
                      00056         Delay   150
0043   3096               M         movlw   150
0044   008D               M         movwf   xxx
0045   2005               M         call    Delay1ms        
0046   1086           00057         bcf     PORTB, vys
                      00058         Delay   150
0047   3096               M         movlw   150
0048   008D               M         movwf   xxx
0049   2005               M         call    Delay1ms        
004A   0B8E           00059         decfsz  Frek,f
004B   2842           00060         goto    smycka2
004C   202F           00061         call    Rotace                          
                      00062         ;-------------------------
                      00063 
                      00064 
                      00065 ;----------------------------
                      00066 ; Definice promenych
                      00067 ;----------------------------
                      00068 
                      00069         cblock  
                      00070         
  0000000E            00071         Frek
  0000000F            00072         Bity
  00000010            00073         Ramec
                      00074         
                      00075         endc
004D                  00017 Start:
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00018         page1
004D   1683               M         bsf     STATUS,_RP0
004E   3000           00019         movlw   00000000B       ; inicializace citace a prescaleru
004F   0081           00020         movwf   TMR0
0050   3000           00021         movlw   00000000B       ; konfigurace preruseni
0051   008B           00022         movwf   INTCON
                      00023 
                      00024         page1
0052   1683               M         bsf     STATUS,_RP0
0053   30F3           00025         movlw   11110011B       ; nastaveni portu na vstup nebo vystup
0054   0085           00026         movwf   PORTA           ; 1=vstup 0=vystup
0055   30F1           00027         movlw   11110001B
0056   0086           00028         movwf   PORTB
                      00029 
0057   1781           00030         bsf     TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
                      00031 
                      00032         page0
0058   1283               M         bcf     STATUS,_RP0
                      00033 
0059   0103           00034         clrw                    ; vynulovani portu
005A   0085           00035         movwf   PORTA
005B   0086           00036         movwf   PORTB
                      00037 
005C   1585           00038         bsf     PORTA, 3        ; Pull-Up na tlacitka
                      00039 
005D   1086           00040         bcf     PORTB, 1        ; zhasnuti LED
005E   1106           00041         bcf     PORTB, 2
005F   1186           00042         bcf     PORTB, 3
                      00043 
0060                  00044 MainLoop:
0060   3002           00045         movlw   2
0061   0091           00046         movwf   volani          ; Nastavi pocet volani procedury vybito 
0062   1506           00047         bsf     PORTB, C1       ; Nabiti kondenzatoru1
0063   1586           00048         bsf     PORTB, C2       ; Nabiti kondenzatoru2
0064                  00049 dal:
0064   1D05           00050         btfss   PORTA, C1       ; Test kondenzatoru1
0065   206B           00051         call    vibito
                      00052 
0066   1D86           00053         btfss   PORTB, C2       ; Test kondenzatoru2
0067   206B           00054         call    vibito
                      00055 
0068   0A90           00056         incf    Ramec, f
0069   2864           00057         goto    dal
006A   2860           00058         goto    MainLoop
                      00059         ;---------------
                      00060 
006B                  00061 vibito:
006B   3004           00062         movlw   4
006C   0092           00063         movwf   CT1             ; uvolneni mista
006D                  00064 zapis:  
006D   0D90           00065         rlf     Ramec, f
006E   0B92           00066         decfsz  CT1, f
006F   286D           00067         goto    zapis
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0070   0B91           00068         decfsz  volani, f
                      00069 
0071   2029           00070         call    Protokol
                      00071 
0072   2860           00072         goto    MainLoop
                      00073 
                      00074 
                      00075 ;----------------------------
                      00076 ; Definice promenych
                      00077 ;----------------------------
                      00078 
                      00079         cblock  
                      00080 
  00000011            00081         volani
  00000012            00082         CT1
                      00083 
                      00084         endc
                      00085 
                      00086         end
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  8


SYMBOL TABLE
  LABEL                             VALUE 

Bity                              0000000F
C1                                00000002
C2                                00000003
CMP                               
CT1                               00000012
Delay                             
Delay01                           
Delay10us                         0000000C
Delay1ms                          00000005
EEADR_0                           00000009
EECON1_1                          00000008
EECON2_1                          00000009
EEDATA_0                          00000008
FSR                               00000004
Frek                              0000000E
IND0                              00000000
INTCON                            0000000B
MainLoop                          00000060
PCL                               00000002
PCLATH                            0000000A
PORTA                             00000005
PORTB                             00000006
Protokol                          00000029
Ramec                             00000010
Rotace                            0000002F
SB                                
SC                                
SN                                
SNB                               
SNC                               
SNZ                               
SP                                
STATUS                            00000003
SZ                                
Sinchro                           00000017
Start                             0000004D
TMR0                              00000001
VysBit                            0000002C
_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
MPASM 02.80 Released             MAIN.ASM   8-9-2002  12:26:04         PAGE  9


SYMBOL TABLE
  LABEL                             VALUE 

_RP0                              00000005
_RP1                              00000006
_T0IE                             00000005
_T0IF                             00000002
_TO                               00000004
_ZERO                             00000002
__16C84__                         00000000
__16F84                           00000001
dal                               00000064
frek0                             00000033
frek1                             00000040
page0                             
page1                             
smycka1                           00000035
smycka2                           00000042
vibito                            0000006B
volani                            00000011
vys                               00000001
xxx                               0000000D
yyy                               0000000C
zapis                             0000006D


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

0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXX-------------

All other memory blocks unused.

Program Memory Words Used:   112
Program Memory Words Free:   912


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