135 |
jicha |
1 |
CCS PCM C Compiler, Version 4.059d, 15399 13-I-06 22:36 |
|
|
2 |
|
|
|
3 |
Filename: main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 262 words (13%) |
|
|
6 |
Largest free fragment is 1786 |
|
|
7 |
RAM used: 10 (3%) at main() level |
|
|
8 |
18 (5%) worst case |
|
|
9 |
Stack: 1 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 082 |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\RS\Ladicka2\main.h" |
|
|
17 |
.................... #include <16F877A.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F877A device //////////////// |
|
|
19 |
.................... #device PIC16F877A |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=8 |
|
|
23 |
.................... |
|
|
24 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
25 |
.................... #FUSES XT //Crystal osc <= 4mhz |
|
|
26 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
27 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
28 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
29 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
30 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
31 |
.................... #FUSES NOCPD //No EE protection |
|
|
32 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
33 |
.................... |
|
|
34 |
.................... #use delay(clock=4000000,RESTART_WDT) |
|
|
35 |
* |
|
|
36 |
0011: MOVLW 23 |
|
|
37 |
0012: MOVWF 04 |
|
|
38 |
0013: BCF 03.7 |
|
|
39 |
0014: MOVF 00,W |
|
|
40 |
0015: BTFSC 03.2 |
|
|
41 |
0016: GOTO 028 |
|
|
42 |
0017: MOVLW 01 |
|
|
43 |
0018: MOVWF 78 |
|
|
44 |
0019: MOVLW BF |
|
|
45 |
001A: MOVWF 77 |
|
|
46 |
001B: CLRWDT |
|
|
47 |
001C: DECFSZ 77,F |
|
|
48 |
001D: GOTO 01B |
|
|
49 |
001E: DECFSZ 78,F |
|
|
50 |
001F: GOTO 019 |
|
|
51 |
0020: MOVLW 4A |
|
|
52 |
0021: MOVWF 77 |
|
|
53 |
0022: DECFSZ 77,F |
|
|
54 |
0023: GOTO 022 |
|
|
55 |
0024: NOP |
|
|
56 |
0025: CLRWDT |
|
|
57 |
0026: DECFSZ 00,F |
|
|
58 |
0027: GOTO 017 |
|
|
59 |
0028: RETLW 00 |
|
|
60 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
61 |
.................... |
|
|
62 |
.................... |
|
|
63 |
.................... #define vstup C1OUT |
|
|
64 |
.................... #define krok 1 |
|
|
65 |
.................... |
|
|
66 |
.................... void main() |
|
|
67 |
.................... { |
|
|
68 |
* |
|
|
69 |
0082: CLRF 04 |
|
|
70 |
0083: BCF 03.7 |
|
|
71 |
0084: MOVLW 1F |
|
|
72 |
0085: ANDWF 03,F |
|
|
73 |
0086: MOVLW 19 |
|
|
74 |
0087: BSF 03.5 |
|
|
75 |
0088: MOVWF 19 |
|
|
76 |
0089: MOVLW A6 |
|
|
77 |
008A: MOVWF 18 |
|
|
78 |
008B: MOVLW 90 |
|
|
79 |
008C: BCF 03.5 |
|
|
80 |
008D: MOVWF 18 |
|
|
81 |
008E: BSF 03.5 |
|
|
82 |
008F: BSF 1F.0 |
|
|
83 |
0090: BSF 1F.1 |
|
|
84 |
0091: BSF 1F.2 |
|
|
85 |
0092: BCF 1F.3 |
|
|
86 |
0093: MOVLW 07 |
|
|
87 |
0094: MOVWF 1C |
|
|
88 |
.................... int16 n; |
|
|
89 |
.................... |
|
|
90 |
.................... setup_adc_ports(NO_ANALOGS); |
|
|
91 |
* |
|
|
92 |
0098: BSF 03.5 |
|
|
93 |
0099: BSF 1F.0 |
|
|
94 |
009A: BSF 1F.1 |
|
|
95 |
009B: BSF 1F.2 |
|
|
96 |
009C: BCF 1F.3 |
|
|
97 |
.................... setup_adc(ADC_OFF); |
|
|
98 |
009D: BCF 03.5 |
|
|
99 |
009E: BCF 1F.0 |
|
|
100 |
.................... setup_psp(PSP_DISABLED); |
|
|
101 |
009F: BSF 03.5 |
|
|
102 |
00A0: BCF 09.4 |
|
|
103 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
104 |
* |
|
|
105 |
0095: MOVLW FF |
|
|
106 |
0096: BCF 03.5 |
|
|
107 |
0097: MOVWF 20 |
|
|
108 |
* |
|
|
109 |
00A1: BCF 03.5 |
|
|
110 |
00A2: BCF 14.5 |
|
|
111 |
00A3: BCF 20.5 |
|
|
112 |
00A4: MOVF 20,W |
|
|
113 |
00A5: BSF 03.5 |
|
|
114 |
00A6: MOVWF 07 |
|
|
115 |
00A7: BCF 03.5 |
|
|
116 |
00A8: BSF 20.4 |
|
|
117 |
00A9: MOVF 20,W |
|
|
118 |
00AA: BSF 03.5 |
|
|
119 |
00AB: MOVWF 07 |
|
|
120 |
00AC: BCF 03.5 |
|
|
121 |
00AD: BCF 20.3 |
|
|
122 |
00AE: MOVF 20,W |
|
|
123 |
00AF: BSF 03.5 |
|
|
124 |
00B0: MOVWF 07 |
|
|
125 |
00B1: MOVLW 01 |
|
|
126 |
00B2: BCF 03.5 |
|
|
127 |
00B3: MOVWF 14 |
|
|
128 |
00B4: MOVLW 00 |
|
|
129 |
00B5: BSF 03.5 |
|
|
130 |
00B6: MOVWF 14 |
|
|
131 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
132 |
00B7: MOVF 01,W |
|
|
133 |
00B8: ANDLW C7 |
|
|
134 |
00B9: IORLW 08 |
|
|
135 |
00BA: MOVWF 01 |
|
|
136 |
.................... setup_timer_1(T1_DISABLED); |
|
|
137 |
00BB: BCF 03.5 |
|
|
138 |
00BC: CLRF 10 |
|
|
139 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
140 |
00BD: MOVLW 00 |
|
|
141 |
00BE: MOVWF 78 |
|
|
142 |
00BF: MOVWF 12 |
|
|
143 |
00C0: MOVLW 00 |
|
|
144 |
00C1: BSF 03.5 |
|
|
145 |
00C2: MOVWF 12 |
|
|
146 |
.................... setup_comparator(A0_VR_A1_VR); |
|
|
147 |
00C3: MOVLW 06 |
|
|
148 |
00C4: MOVWF 1C |
|
|
149 |
00C5: MOVF 05,W |
|
|
150 |
00C6: IORLW 03 |
|
|
151 |
00C7: MOVWF 05 |
|
|
152 |
00C8: CLRWDT |
|
|
153 |
00C9: MOVLW 02 |
|
|
154 |
00CA: MOVWF 77 |
|
|
155 |
00CB: DECFSZ 77,F |
|
|
156 |
00CC: GOTO 0CB |
|
|
157 |
00CD: GOTO 0CE |
|
|
158 |
00CE: MOVF 1C,W |
|
|
159 |
00CF: BCF 03.5 |
|
|
160 |
00D0: BCF 0D.6 |
|
|
161 |
.................... setup_vref(VREF_HIGH|0); |
|
|
162 |
00D1: MOVLW 80 |
|
|
163 |
00D2: BSF 03.5 |
|
|
164 |
00D3: MOVWF 1D |
|
|
165 |
.................... |
|
|
166 |
.................... while(TRUE) |
|
|
167 |
.................... { |
|
|
168 |
.................... n=0; |
|
|
169 |
00D4: BCF 03.5 |
|
|
170 |
00D5: CLRF 22 |
|
|
171 |
00D6: CLRF 21 |
|
|
172 |
.................... while(vstup) |
|
|
173 |
.................... { |
|
|
174 |
00D7: BSF 03.5 |
|
|
175 |
00D8: BTFSS 1C.6 |
|
|
176 |
00D9: GOTO 0E3 |
|
|
177 |
.................... n++; |
|
|
178 |
00DA: BCF 03.5 |
|
|
179 |
00DB: INCF 21,F |
|
|
180 |
00DC: BTFSC 03.2 |
|
|
181 |
00DD: INCF 22,F |
|
|
182 |
.................... delay_ms(krok); |
|
|
183 |
00DE: MOVLW 01 |
|
|
184 |
00DF: MOVWF 23 |
|
|
185 |
00E0: CALL 011 |
|
|
186 |
.................... } |
|
|
187 |
00E1: GOTO 0D7 |
|
|
188 |
00E2: BSF 03.5 |
|
|
189 |
.................... while(!vstup) |
|
|
190 |
.................... { |
|
|
191 |
00E3: BTFSC 1C.6 |
|
|
192 |
00E4: GOTO 0EE |
|
|
193 |
.................... n++; |
|
|
194 |
00E5: BCF 03.5 |
|
|
195 |
00E6: INCF 21,F |
|
|
196 |
00E7: BTFSC 03.2 |
|
|
197 |
00E8: INCF 22,F |
|
|
198 |
.................... delay_ms(krok); |
|
|
199 |
00E9: MOVLW 01 |
|
|
200 |
00EA: MOVWF 23 |
|
|
201 |
00EB: CALL 011 |
|
|
202 |
.................... } |
|
|
203 |
00EC: BSF 03.5 |
|
|
204 |
00ED: GOTO 0E3 |
|
|
205 |
.................... printf("%Lu ms\n\r",n); |
|
|
206 |
00EE: MOVLW 10 |
|
|
207 |
00EF: MOVWF 04 |
|
|
208 |
00F0: BCF 03.5 |
|
|
209 |
00F1: MOVF 22,W |
|
|
210 |
00F2: MOVWF 24 |
|
|
211 |
00F3: MOVF 21,W |
|
|
212 |
00F4: MOVWF 23 |
|
|
213 |
00F5: GOTO 029 |
|
|
214 |
00F6: MOVLW 03 |
|
|
215 |
00F7: MOVWF 23 |
|
|
216 |
00F8: MOVF 23,W |
|
|
217 |
00F9: CALL 004 |
|
|
218 |
00FA: INCF 23,F |
|
|
219 |
00FB: MOVWF 77 |
|
|
220 |
00FC: MOVF 77,W |
|
|
221 |
00FD: BTFSS 0C.4 |
|
|
222 |
00FE: GOTO 0FD |
|
|
223 |
00FF: MOVWF 19 |
|
|
224 |
0100: MOVLW 08 |
|
|
225 |
0101: SUBWF 23,W |
|
|
226 |
0102: BTFSS 03.2 |
|
|
227 |
0103: GOTO 0F8 |
|
|
228 |
.................... } |
|
|
229 |
0104: GOTO 0D5 |
|
|
230 |
.................... } |
|
|
231 |
0105: SLEEP |
|
|
232 |
|
|
|
233 |
Configuration Fuses: |
|
|
234 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |