Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         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   7-12-2002  15:23:36         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 
                      00003 #define debug   0
                      00004 
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00005 #include delaymac.inc
                      00001 ;--- Macro na spozdeni 1ms az 255ms ---
                      00002 Delay1ms macro  _ms
                      00003  if debug == 0
                      00004         movlw   _ms     
                      00005         movwf   _delay_ms
                      00006         call    _delay1ms       
                      00007  endif
                      00008         endm
                      00009 
                      00010 ;--- Macro na spozdeni 10us az 2,55ms ---
                      00011 Delay10us macro _us
                      00012  if debug == 0
                      00013         movlw   _us     
                      00014         movwf   _delay_us
                      00015         call    _delay10us      
                      00016  endif
                      00017         endm
                      00018 
                      00006 
  00000001            00007 Dozadu  EQU     1
  00000002            00008 Dopredu EQU     2
                      00009 
                      00010 ;--- Macro na spozdeni 1ms az 255ms ---
                      00011 Delay   macro   ms
                      00012         Delay1ms ms
                      00013 ;       movlw   ms
                      00014 ;       movwf   _delay_ms
                      00015 ;       call    _delay1ms
                      00016         endm
                      00017 ;--------------------------------------
                      00018 Vpred_ON macro
                      00019         bsf     PORTA, Dopredu
                      00020         endm
                      00021 ;--------------------------------------
                      00022 Vpred_OFF macro
                      00023         bcf     PORTA, Dopredu
                      00024         Delay   50
                      00025         bsf     PORTA, Dozadu           ;zabrzdi
                      00026         Delay   125
                      00027         bcf     PORTA, Dozadu
                      00028         endm
                      00029 ;--------------------------------------
                      00030 Vpred   macro   d
                      00031         movlw   d               ; x dlazdicek
                      00032         movwf   CT3
                      00033         call    Vpred0
                      00034         endm
                      00035 
                      00036 ;--------------------------------------
0000                  00037         org     0
                      00038 
0000   2804           00039         goto    Start
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00040         ;--------------------
0004                  00041         org     4
                      00042         ;--------------------
0004                  00043 Start:
                      00044         page1
0004   1683               M         bsf     STATUS,_RP0
0005   3000           00045         movlw   00000000B       ; inicializace citace a prescaleru
0006   0081           00046         movwf   TMR0
0007   3000           00047         movlw   00000000B       ; konfigurace preruseni
0008   008B           00048         movwf   INTCON
                      00049 
                      00050         page1
0009   1683               M         bsf     STATUS,_RP0
000A   30F1           00051         movlw   11110001B       ; nastaveni portu na vstup nebo vystup
000B   0085           00052         movwf   PORTA           ; 1=vstup 0=vystup
000C   30F6           00053         movlw   11110110B
000D   0086           00054         movwf   PORTB
                      00055 
000E   1781           00056         bsf     TMR0, 7         ; vypni pull-up na PORTB (OPTION registr)
                      00057 
                      00058         page0
000F   1283               M         bcf     STATUS,_RP0
                      00059 
0010   0103           00060         clrw                    ; vynulovani portu
0011   0085           00061         movwf   PORTA
0012   0086           00062         movwf   PORTB
                      00063 
0013   1586           00064         bsf     PORTB, 3        ; Pridrz napajeni
                      00065 
0014   1585           00066         bsf     PORTA, 3        ; Rozsvit LED
                      00067         Delay   250
                          M         Delay1ms 250
                          M  if debug == 0
0015   30FA               M         movlw   250     
0016   008C               M         movwf   _delay_ms
0017   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0018   1185           00068         bcf     PORTA, 3        ; Zhasni LED
                      00069 
0019                  00070 MainLoop:
                      00071         Vpred   12
0019   300C               M         movlw   12              ; x dlazdicek
001A   008E               M         movwf   CT3
001B   204A               M         call    Vpred0
                      00072         Delay   200
                          M         Delay1ms 200
                          M  if debug == 0
001C   30C8               M         movlw   200     
001D   008C               M         movwf   _delay_ms
001E   207F               M         call    _delay1ms       
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
001F   206E           00073         call    Celemvzat
                      00074         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
0020   3032               M         movlw   50      
0021   008C               M         movwf   _delay_ms
0022   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00075         Vpred   8
0023   3008               M         movlw   8               ; x dlazdicek
0024   008E               M         movwf   CT3
0025   204A               M         call    Vpred0
                      00076         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
0026   3032               M         movlw   50      
0027   008C               M         movwf   _delay_ms
0028   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0029   2075           00077         call    Vlevo
                      00078         Vpred   8
002A   3008               M         movlw   8               ; x dlazdicek
002B   008E               M         movwf   CT3
002C   204A               M         call    Vpred0
                      00079         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
002D   3032               M         movlw   50      
002E   008C               M         movwf   _delay_ms
002F   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00080         Vpred   1
0030   3001               M         movlw   1               ; x dlazdicek
0031   008E               M         movwf   CT3
0032   204A               M         call    Vpred0
                      00081         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
0033   3032               M         movlw   50      
0034   008C               M         movwf   _delay_ms
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0035   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0036   2065           00082         call    Vpravo
                      00083         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
0037   3032               M         movlw   50      
0038   008C               M         movwf   _delay_ms
0039   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00084         Vpred   8
003A   3008               M         movlw   8               ; x dlazdicek
003B   008E               M         movwf   CT3
003C   204A               M         call    Vpred0
                      00085         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
003D   3032               M         movlw   50      
003E   008C               M         movwf   _delay_ms
003F   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0040   2075           00086         call    Vlevo
                      00087         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
0041   3032               M         movlw   50      
0042   008C               M         movwf   _delay_ms
0043   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00088         Vpred   3
0044   3003               M         movlw   3               ; x dlazdicek
0045   008E               M         movwf   CT3
0046   204A               M         call    Vpred0
0047   206E           00089         call    Celemvzat
0048   1186           00090         bcf     PORTB, 3        ; Vypni napajeni
0049                  00091 Smycka:
0049   2849           00092         goto    Smycka
                      00093         ;----------------  
                      00094 
                      00095 ;--- Popojede o n dlazdic vpred ---
004A                  00096 Vpred0:
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00097         Vpred_ON
004A   1505               M         bsf     PORTA, Dopredu
                      00098         Delay   175
                          M         Delay1ms 175
                          M  if debug == 0
004B   30AF               M         movlw   175     
004C   008C               M         movwf   _delay_ms
004D   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
004E   1406           00099         bsf     PORTB, 0
                      00100         Delay   15
                          M         Delay1ms 15
                          M  if debug == 0
004F   300F               M         movlw   15      
0050   008C               M         movwf   _delay_ms
0051   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0052   1006           00101         bcf     PORTB, 0
                      00102         Delay   175
                          M         Delay1ms 175
                          M  if debug == 0
0053   30AF               M         movlw   175     
0054   008C               M         movwf   _delay_ms
0055   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00103         Vpred_OFF
0056   1105               M         bcf     PORTA, Dopredu
                          M         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
0057   3032               M         movlw   50      
0058   008C               M         movwf   _delay_ms
0059   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
005A   1485               M         bsf     PORTA, Dozadu           ;zabrzdi
                          M         Delay   125
                          M         Delay1ms 125
                          M  if debug == 0
005B   307D               M         movlw   125     
005C   008C               M         movwf   _delay_ms
005D   207F               M         call    _delay1ms       
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
005E   1085               M         bcf     PORTA, Dozadu
                      00104         Delay   50
                          M         Delay1ms 50
                          M  if debug == 0
005F   3032               M         movlw   50      
0060   008C               M         movwf   _delay_ms
0061   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0062   0B8E           00105         decfsz  CT3, f
0063   284A           00106         goto    Vpred0
0064   0008           00107         return
                      00108 
0065                  00109 Vpravo:
0065   1406           00110         bsf     PORTB, 0
                      00111         Delay   250
                          M         Delay1ms 250
                          M  if debug == 0
0066   30FA               M         movlw   250     
0067   008C               M         movwf   _delay_ms
0068   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00112         Delay   60
                          M         Delay1ms 60
                          M  if debug == 0
0069   303C               M         movlw   60      
006A   008C               M         movwf   _delay_ms
006B   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
006C   1006           00113         bcf     PORTB, 0
006D   0008           00114         return
                      00115 
                      00116 ;---------------------------------------
006E                  00117 Celemvzat:
006E   2065           00118         call    Vpravo
006F   1406           00119         bsf     PORTB, 0                        
                      00120         Delay   125                             
                          M         Delay1ms 125
                          M  if debug == 0
0070   307D               M         movlw   125     
0071   008C               M         movwf   _delay_ms
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0072   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
0073   1006           00121         bcf     PORTB, 0                        
0074   0008           00122         return
                      00123 ;---------------------------------------
0075                  00124 Vlevo:
0075   2065           00125         call    Vpravo
0076   1406           00126         bsf     PORTB, 0                
                      00127         Delay   250
                          M         Delay1ms 250
                          M  if debug == 0
0077   30FA               M         movlw   250     
0078   008C               M         movwf   _delay_ms
0079   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
                      00128         Delay   70              
                          M         Delay1ms 70
                          M  if debug == 0
007A   3046               M         movlw   70      
007B   008C               M         movwf   _delay_ms
007C   207F               M         call    _delay1ms       
                          M  endif
                          M ;       movlw   ms
                          M ;       movwf   _delay_ms
                          M ;       call    _delay1ms
007D   1006           00129         bcf     PORTB, 0        
007E   0008           00130         return
                      00131 
                      00132 #include delayfce.inc
                      00001 ;--- Spozdeni v nasobcich 1ms ----
007F                  00002 _delay1ms:
007F   3064           00003         movlw   100             ; 1 ms
0080   008D           00004         movwf   _delay_us
0081   2085           00005         call    _delay10us
                      00006 
0082   0B8C           00007         decfsz  _delay_ms, f
0083   287F           00008         goto    _delay1ms
0084   0008           00009         return
                      00010 
                      00011 ;--- Spozdeni v nasobcich 10us ----
0085                  00012 _delay10us:                     ; Prodleva (CT1 * 10us)+3us
0085   0000           00013         nop     
0086   0000           00014         nop
0087   0000           00015         nop
0088   0000           00016         nop
0089   0000           00017         nop
008A   0000           00018         nop
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

008B   0000           00019         nop
008C   0B8D           00020         decfsz  _delay_us, f
008D   2885           00021         goto    _delay10us
008E   0008           00022         return
                      00023 
                      00024 ;----------------------------
                      00025 ; Definice promenych pro spozdeni
                      00026 ;----------------------------
                      00027         cblock
  0000000C            00028         _delay_ms       ; Citac ms
  0000000D            00029         _delay_us       ; Citac 10us
                      00030         endc
                      00031 
                      00133 
                      00134 ;----------------------------
                      00135 ; Definice promenych 
                      00136 ;----------------------------
                      00137         cblock
  0000000E            00138         CT3             ;Citac poctu dlazdicek
                      00139         endc
                      00140 
                      00141         end
MPASM 02.80 Released             MAIN.ASM   7-12-2002  15:23:36         PAGE 11


SYMBOL TABLE
  LABEL                             VALUE 

CMP                               
CT3                               0000000E
Celemvzat                         0000006E
Delay                             
Delay10us                         
Delay1ms                          
Dopredu                           00000002
Dozadu                            00000001
EEADR_0                           00000009
EECON1_1                          00000008
EECON2_1                          00000009
EEDATA_0                          00000008
FSR                               00000004
IND0                              00000000
INTCON                            0000000B
MainLoop                          00000019
PCL                               00000002
PCLATH                            0000000A
PORTA                             00000005
PORTB                             00000006
SB                                
SC                                
SN                                
SNB                               
SNC                               
SNZ                               
SP                                
STATUS                            00000003
SZ                                
Smycka                            00000049
Start                             00000004
TMR0                              00000001
Vlevo                             00000075
Vpravo                            00000065
Vpred                             
Vpred0                            0000004A
Vpred_OFF                         
Vpred_ON                          
_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   7-12-2002  15:23:36         PAGE 12


SYMBOL TABLE
  LABEL                             VALUE 

_RP0                              00000005
_RP1                              00000006
_T0IE                             00000005
_T0IF                             00000002
_TO                               00000004
_ZERO                             00000002
__16C84__                         00000000
__16F84                           00000001
_delay10us                        00000085
_delay1ms                         0000007F
_delay_ms                         0000000C
_delay_us                         0000000D
debug                             0
page0                             
page1                             


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

0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
0080 : XXXXXXXXXXXXXXX- ---------------- ---------------- ----------------

All other memory blocks unused.

Program Memory Words Used:   140
Program Memory Words Free:   884


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