158 |
jicha |
1 |
CCS PCM C Compiler, Version 4.058s, 42064 02-III-08 00:13 |
|
|
2 |
|
|
|
3 |
Filename: main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 285 words (3%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 11 (3%) at main() level |
|
|
8 |
19 (5%) worst case |
|
|
9 |
Stack: 1 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 076 |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\RS\Schmitt\main.h" |
|
|
17 |
.................... #include <16F876A.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F876A device //////////////// |
|
|
19 |
.................... #device PIC16F876A |
|
|
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 BROWNOUT //Reset when brownout detected |
|
|
30 |
.................... #FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18) |
|
|
31 |
.................... #FUSES NOCPD //No EE protection |
|
|
32 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
33 |
.................... |
|
|
34 |
.................... #use delay(clock=4000000) |
|
|
35 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
36 |
.................... |
|
|
37 |
.................... |
|
|
38 |
.................... #define mic input(PIN_A4) |
|
|
39 |
.................... #define LED_ON output_low(PIN_A0) |
|
|
40 |
.................... #define LED_OFF output_high(PIN_A0) |
|
|
41 |
.................... |
|
|
42 |
.................... void main() |
|
|
43 |
.................... { |
|
|
44 |
0076: CLRF 04 |
|
|
45 |
0077: BCF 03.7 |
|
|
46 |
0078: MOVLW 1F |
|
|
47 |
0079: ANDWF 03,F |
|
|
48 |
007A: MOVLW 19 |
|
|
49 |
007B: BSF 03.5 |
|
|
50 |
007C: MOVWF 19 |
|
|
51 |
007D: MOVLW A6 |
|
|
52 |
007E: MOVWF 18 |
|
|
53 |
007F: MOVLW 90 |
|
|
54 |
0080: BCF 03.5 |
|
|
55 |
0081: MOVWF 18 |
|
|
56 |
0082: BSF 03.5 |
|
|
57 |
0083: BSF 1F.0 |
|
|
58 |
0084: BSF 1F.1 |
|
|
59 |
0085: BSF 1F.2 |
|
|
60 |
0086: BCF 1F.3 |
|
|
61 |
0087: MOVLW 07 |
|
|
62 |
0088: MOVWF 1C |
|
|
63 |
.................... setup_adc_ports(NO_ANALOGS); |
|
|
64 |
* |
|
|
65 |
008C: BSF 03.5 |
|
|
66 |
008D: BSF 1F.0 |
|
|
67 |
008E: BSF 1F.1 |
|
|
68 |
008F: BSF 1F.2 |
|
|
69 |
0090: BCF 1F.3 |
|
|
70 |
.................... setup_adc(ADC_OFF); |
|
|
71 |
0091: BCF 03.5 |
|
|
72 |
0092: BCF 1F.0 |
|
|
73 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
74 |
* |
|
|
75 |
0089: MOVLW FF |
|
|
76 |
008A: BCF 03.5 |
|
|
77 |
008B: MOVWF 20 |
|
|
78 |
* |
|
|
79 |
0093: BCF 14.5 |
|
|
80 |
0094: BCF 20.5 |
|
|
81 |
0095: MOVF 20,W |
|
|
82 |
0096: BSF 03.5 |
|
|
83 |
0097: MOVWF 07 |
|
|
84 |
0098: BCF 03.5 |
|
|
85 |
0099: BSF 20.4 |
|
|
86 |
009A: MOVF 20,W |
|
|
87 |
009B: BSF 03.5 |
|
|
88 |
009C: MOVWF 07 |
|
|
89 |
009D: BCF 03.5 |
|
|
90 |
009E: BCF 20.3 |
|
|
91 |
009F: MOVF 20,W |
|
|
92 |
00A0: BSF 03.5 |
|
|
93 |
00A1: MOVWF 07 |
|
|
94 |
00A2: MOVLW 01 |
|
|
95 |
00A3: BCF 03.5 |
|
|
96 |
00A4: MOVWF 14 |
|
|
97 |
00A5: MOVLW 00 |
|
|
98 |
00A6: BSF 03.5 |
|
|
99 |
00A7: MOVWF 14 |
|
|
100 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
101 |
00A8: MOVF 01,W |
|
|
102 |
00A9: ANDLW C7 |
|
|
103 |
00AA: IORLW 08 |
|
|
104 |
00AB: MOVWF 01 |
|
|
105 |
.................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); |
|
|
106 |
00AC: MOVLW 85 |
|
|
107 |
00AD: BCF 03.5 |
|
|
108 |
00AE: MOVWF 10 |
|
|
109 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
110 |
00AF: MOVLW 00 |
|
|
111 |
00B0: MOVWF 78 |
|
|
112 |
00B1: MOVWF 12 |
|
|
113 |
00B2: MOVLW 00 |
|
|
114 |
00B3: BSF 03.5 |
|
|
115 |
00B4: MOVWF 12 |
|
|
116 |
.................... setup_comparator(NC_NC_NC_NC); |
|
|
117 |
00B5: MOVLW 07 |
|
|
118 |
00B6: MOVWF 1C |
|
|
119 |
00B7: MOVF 05,W |
|
|
120 |
00B8: MOVLW 03 |
|
|
121 |
00B9: MOVWF 77 |
|
|
122 |
00BA: DECFSZ 77,F |
|
|
123 |
00BB: GOTO 0BA |
|
|
124 |
00BC: MOVF 1C,W |
|
|
125 |
00BD: BCF 03.5 |
|
|
126 |
00BE: BCF 0D.6 |
|
|
127 |
.................... setup_vref(FALSE); |
|
|
128 |
00BF: BSF 03.5 |
|
|
129 |
00C0: CLRF 1D |
|
|
130 |
.................... |
|
|
131 |
.................... while(TRUE) |
|
|
132 |
.................... { |
|
|
133 |
.................... while(mic); |
|
|
134 |
00C1: BSF 05.4 |
|
|
135 |
00C2: BCF 03.5 |
|
|
136 |
00C3: BTFSS 05.4 |
|
|
137 |
00C4: GOTO 0C7 |
|
|
138 |
00C5: BSF 03.5 |
|
|
139 |
00C6: GOTO 0C1 |
|
|
140 |
.................... while(!mic); |
|
|
141 |
00C7: BSF 03.5 |
|
|
142 |
00C8: BSF 05.4 |
|
|
143 |
00C9: BCF 03.5 |
|
|
144 |
00CA: BTFSS 05.4 |
|
|
145 |
00CB: GOTO 0C7 |
|
|
146 |
.................... while(mic) |
|
|
147 |
.................... { |
|
|
148 |
00CC: BSF 03.5 |
|
|
149 |
00CD: BSF 05.4 |
|
|
150 |
00CE: BCF 03.5 |
|
|
151 |
00CF: BTFSS 05.4 |
|
|
152 |
00D0: GOTO 0DD |
|
|
153 |
.................... set_timer1(0); |
|
|
154 |
00D1: CLRF 0F |
|
|
155 |
00D2: CLRF 0E |
|
|
156 |
.................... LED_ON; |
|
|
157 |
00D3: BSF 03.5 |
|
|
158 |
00D4: BCF 05.0 |
|
|
159 |
00D5: BCF 03.5 |
|
|
160 |
00D6: BCF 05.0 |
|
|
161 |
.................... while(mic); |
|
|
162 |
00D7: BSF 03.5 |
|
|
163 |
00D8: BSF 05.4 |
|
|
164 |
00D9: BCF 03.5 |
|
|
165 |
00DA: BTFSC 05.4 |
|
|
166 |
00DB: GOTO 0D7 |
|
|
167 |
.................... } |
|
|
168 |
00DC: GOTO 0CC |
|
|
169 |
.................... while(!mic) |
|
|
170 |
.................... { |
|
|
171 |
00DD: BSF 03.5 |
|
|
172 |
00DE: BSF 05.4 |
|
|
173 |
00DF: BCF 03.5 |
|
|
174 |
00E0: BTFSC 05.4 |
|
|
175 |
00E1: GOTO 0EC |
|
|
176 |
.................... LED_OFF; |
|
|
177 |
00E2: BSF 03.5 |
|
|
178 |
00E3: BCF 05.0 |
|
|
179 |
00E4: BCF 03.5 |
|
|
180 |
00E5: BSF 05.0 |
|
|
181 |
.................... while(!mic); |
|
|
182 |
00E6: BSF 03.5 |
|
|
183 |
00E7: BSF 05.4 |
|
|
184 |
00E8: BCF 03.5 |
|
|
185 |
00E9: BTFSS 05.4 |
|
|
186 |
00EA: GOTO 0E6 |
|
|
187 |
.................... } |
|
|
188 |
00EB: GOTO 0DD |
|
|
189 |
.................... printf("Perioda %5Lu us.\n\r",get_timer1()); |
|
|
190 |
00EC: MOVF 0F,W |
|
|
191 |
00ED: MOVWF 7A |
|
|
192 |
00EE: MOVF 0E,W |
|
|
193 |
00EF: MOVWF 77 |
|
|
194 |
00F0: MOVF 0F,W |
|
|
195 |
00F1: SUBWF 7A,W |
|
|
196 |
00F2: BTFSS 03.2 |
|
|
197 |
00F3: GOTO 0EC |
|
|
198 |
00F4: MOVF 77,W |
|
|
199 |
00F5: MOVWF 21 |
|
|
200 |
00F6: MOVF 7A,W |
|
|
201 |
00F7: MOVWF 22 |
|
|
202 |
00F8: CLRF 23 |
|
|
203 |
00F9: MOVF 23,W |
|
|
204 |
00FA: CALL 004 |
|
|
205 |
00FB: INCF 23,F |
|
|
206 |
00FC: MOVWF 77 |
|
|
207 |
00FD: MOVF 77,W |
|
|
208 |
00FE: BTFSS 0C.4 |
|
|
209 |
00FF: GOTO 0FE |
|
|
210 |
0100: MOVWF 19 |
|
|
211 |
0101: MOVLW 08 |
|
|
212 |
0102: SUBWF 23,W |
|
|
213 |
0103: BTFSS 03.2 |
|
|
214 |
0104: GOTO 0F9 |
|
|
215 |
0105: MOVLW 00 |
|
|
216 |
0106: MOVWF 04 |
|
|
217 |
0107: MOVF 22,W |
|
|
218 |
0108: MOVWF 25 |
|
|
219 |
0109: MOVF 21,W |
|
|
220 |
010A: MOVWF 24 |
|
|
221 |
010B: GOTO 01B |
|
|
222 |
010C: MOVLW 0C |
|
|
223 |
010D: MOVWF 24 |
|
|
224 |
010E: MOVF 24,W |
|
|
225 |
010F: CALL 004 |
|
|
226 |
0110: INCF 24,F |
|
|
227 |
0111: MOVWF 77 |
|
|
228 |
0112: MOVF 77,W |
|
|
229 |
0113: BTFSS 0C.4 |
|
|
230 |
0114: GOTO 113 |
|
|
231 |
0115: MOVWF 19 |
|
|
232 |
0116: MOVLW 12 |
|
|
233 |
0117: SUBWF 24,W |
|
|
234 |
0118: BTFSS 03.2 |
|
|
235 |
0119: GOTO 10E |
|
|
236 |
.................... } |
|
|
237 |
011A: BSF 03.5 |
|
|
238 |
011B: GOTO 0C1 |
|
|
239 |
.................... } |
|
|
240 |
011C: SLEEP |
|
|
241 |
|
|
|
242 |
Configuration Fuses: |
|
|
243 |
Word 1: 3FF9 XT NOWDT NOPUT NODEBUG NOPROTECT BROWNOUT LVP NOCPD NOWRT |