131 |
pavlicek |
1 |
CCS PCM C Compiler, Version 4.059d, 15399 02-I-08 17:54 |
|
|
2 |
|
|
|
3 |
Filename: main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 1318 words (64%) |
|
|
6 |
Largest free fragment is 730 |
|
|
7 |
RAM used: 15 (4%) at main() level |
|
|
8 |
40 (11%) worst case |
|
|
9 |
Stack: 5 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 36E |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\RS\Lux10b\main.h" |
|
|
17 |
.................... #include <16F877A.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F877A device //////////////// |
|
|
19 |
.................... #device PIC16F877A |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=10 |
|
|
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 |
00ED: MOVLW 36 |
|
|
37 |
00EE: MOVWF 04 |
|
|
38 |
00EF: BCF 03.7 |
|
|
39 |
00F0: MOVF 00,W |
|
|
40 |
00F1: BTFSC 03.2 |
|
|
41 |
00F2: GOTO 104 |
|
|
42 |
00F3: MOVLW 01 |
|
|
43 |
00F4: MOVWF 78 |
|
|
44 |
00F5: MOVLW BF |
|
|
45 |
00F6: MOVWF 77 |
|
|
46 |
00F7: CLRWDT |
|
|
47 |
00F8: DECFSZ 77,F |
|
|
48 |
00F9: GOTO 0F7 |
|
|
49 |
00FA: DECFSZ 78,F |
|
|
50 |
00FB: GOTO 0F5 |
|
|
51 |
00FC: MOVLW 4A |
|
|
52 |
00FD: MOVWF 77 |
|
|
53 |
00FE: DECFSZ 77,F |
|
|
54 |
00FF: GOTO 0FE |
|
|
55 |
0100: NOP |
|
|
56 |
0101: CLRWDT |
|
|
57 |
0102: DECFSZ 00,F |
|
|
58 |
0103: GOTO 0F3 |
|
|
59 |
0104: RETLW 00 |
|
|
60 |
.................... |
|
|
61 |
.................... |
|
|
62 |
.................... |
|
|
63 |
.................... #define LCD_RS PIN_B1 // rizeni registru LCD displeje |
|
|
64 |
.................... #define LCD_E PIN_B0 // enable LCD displeje |
|
|
65 |
.................... #define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
|
|
66 |
.................... #define IN 0 |
|
|
67 |
.................... #include "lcd.c" |
|
|
68 |
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem |
|
|
69 |
.................... // (c)miho 2002,2005 |
|
|
70 |
.................... // |
|
|
71 |
.................... // Historie: |
|
|
72 |
.................... // |
|
|
73 |
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje |
|
|
74 |
.................... // 0.01 Oprava portu (zapomenute stare identifikatory) |
|
|
75 |
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty |
|
|
76 |
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje |
|
|
77 |
.................... // |
|
|
78 |
.................... // |
|
|
79 |
.................... // Funkce: |
|
|
80 |
.................... // |
|
|
81 |
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni |
|
|
82 |
.................... // |
|
|
83 |
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky |
|
|
84 |
.................... // \f = \x0C - nova stranka - smazani displeje |
|
|
85 |
.................... // \n = \x0A - odradkovani (prechod na druhou radku) |
|
|
86 |
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet |
|
|
87 |
.................... // \r = \x0D - goto home to position 1,1 |
|
|
88 |
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM |
|
|
89 |
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM |
|
|
90 |
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce) |
|
|
91 |
.................... // |
|
|
92 |
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu |
|
|
93 |
.................... // nekontroluje parametry |
|
|
94 |
.................... // |
|
|
95 |
.................... // lcd_cursor_on zapne kurzor |
|
|
96 |
.................... // lcd_cursor_off vypne kurzor |
|
|
97 |
.................... // |
|
|
98 |
.................... // lcd_clr smaze displej |
|
|
99 |
.................... // |
|
|
100 |
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho |
|
|
101 |
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM. |
|
|
102 |
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7. |
|
|
103 |
.................... // Na konci se provede lcd_gotoxy(1,1). |
|
|
104 |
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku |
|
|
105 |
.................... // |
|
|
106 |
.................... // |
|
|
107 |
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port |
|
|
108 |
.................... // |
|
|
109 |
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje |
|
|
110 |
.................... // #define LCD_E PIN_B1 // enable LCD displeje |
|
|
111 |
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
|
|
112 |
.................... // |
|
|
113 |
.................... // |
|
|
114 |
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov) |
|
|
115 |
.................... // |
|
|
116 |
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje |
|
|
117 |
.................... // #define LCD_E PIN_B1 // enable LCD displeje |
|
|
118 |
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty |
|
|
119 |
.................... // #define LCD_D1 PIN_C3 // D1 |
|
|
120 |
.................... // #define LCD_D2 PIN_C4 // D2 |
|
|
121 |
.................... // #define LCD_D3 PIN_C5 // D3 |
|
|
122 |
.................... |
|
|
123 |
.................... |
|
|
124 |
.................... |
|
|
125 |
.................... |
|
|
126 |
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje |
|
|
127 |
.................... |
|
|
128 |
.................... |
|
|
129 |
.................... |
|
|
130 |
.................... |
|
|
131 |
.................... #ifdef LCD_DATA_LSB |
|
|
132 |
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne |
|
|
133 |
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva |
|
|
134 |
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu |
|
|
135 |
.................... // |
|
|
136 |
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu |
|
|
137 |
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu |
|
|
138 |
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru |
|
|
139 |
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu |
|
|
140 |
.................... // |
|
|
141 |
.................... #if LCD_SHIFT>4 // kontrola mezi |
|
|
142 |
.................... #error LCD data port LSB bit not in range 0..4 |
|
|
143 |
.................... #endif |
|
|
144 |
.................... #endif |
|
|
145 |
.................... |
|
|
146 |
.................... |
|
|
147 |
.................... // Definice konstant pro LCD display |
|
|
148 |
.................... // |
|
|
149 |
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem |
|
|
150 |
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor |
|
|
151 |
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky |
|
|
152 |
.................... |
|
|
153 |
.................... |
|
|
154 |
.................... // Definice rezimu LCD displeje |
|
|
155 |
.................... // |
|
|
156 |
.................... BYTE const LCD_INIT_STRING[4] = |
|
|
157 |
.................... { |
|
|
158 |
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7 |
|
|
159 |
.................... LCD_CURSOR_OFF_, // display on, kurzor off, |
|
|
160 |
.................... 0x01, // clear displeje |
|
|
161 |
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava) |
|
|
162 |
.................... }; |
|
|
163 |
.................... |
|
|
164 |
.................... |
|
|
165 |
.................... // Odesle nibble do displeje (posle data a klikne signalem e) |
|
|
166 |
.................... // |
|
|
167 |
.................... void lcd_send_nibble( BYTE n ) |
|
|
168 |
.................... { |
|
|
169 |
.................... #ifdef LCD_DATA_LSB |
|
|
170 |
.................... // data jsou za sebou na 4 bitech jednoho portu |
|
|
171 |
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej |
|
|
172 |
0105: MOVF 07,W |
|
|
173 |
0106: ANDLW 0F |
|
|
174 |
0107: MOVWF 3D |
|
|
175 |
0108: SWAPF 3C,W |
|
|
176 |
0109: MOVWF 77 |
|
|
177 |
010A: MOVLW F0 |
|
|
178 |
010B: ANDWF 77,F |
|
|
179 |
010C: MOVF 77,W |
|
|
180 |
010D: ANDLW F0 |
|
|
181 |
010E: IORWF 3D,W |
|
|
182 |
010F: MOVWF 07 |
|
|
183 |
.................... #else |
|
|
184 |
.................... // data jsou na libovolnych 4 bitech libovolnych portu |
|
|
185 |
.................... output_bit(LCD_D0,bit_test(n,0)); |
|
|
186 |
.................... output_bit(LCD_D1,bit_test(n,1)); |
|
|
187 |
.................... output_bit(LCD_D2,bit_test(n,2)); |
|
|
188 |
.................... output_bit(LCD_D3,bit_test(n,3)); |
|
|
189 |
.................... #endif |
|
|
190 |
.................... output_bit(LCD_E,1); // vzestupna hrana |
|
|
191 |
0110: BSF 06.0 |
|
|
192 |
0111: BSF 03.5 |
|
|
193 |
0112: BCF 06.0 |
|
|
194 |
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat |
|
|
195 |
0113: CLRWDT |
|
|
196 |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
|
|
197 |
0114: BCF 03.5 |
|
|
198 |
0115: BCF 06.0 |
|
|
199 |
0116: BSF 03.5 |
|
|
200 |
0117: BCF 06.0 |
|
|
201 |
.................... } |
|
|
202 |
0118: BCF 03.5 |
|
|
203 |
0119: RETLW 00 |
|
|
204 |
.................... |
|
|
205 |
.................... |
|
|
206 |
.................... // Odesle bajt do registru LCD |
|
|
207 |
.................... // |
|
|
208 |
.................... // Pokud je Adr=0 .. instrukcni registr |
|
|
209 |
.................... // Pokud je Adr=1 .. datovy registr |
|
|
210 |
.................... // |
|
|
211 |
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n ) |
|
|
212 |
.................... { |
|
|
213 |
.................... output_bit(LCD_RS,Adr); // vyber registr |
|
|
214 |
011A: MOVF 3A,F |
|
|
215 |
011B: BTFSS 03.2 |
|
|
216 |
011C: GOTO 11F |
|
|
217 |
011D: BCF 06.1 |
|
|
218 |
011E: GOTO 120 |
|
|
219 |
011F: BSF 06.1 |
|
|
220 |
0120: BSF 03.5 |
|
|
221 |
0121: BCF 06.1 |
|
|
222 |
.................... swap(n); |
|
|
223 |
0122: BCF 03.5 |
|
|
224 |
0123: SWAPF 3B,F |
|
|
225 |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
|
|
226 |
0124: MOVF 3B,W |
|
|
227 |
0125: MOVWF 3C |
|
|
228 |
0126: CALL 105 |
|
|
229 |
.................... swap(n); |
|
|
230 |
0127: SWAPF 3B,F |
|
|
231 |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
|
|
232 |
0128: MOVF 3B,W |
|
|
233 |
0129: MOVWF 3C |
|
|
234 |
012A: CALL 105 |
|
|
235 |
.................... delay_us(40); // minimalni doba na provedeni prikazu |
|
|
236 |
012B: CLRWDT |
|
|
237 |
012C: MOVLW 0C |
|
|
238 |
012D: MOVWF 77 |
|
|
239 |
012E: DECFSZ 77,F |
|
|
240 |
012F: GOTO 12E |
|
|
241 |
0130: GOTO 131 |
|
|
242 |
.................... } |
|
|
243 |
0131: RETLW 00 |
|
|
244 |
.................... |
|
|
245 |
.................... |
|
|
246 |
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje |
|
|
247 |
.................... // |
|
|
248 |
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur |
|
|
249 |
.................... // |
|
|
250 |
.................... void lcd_init() |
|
|
251 |
.................... { |
|
|
252 |
.................... |
|
|
253 |
.................... int i; // pocitadlo cyklu |
|
|
254 |
.................... |
|
|
255 |
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni |
|
|
256 |
0132: MOVLW 14 |
|
|
257 |
0133: MOVWF 36 |
|
|
258 |
0134: CALL 0ED |
|
|
259 |
.................... |
|
|
260 |
.................... #ifdef LCD_DATA_LSB |
|
|
261 |
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy |
|
|
262 |
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD |
|
|
263 |
0135: MOVLW 0F |
|
|
264 |
0136: BSF 03.5 |
|
|
265 |
0137: ANDWF 07,F |
|
|
266 |
.................... #endif |
|
|
267 |
.................... |
|
|
268 |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
|
|
269 |
0138: BCF 03.5 |
|
|
270 |
0139: BCF 06.1 |
|
|
271 |
013A: BSF 03.5 |
|
|
272 |
013B: BCF 06.1 |
|
|
273 |
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav |
|
|
274 |
013C: BCF 03.5 |
|
|
275 |
013D: BCF 06.0 |
|
|
276 |
013E: BSF 03.5 |
|
|
277 |
013F: BCF 06.0 |
|
|
278 |
.................... |
|
|
279 |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
|
|
280 |
0140: BCF 03.5 |
|
|
281 |
0141: CLRF 27 |
|
|
282 |
0142: MOVF 27,W |
|
|
283 |
0143: SUBLW 02 |
|
|
284 |
0144: BTFSS 03.0 |
|
|
285 |
0145: GOTO 14E |
|
|
286 |
.................... { |
|
|
287 |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
|
|
288 |
0146: MOVLW 02 |
|
|
289 |
0147: MOVWF 36 |
|
|
290 |
0148: CALL 0ED |
|
|
291 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
|
|
292 |
0149: MOVLW 03 |
|
|
293 |
014A: MOVWF 3C |
|
|
294 |
014B: CALL 105 |
|
|
295 |
.................... } |
|
|
296 |
014C: INCF 27,F |
|
|
297 |
014D: GOTO 142 |
|
|
298 |
.................... |
|
|
299 |
.................... delay_us(40); // cas na zpracovani |
|
|
300 |
014E: CLRWDT |
|
|
301 |
014F: MOVLW 0C |
|
|
302 |
0150: MOVWF 77 |
|
|
303 |
0151: DECFSZ 77,F |
|
|
304 |
0152: GOTO 151 |
|
|
305 |
0153: GOTO 154 |
|
|
306 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
|
|
307 |
0154: MOVLW 02 |
|
|
308 |
0155: MOVWF 3C |
|
|
309 |
0156: CALL 105 |
|
|
310 |
.................... delay_us(40); // cas na zpracovani |
|
|
311 |
0157: CLRWDT |
|
|
312 |
0158: MOVLW 0C |
|
|
313 |
0159: MOVWF 77 |
|
|
314 |
015A: DECFSZ 77,F |
|
|
315 |
015B: GOTO 15A |
|
|
316 |
015C: GOTO 15D |
|
|
317 |
.................... |
|
|
318 |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
|
|
319 |
015D: CLRF 27 |
|
|
320 |
015E: MOVF 27,W |
|
|
321 |
015F: SUBLW 02 |
|
|
322 |
0160: BTFSS 03.0 |
|
|
323 |
0161: GOTO 16E |
|
|
324 |
.................... { |
|
|
325 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
|
|
326 |
0162: MOVF 27,W |
|
|
327 |
0163: CALL 004 |
|
|
328 |
0164: MOVWF 28 |
|
|
329 |
0165: CLRF 3A |
|
|
330 |
0166: MOVF 28,W |
|
|
331 |
0167: MOVWF 3B |
|
|
332 |
0168: CALL 11A |
|
|
333 |
.................... delay_ms(2); |
|
|
334 |
0169: MOVLW 02 |
|
|
335 |
016A: MOVWF 36 |
|
|
336 |
016B: CALL 0ED |
|
|
337 |
.................... } |
|
|
338 |
016C: INCF 27,F |
|
|
339 |
016D: GOTO 15E |
|
|
340 |
.................... } |
|
|
341 |
016E: GOTO 3C8 (RETURN) |
|
|
342 |
.................... |
|
|
343 |
.................... |
|
|
344 |
.................... // Proved presun kurzoru |
|
|
345 |
.................... // |
|
|
346 |
.................... // Pozice 1.1 je domu |
|
|
347 |
.................... // |
|
|
348 |
.................... void lcd_gotoxy( BYTE x, BYTE y) |
|
|
349 |
.................... { |
|
|
350 |
.................... |
|
|
351 |
.................... BYTE Adr; |
|
|
352 |
.................... |
|
|
353 |
.................... Adr=x-1; |
|
|
354 |
* |
|
|
355 |
0201: MOVLW 01 |
|
|
356 |
0202: SUBWF 36,W |
|
|
357 |
0203: MOVWF 38 |
|
|
358 |
.................... if(y==2) |
|
|
359 |
0204: MOVF 37,W |
|
|
360 |
0205: SUBLW 02 |
|
|
361 |
0206: BTFSS 03.2 |
|
|
362 |
0207: GOTO 20A |
|
|
363 |
.................... Adr+=LCD_LINE_2; |
|
|
364 |
0208: MOVLW 40 |
|
|
365 |
0209: ADDWF 38,F |
|
|
366 |
.................... |
|
|
367 |
.................... lcd_send_byte(0,0x80|Adr); |
|
|
368 |
020A: MOVF 38,W |
|
|
369 |
020B: IORLW 80 |
|
|
370 |
020C: MOVWF 39 |
|
|
371 |
020D: CLRF 3A |
|
|
372 |
020E: MOVF 39,W |
|
|
373 |
020F: MOVWF 3B |
|
|
374 |
0210: CALL 11A |
|
|
375 |
.................... } |
|
|
376 |
0211: RETLW 00 |
|
|
377 |
.................... |
|
|
378 |
.................... |
|
|
379 |
.................... // Zapis znaku na displej, zpracovani ridicich znaku |
|
|
380 |
.................... // |
|
|
381 |
.................... void lcd_putc( char c) |
|
|
382 |
.................... { |
|
|
383 |
.................... |
|
|
384 |
.................... switch (c) |
|
|
385 |
.................... { |
|
|
386 |
0212: MOVF 35,W |
|
|
387 |
0213: XORLW 0C |
|
|
388 |
0214: BTFSC 03.2 |
|
|
389 |
0215: GOTO 220 |
|
|
390 |
0216: XORLW 06 |
|
|
391 |
0217: BTFSC 03.2 |
|
|
392 |
0218: GOTO 228 |
|
|
393 |
0219: XORLW 07 |
|
|
394 |
021A: BTFSC 03.2 |
|
|
395 |
021B: GOTO 22E |
|
|
396 |
021C: XORLW 05 |
|
|
397 |
021D: BTFSC 03.2 |
|
|
398 |
021E: GOTO 233 |
|
|
399 |
021F: GOTO 238 |
|
|
400 |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
|
|
401 |
0220: CLRF 3A |
|
|
402 |
0221: MOVLW 01 |
|
|
403 |
0222: MOVWF 3B |
|
|
404 |
0223: CALL 11A |
|
|
405 |
.................... delay_ms(2); |
|
|
406 |
0224: MOVLW 02 |
|
|
407 |
0225: MOVWF 36 |
|
|
408 |
0226: CALL 0ED |
|
|
409 |
.................... break; |
|
|
410 |
0227: GOTO 244 |
|
|
411 |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
|
|
412 |
0228: MOVLW 01 |
|
|
413 |
0229: MOVWF 36 |
|
|
414 |
022A: MOVLW 02 |
|
|
415 |
022B: MOVWF 37 |
|
|
416 |
022C: CALL 201 |
|
|
417 |
022D: GOTO 244 |
|
|
418 |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
|
|
419 |
022E: MOVLW 01 |
|
|
420 |
022F: MOVWF 36 |
|
|
421 |
0230: MOVWF 37 |
|
|
422 |
0231: CALL 201 |
|
|
423 |
0232: GOTO 244 |
|
|
424 |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
|
|
425 |
0233: CLRF 3A |
|
|
426 |
0234: MOVLW 10 |
|
|
427 |
0235: MOVWF 3B |
|
|
428 |
0236: CALL 11A |
|
|
429 |
0237: GOTO 244 |
|
|
430 |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
|
|
431 |
0238: MOVF 35,W |
|
|
432 |
0239: SUBLW 1F |
|
|
433 |
023A: BTFSS 03.0 |
|
|
434 |
023B: GOTO 23E |
|
|
435 |
023C: MOVLW 07 |
|
|
436 |
023D: ANDWF 35,F |
|
|
437 |
.................... lcd_send_byte(1,c); break; // zapis znak |
|
|
438 |
023E: MOVLW 01 |
|
|
439 |
023F: MOVWF 3A |
|
|
440 |
0240: MOVF 35,W |
|
|
441 |
0241: MOVWF 3B |
|
|
442 |
0242: CALL 11A |
|
|
443 |
0243: GOTO 244 |
|
|
444 |
.................... } |
|
|
445 |
.................... } |
|
|
446 |
0244: RETLW 00 |
|
|
447 |
.................... |
|
|
448 |
.................... |
|
|
449 |
.................... // Zapni kurzor |
|
|
450 |
.................... // |
|
|
451 |
.................... void lcd_cursor_on() |
|
|
452 |
.................... { |
|
|
453 |
.................... lcd_send_byte(0,LCD_CURSOR_ON_); |
|
|
454 |
.................... } |
|
|
455 |
.................... |
|
|
456 |
.................... |
|
|
457 |
.................... // Vypni kurzor |
|
|
458 |
.................... // |
|
|
459 |
.................... void lcd_cursor_off() |
|
|
460 |
.................... { |
|
|
461 |
.................... lcd_send_byte(0,LCD_CURSOR_OFF_); |
|
|
462 |
.................... } |
|
|
463 |
.................... |
|
|
464 |
.................... |
|
|
465 |
.................... // Smaz displej |
|
|
466 |
.................... // |
|
|
467 |
.................... void lcd_clr() |
|
|
468 |
.................... { |
|
|
469 |
.................... lcd_putc('\f'); |
|
|
470 |
.................... } |
|
|
471 |
.................... |
|
|
472 |
.................... |
|
|
473 |
.................... // Definice vlastnich fontu |
|
|
474 |
.................... // |
|
|
475 |
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje |
|
|
476 |
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden |
|
|
477 |
.................... // priklad pouziti definovanych znaku. |
|
|
478 |
.................... |
|
|
479 |
.................... |
|
|
480 |
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje |
|
|
481 |
.................... // |
|
|
482 |
.................... void lcd_putc2(int Data) |
|
|
483 |
.................... { |
|
|
484 |
.................... lcd_send_byte(1,Data); |
|
|
485 |
.................... } |
|
|
486 |
.................... |
|
|
487 |
.................... |
|
|
488 |
.................... // Pomocne definice pro programovani obsahu CGRAM |
|
|
489 |
.................... // |
|
|
490 |
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2) |
|
|
491 |
.................... #define lcd_define_def(String) printf(lcd_putc2,String); |
|
|
492 |
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2) |
|
|
493 |
.................... |
|
|
494 |
.................... |
|
|
495 |
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def |
|
|
496 |
.................... // |
|
|
497 |
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end(); |
|
|
498 |
.................... |
|
|
499 |
.................... |
|
|
500 |
.................... // Pripravene definice fontu vybranych znaku |
|
|
501 |
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80 |
|
|
502 |
.................... // |
|
|
503 |
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */ |
|
|
504 |
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */ |
|
|
505 |
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */ |
|
|
506 |
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */ |
|
|
507 |
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */ |
|
|
508 |
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */ |
|
|
509 |
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */ |
|
|
510 |
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */ |
|
|
511 |
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */ |
|
|
512 |
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */ |
|
|
513 |
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */ |
|
|
514 |
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */ |
|
|
515 |
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */ |
|
|
516 |
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */ |
|
|
517 |
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */ |
|
|
518 |
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */ |
|
|
519 |
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */ |
|
|
520 |
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */ |
|
|
521 |
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */ |
|
|
522 |
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */ |
|
|
523 |
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */ |
|
|
524 |
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */ |
|
|
525 |
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */ |
|
|
526 |
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */ |
|
|
527 |
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */ |
|
|
528 |
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */ |
|
|
529 |
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */ |
|
|
530 |
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */ |
|
|
531 |
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */ |
|
|
532 |
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */ |
|
|
533 |
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */ |
|
|
534 |
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */ |
|
|
535 |
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */ |
|
|
536 |
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */ |
|
|
537 |
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */ |
|
|
538 |
.................... |
|
|
539 |
.................... |
|
|
540 |
.................... // Priklad pouziti definovanych znaku |
|
|
541 |
.................... // |
|
|
542 |
.................... // |
|
|
543 |
.................... //void lcd_sample() |
|
|
544 |
.................... //{ |
|
|
545 |
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0 |
|
|
546 |
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2 |
|
|
547 |
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji |
|
|
548 |
.................... // // jediny definicni retezec) |
|
|
549 |
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3 |
|
|
550 |
.................... // delay_ms(1000); |
|
|
551 |
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0 |
|
|
552 |
.................... // delay_ms(1000); |
|
|
553 |
.................... //} |
|
|
554 |
.................... |
|
|
555 |
.................... |
|
|
556 |
.................... void main() |
|
|
557 |
.................... { |
|
|
558 |
* |
|
|
559 |
036E: CLRF 04 |
|
|
560 |
036F: BCF 03.7 |
|
|
561 |
0370: MOVLW 1F |
|
|
562 |
0371: ANDWF 03,F |
|
|
563 |
0372: BSF 03.5 |
|
|
564 |
0373: BSF 1F.0 |
|
|
565 |
0374: BSF 1F.1 |
|
|
566 |
0375: BSF 1F.2 |
|
|
567 |
0376: BCF 1F.3 |
|
|
568 |
0377: MOVLW 07 |
|
|
569 |
0378: MOVWF 1C |
|
|
570 |
.................... unsigned int16 I; |
|
|
571 |
.................... float E; |
|
|
572 |
.................... |
|
|
573 |
.................... setup_adc_ports(AN0); |
|
|
574 |
* |
|
|
575 |
037C: BSF 03.5 |
|
|
576 |
037D: BCF 1F.0 |
|
|
577 |
037E: BSF 1F.1 |
|
|
578 |
037F: BSF 1F.2 |
|
|
579 |
0380: BSF 1F.3 |
|
|
580 |
.................... setup_adc(ADC_CLOCK_DIV_32); |
|
|
581 |
0381: BCF 1F.6 |
|
|
582 |
0382: BCF 03.5 |
|
|
583 |
0383: BCF 1F.6 |
|
|
584 |
0384: BSF 1F.7 |
|
|
585 |
0385: BSF 03.5 |
|
|
586 |
0386: BSF 1F.7 |
|
|
587 |
0387: BCF 03.5 |
|
|
588 |
0388: BSF 1F.0 |
|
|
589 |
.................... setup_psp(PSP_DISABLED); |
|
|
590 |
0389: BSF 03.5 |
|
|
591 |
038A: BCF 09.4 |
|
|
592 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
593 |
* |
|
|
594 |
0379: MOVLW FF |
|
|
595 |
037A: BCF 03.5 |
|
|
596 |
037B: MOVWF 20 |
|
|
597 |
* |
|
|
598 |
038B: BCF 03.5 |
|
|
599 |
038C: BCF 14.5 |
|
|
600 |
038D: BCF 20.5 |
|
|
601 |
038E: MOVF 20,W |
|
|
602 |
038F: BSF 03.5 |
|
|
603 |
0390: MOVWF 07 |
|
|
604 |
0391: BCF 03.5 |
|
|
605 |
0392: BSF 20.4 |
|
|
606 |
0393: MOVF 20,W |
|
|
607 |
0394: BSF 03.5 |
|
|
608 |
0395: MOVWF 07 |
|
|
609 |
0396: BCF 03.5 |
|
|
610 |
0397: BCF 20.3 |
|
|
611 |
0398: MOVF 20,W |
|
|
612 |
0399: BSF 03.5 |
|
|
613 |
039A: MOVWF 07 |
|
|
614 |
039B: MOVLW 01 |
|
|
615 |
039C: BCF 03.5 |
|
|
616 |
039D: MOVWF 14 |
|
|
617 |
039E: MOVLW 00 |
|
|
618 |
039F: BSF 03.5 |
|
|
619 |
03A0: MOVWF 14 |
|
|
620 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
621 |
03A1: MOVF 01,W |
|
|
622 |
03A2: ANDLW C7 |
|
|
623 |
03A3: IORLW 08 |
|
|
624 |
03A4: MOVWF 01 |
|
|
625 |
.................... setup_timer_1(T1_DISABLED); |
|
|
626 |
03A5: BCF 03.5 |
|
|
627 |
03A6: CLRF 10 |
|
|
628 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
629 |
03A7: MOVLW 00 |
|
|
630 |
03A8: MOVWF 78 |
|
|
631 |
03A9: MOVWF 12 |
|
|
632 |
03AA: MOVLW 00 |
|
|
633 |
03AB: BSF 03.5 |
|
|
634 |
03AC: MOVWF 12 |
|
|
635 |
.................... setup_comparator(NC_NC_NC_NC); |
|
|
636 |
03AD: MOVLW 07 |
|
|
637 |
03AE: MOVWF 1C |
|
|
638 |
03AF: MOVF 05,W |
|
|
639 |
03B0: CLRWDT |
|
|
640 |
03B1: MOVLW 02 |
|
|
641 |
03B2: MOVWF 77 |
|
|
642 |
03B3: DECFSZ 77,F |
|
|
643 |
03B4: GOTO 3B3 |
|
|
644 |
03B5: GOTO 3B6 |
|
|
645 |
03B6: MOVF 1C,W |
|
|
646 |
03B7: BCF 03.5 |
|
|
647 |
03B8: BCF 0D.6 |
|
|
648 |
.................... setup_vref(FALSE); |
|
|
649 |
03B9: BSF 03.5 |
|
|
650 |
03BA: CLRF 1D |
|
|
651 |
.................... |
|
|
652 |
.................... set_adc_channel (IN); |
|
|
653 |
03BB: MOVLW 00 |
|
|
654 |
03BC: MOVWF 78 |
|
|
655 |
03BD: BCF 03.5 |
|
|
656 |
03BE: MOVF 1F,W |
|
|
657 |
03BF: ANDLW C7 |
|
|
658 |
03C0: IORWF 78,W |
|
|
659 |
03C1: MOVWF 1F |
|
|
660 |
.................... delay_us(20); |
|
|
661 |
03C2: CLRWDT |
|
|
662 |
03C3: MOVLW 06 |
|
|
663 |
03C4: MOVWF 77 |
|
|
664 |
03C5: DECFSZ 77,F |
|
|
665 |
03C6: GOTO 3C5 |
|
|
666 |
.................... lcd_init(); |
|
|
667 |
03C7: GOTO 132 |
|
|
668 |
.................... |
|
|
669 |
.................... while(TRUE) |
|
|
670 |
.................... { |
|
|
671 |
.................... |
|
|
672 |
.................... I=read_adc(); |
|
|
673 |
03C8: BSF 1F.2 |
|
|
674 |
03C9: BTFSC 1F.2 |
|
|
675 |
03CA: GOTO 3C9 |
|
|
676 |
03CB: BSF 03.5 |
|
|
677 |
03CC: MOVF 1E,W |
|
|
678 |
03CD: BCF 03.5 |
|
|
679 |
03CE: MOVWF 21 |
|
|
680 |
03CF: MOVF 1E,W |
|
|
681 |
03D0: MOVWF 22 |
|
|
682 |
.................... delay_us(600); |
|
|
683 |
03D1: CLRWDT |
|
|
684 |
03D2: MOVLW C7 |
|
|
685 |
03D3: MOVWF 77 |
|
|
686 |
03D4: DECFSZ 77,F |
|
|
687 |
03D5: GOTO 3D4 |
|
|
688 |
03D6: NOP |
|
|
689 |
.................... E=0.0577*I; |
|
|
690 |
03D7: MOVF 22,W |
|
|
691 |
03D8: MOVWF 28 |
|
|
692 |
03D9: MOVF 21,W |
|
|
693 |
03DA: MOVWF 27 |
|
|
694 |
03DB: GOTO 16F |
|
|
695 |
03DC: MOVLW D6 |
|
|
696 |
03DD: MOVWF 38 |
|
|
697 |
03DE: MOVLW 56 |
|
|
698 |
03DF: MOVWF 37 |
|
|
699 |
03E0: MOVLW 6C |
|
|
700 |
03E1: MOVWF 36 |
|
|
701 |
03E2: MOVLW 7A |
|
|
702 |
03E3: MOVWF 35 |
|
|
703 |
03E4: MOVF 7A,W |
|
|
704 |
03E5: MOVWF 3C |
|
|
705 |
03E6: MOVF 79,W |
|
|
706 |
03E7: MOVWF 3B |
|
|
707 |
03E8: MOVF 78,W |
|
|
708 |
03E9: MOVWF 3A |
|
|
709 |
03EA: MOVF 77,W |
|
|
710 |
03EB: MOVWF 39 |
|
|
711 |
03EC: CALL 18C |
|
|
712 |
03ED: MOVF 7A,W |
|
|
713 |
03EE: MOVWF 26 |
|
|
714 |
03EF: MOVF 79,W |
|
|
715 |
03F0: MOVWF 25 |
|
|
716 |
03F1: MOVF 78,W |
|
|
717 |
03F2: MOVWF 24 |
|
|
718 |
03F3: MOVF 77,W |
|
|
719 |
03F4: MOVWF 23 |
|
|
720 |
.................... |
|
|
721 |
.................... printf(lcd_putc," E=%2.2f lx \n",E); |
|
|
722 |
03F5: CLRF 27 |
|
|
723 |
03F6: MOVF 27,W |
|
|
724 |
03F7: CALL 00C |
|
|
725 |
03F8: INCF 27,F |
|
|
726 |
03F9: MOVWF 77 |
|
|
727 |
03FA: MOVWF 35 |
|
|
728 |
03FB: CALL 212 |
|
|
729 |
03FC: MOVLW 04 |
|
|
730 |
03FD: SUBWF 27,W |
|
|
731 |
03FE: BTFSS 03.2 |
|
|
732 |
03FF: GOTO 3F6 |
|
|
733 |
0400: MOVLW 89 |
|
|
734 |
0401: MOVWF 04 |
|
|
735 |
0402: MOVF 26,W |
|
|
736 |
0403: MOVWF 2B |
|
|
737 |
0404: MOVF 25,W |
|
|
738 |
0405: MOVWF 2A |
|
|
739 |
0406: MOVF 24,W |
|
|
740 |
0407: MOVWF 29 |
|
|
741 |
0408: MOVF 23,W |
|
|
742 |
0409: MOVWF 28 |
|
|
743 |
040A: MOVLW 02 |
|
|
744 |
040B: MOVWF 2C |
|
|
745 |
040C: GOTO 287 |
|
|
746 |
040D: MOVLW 09 |
|
|
747 |
040E: MOVWF 28 |
|
|
748 |
040F: MOVF 28,W |
|
|
749 |
0410: CALL 00C |
|
|
750 |
0411: INCF 28,F |
|
|
751 |
0412: MOVWF 77 |
|
|
752 |
0413: MOVWF 35 |
|
|
753 |
0414: CALL 212 |
|
|
754 |
0415: MOVLW 16 |
|
|
755 |
0416: SUBWF 28,W |
|
|
756 |
0417: BTFSS 03.2 |
|
|
757 |
0418: GOTO 40F |
|
|
758 |
.................... if(I<=128) |
|
|
759 |
0419: MOVF 22,F |
|
|
760 |
041A: BTFSS 03.2 |
|
|
761 |
041B: GOTO 42B |
|
|
762 |
041C: MOVF 21,W |
|
|
763 |
041D: SUBLW 80 |
|
|
764 |
041E: BTFSS 03.0 |
|
|
765 |
041F: GOTO 42B |
|
|
766 |
.................... printf(lcd_putc,"** \r"); |
|
|
767 |
0420: CLRF 27 |
|
|
768 |
0421: MOVF 27,W |
|
|
769 |
0422: CALL 027 |
|
|
770 |
0423: INCF 27,F |
|
|
771 |
0424: MOVWF 77 |
|
|
772 |
0425: MOVWF 35 |
|
|
773 |
0426: CALL 212 |
|
|
774 |
0427: MOVLW 11 |
|
|
775 |
0428: SUBWF 27,W |
|
|
776 |
0429: BTFSS 03.2 |
|
|
777 |
042A: GOTO 421 |
|
|
778 |
.................... if(I>128&&I<=256) |
|
|
779 |
042B: MOVF 22,F |
|
|
780 |
042C: BTFSS 03.2 |
|
|
781 |
042D: GOTO 432 |
|
|
782 |
042E: MOVF 21,W |
|
|
783 |
042F: SUBLW 80 |
|
|
784 |
0430: BTFSC 03.0 |
|
|
785 |
0431: GOTO 447 |
|
|
786 |
0432: MOVF 22,W |
|
|
787 |
0433: SUBLW 01 |
|
|
788 |
0434: BTFSS 03.0 |
|
|
789 |
0435: GOTO 447 |
|
|
790 |
0436: BTFSS 03.2 |
|
|
791 |
0437: GOTO 43C |
|
|
792 |
0438: MOVF 21,W |
|
|
793 |
0439: SUBLW 00 |
|
|
794 |
043A: BTFSS 03.0 |
|
|
795 |
043B: GOTO 447 |
|
|
796 |
.................... printf(lcd_putc,"**** \r"); |
|
|
797 |
043C: CLRF 27 |
|
|
798 |
043D: MOVF 27,W |
|
|
799 |
043E: CALL 03D |
|
|
800 |
043F: INCF 27,F |
|
|
801 |
0440: MOVWF 77 |
|
|
802 |
0441: MOVWF 35 |
|
|
803 |
0442: CALL 212 |
|
|
804 |
0443: MOVLW 11 |
|
|
805 |
0444: SUBWF 27,W |
|
|
806 |
0445: BTFSS 03.2 |
|
|
807 |
0446: GOTO 43D |
|
|
808 |
.................... if(I>256&&I<=384) |
|
|
809 |
0447: MOVF 22,W |
|
|
810 |
0448: SUBLW 00 |
|
|
811 |
0449: BTFSC 03.0 |
|
|
812 |
044A: GOTO 467 |
|
|
813 |
044B: XORLW FF |
|
|
814 |
044C: BTFSS 03.2 |
|
|
815 |
044D: GOTO 452 |
|
|
816 |
044E: MOVF 21,W |
|
|
817 |
044F: SUBLW 00 |
|
|
818 |
0450: BTFSC 03.0 |
|
|
819 |
0451: GOTO 467 |
|
|
820 |
0452: MOVF 22,W |
|
|
821 |
0453: SUBLW 01 |
|
|
822 |
0454: BTFSS 03.0 |
|
|
823 |
0455: GOTO 467 |
|
|
824 |
0456: BTFSS 03.2 |
|
|
825 |
0457: GOTO 45C |
|
|
826 |
0458: MOVF 21,W |
|
|
827 |
0459: SUBLW 80 |
|
|
828 |
045A: BTFSS 03.0 |
|
|
829 |
045B: GOTO 467 |
|
|
830 |
.................... printf(lcd_putc,"****** \r"); |
|
|
831 |
045C: CLRF 27 |
|
|
832 |
045D: MOVF 27,W |
|
|
833 |
045E: CALL 053 |
|
|
834 |
045F: INCF 27,F |
|
|
835 |
0460: MOVWF 77 |
|
|
836 |
0461: MOVWF 35 |
|
|
837 |
0462: CALL 212 |
|
|
838 |
0463: MOVLW 11 |
|
|
839 |
0464: SUBWF 27,W |
|
|
840 |
0465: BTFSS 03.2 |
|
|
841 |
0466: GOTO 45D |
|
|
842 |
.................... if(I>384&&I<=512) |
|
|
843 |
0467: MOVF 22,W |
|
|
844 |
0468: SUBLW 00 |
|
|
845 |
0469: BTFSC 03.0 |
|
|
846 |
046A: GOTO 487 |
|
|
847 |
046B: XORLW FF |
|
|
848 |
046C: BTFSS 03.2 |
|
|
849 |
046D: GOTO 472 |
|
|
850 |
046E: MOVF 21,W |
|
|
851 |
046F: SUBLW 80 |
|
|
852 |
0470: BTFSC 03.0 |
|
|
853 |
0471: GOTO 487 |
|
|
854 |
0472: MOVF 22,W |
|
|
855 |
0473: SUBLW 02 |
|
|
856 |
0474: BTFSS 03.0 |
|
|
857 |
0475: GOTO 487 |
|
|
858 |
0476: BTFSS 03.2 |
|
|
859 |
0477: GOTO 47C |
|
|
860 |
0478: MOVF 21,W |
|
|
861 |
0479: SUBLW 00 |
|
|
862 |
047A: BTFSS 03.0 |
|
|
863 |
047B: GOTO 487 |
|
|
864 |
.................... printf(lcd_putc,"******** \r"); |
|
|
865 |
047C: CLRF 27 |
|
|
866 |
047D: MOVF 27,W |
|
|
867 |
047E: CALL 069 |
|
|
868 |
047F: INCF 27,F |
|
|
869 |
0480: MOVWF 77 |
|
|
870 |
0481: MOVWF 35 |
|
|
871 |
0482: CALL 212 |
|
|
872 |
0483: MOVLW 11 |
|
|
873 |
0484: SUBWF 27,W |
|
|
874 |
0485: BTFSS 03.2 |
|
|
875 |
0486: GOTO 47D |
|
|
876 |
.................... if(I>512&&I<=640) |
|
|
877 |
0487: MOVF 22,W |
|
|
878 |
0488: SUBLW 01 |
|
|
879 |
0489: BTFSC 03.0 |
|
|
880 |
048A: GOTO 4A7 |
|
|
881 |
048B: XORLW FF |
|
|
882 |
048C: BTFSS 03.2 |
|
|
883 |
048D: GOTO 492 |
|
|
884 |
048E: MOVF 21,W |
|
|
885 |
048F: SUBLW 00 |
|
|
886 |
0490: BTFSC 03.0 |
|
|
887 |
0491: GOTO 4A7 |
|
|
888 |
0492: MOVF 22,W |
|
|
889 |
0493: SUBLW 02 |
|
|
890 |
0494: BTFSS 03.0 |
|
|
891 |
0495: GOTO 4A7 |
|
|
892 |
0496: BTFSS 03.2 |
|
|
893 |
0497: GOTO 49C |
|
|
894 |
0498: MOVF 21,W |
|
|
895 |
0499: SUBLW 80 |
|
|
896 |
049A: BTFSS 03.0 |
|
|
897 |
049B: GOTO 4A7 |
|
|
898 |
.................... printf(lcd_putc,"********** \r"); |
|
|
899 |
049C: CLRF 27 |
|
|
900 |
049D: MOVF 27,W |
|
|
901 |
049E: CALL 07F |
|
|
902 |
049F: INCF 27,F |
|
|
903 |
04A0: MOVWF 77 |
|
|
904 |
04A1: MOVWF 35 |
|
|
905 |
04A2: CALL 212 |
|
|
906 |
04A3: MOVLW 11 |
|
|
907 |
04A4: SUBWF 27,W |
|
|
908 |
04A5: BTFSS 03.2 |
|
|
909 |
04A6: GOTO 49D |
|
|
910 |
.................... if(I>640&&I<=768) |
|
|
911 |
04A7: MOVF 22,W |
|
|
912 |
04A8: SUBLW 01 |
|
|
913 |
04A9: BTFSC 03.0 |
|
|
914 |
04AA: GOTO 4C7 |
|
|
915 |
04AB: XORLW FF |
|
|
916 |
04AC: BTFSS 03.2 |
|
|
917 |
04AD: GOTO 4B2 |
|
|
918 |
04AE: MOVF 21,W |
|
|
919 |
04AF: SUBLW 80 |
|
|
920 |
04B0: BTFSC 03.0 |
|
|
921 |
04B1: GOTO 4C7 |
|
|
922 |
04B2: MOVF 22,W |
|
|
923 |
04B3: SUBLW 03 |
|
|
924 |
04B4: BTFSS 03.0 |
|
|
925 |
04B5: GOTO 4C7 |
|
|
926 |
04B6: BTFSS 03.2 |
|
|
927 |
04B7: GOTO 4BC |
|
|
928 |
04B8: MOVF 21,W |
|
|
929 |
04B9: SUBLW 00 |
|
|
930 |
04BA: BTFSS 03.0 |
|
|
931 |
04BB: GOTO 4C7 |
|
|
932 |
.................... printf(lcd_putc,"************ \r"); |
|
|
933 |
04BC: CLRF 27 |
|
|
934 |
04BD: MOVF 27,W |
|
|
935 |
04BE: CALL 095 |
|
|
936 |
04BF: INCF 27,F |
|
|
937 |
04C0: MOVWF 77 |
|
|
938 |
04C1: MOVWF 35 |
|
|
939 |
04C2: CALL 212 |
|
|
940 |
04C3: MOVLW 11 |
|
|
941 |
04C4: SUBWF 27,W |
|
|
942 |
04C5: BTFSS 03.2 |
|
|
943 |
04C6: GOTO 4BD |
|
|
944 |
.................... if(I>768&&I<=896) |
|
|
945 |
04C7: MOVF 22,W |
|
|
946 |
04C8: SUBLW 02 |
|
|
947 |
04C9: BTFSC 03.0 |
|
|
948 |
04CA: GOTO 4E7 |
|
|
949 |
04CB: XORLW FF |
|
|
950 |
04CC: BTFSS 03.2 |
|
|
951 |
04CD: GOTO 4D2 |
|
|
952 |
04CE: MOVF 21,W |
|
|
953 |
04CF: SUBLW 00 |
|
|
954 |
04D0: BTFSC 03.0 |
|
|
955 |
04D1: GOTO 4E7 |
|
|
956 |
04D2: MOVF 22,W |
|
|
957 |
04D3: SUBLW 03 |
|
|
958 |
04D4: BTFSS 03.0 |
|
|
959 |
04D5: GOTO 4E7 |
|
|
960 |
04D6: BTFSS 03.2 |
|
|
961 |
04D7: GOTO 4DC |
|
|
962 |
04D8: MOVF 21,W |
|
|
963 |
04D9: SUBLW 80 |
|
|
964 |
04DA: BTFSS 03.0 |
|
|
965 |
04DB: GOTO 4E7 |
|
|
966 |
.................... printf(lcd_putc,"************** \r"); |
|
|
967 |
04DC: CLRF 27 |
|
|
968 |
04DD: MOVF 27,W |
|
|
969 |
04DE: CALL 0AB |
|
|
970 |
04DF: INCF 27,F |
|
|
971 |
04E0: MOVWF 77 |
|
|
972 |
04E1: MOVWF 35 |
|
|
973 |
04E2: CALL 212 |
|
|
974 |
04E3: MOVLW 11 |
|
|
975 |
04E4: SUBWF 27,W |
|
|
976 |
04E5: BTFSS 03.2 |
|
|
977 |
04E6: GOTO 4DD |
|
|
978 |
.................... if(I>896&&I<=1016) |
|
|
979 |
04E7: MOVF 22,W |
|
|
980 |
04E8: SUBLW 02 |
|
|
981 |
04E9: BTFSC 03.0 |
|
|
982 |
04EA: GOTO 507 |
|
|
983 |
04EB: XORLW FF |
|
|
984 |
04EC: BTFSS 03.2 |
|
|
985 |
04ED: GOTO 4F2 |
|
|
986 |
04EE: MOVF 21,W |
|
|
987 |
04EF: SUBLW 80 |
|
|
988 |
04F0: BTFSC 03.0 |
|
|
989 |
04F1: GOTO 507 |
|
|
990 |
04F2: MOVF 22,W |
|
|
991 |
04F3: SUBLW 03 |
|
|
992 |
04F4: BTFSS 03.0 |
|
|
993 |
04F5: GOTO 507 |
|
|
994 |
04F6: BTFSS 03.2 |
|
|
995 |
04F7: GOTO 4FC |
|
|
996 |
04F8: MOVF 21,W |
|
|
997 |
04F9: SUBLW F8 |
|
|
998 |
04FA: BTFSS 03.0 |
|
|
999 |
04FB: GOTO 507 |
|
|
1000 |
.................... printf(lcd_putc,"****************\r"); |
|
|
1001 |
04FC: CLRF 27 |
|
|
1002 |
04FD: MOVF 27,W |
|
|
1003 |
04FE: CALL 0C1 |
|
|
1004 |
04FF: INCF 27,F |
|
|
1005 |
0500: MOVWF 77 |
|
|
1006 |
0501: MOVWF 35 |
|
|
1007 |
0502: CALL 212 |
|
|
1008 |
0503: MOVLW 11 |
|
|
1009 |
0504: SUBWF 27,W |
|
|
1010 |
0505: BTFSS 03.2 |
|
|
1011 |
0506: GOTO 4FD |
|
|
1012 |
.................... if(I>1016) |
|
|
1013 |
0507: MOVF 22,W |
|
|
1014 |
0508: SUBLW 02 |
|
|
1015 |
0509: BTFSC 03.0 |
|
|
1016 |
050A: GOTO 51D |
|
|
1017 |
050B: XORLW FF |
|
|
1018 |
050C: BTFSS 03.2 |
|
|
1019 |
050D: GOTO 512 |
|
|
1020 |
050E: MOVF 21,W |
|
|
1021 |
050F: SUBLW F8 |
|
|
1022 |
0510: BTFSC 03.0 |
|
|
1023 |
0511: GOTO 51D |
|
|
1024 |
.................... printf(lcd_putc," *** high *** \r"); |
|
|
1025 |
0512: CLRF 27 |
|
|
1026 |
0513: MOVF 27,W |
|
|
1027 |
0514: CALL 0D7 |
|
|
1028 |
0515: INCF 27,F |
|
|
1029 |
0516: MOVWF 77 |
|
|
1030 |
0517: MOVWF 35 |
|
|
1031 |
0518: CALL 212 |
|
|
1032 |
0519: MOVLW 11 |
|
|
1033 |
051A: SUBWF 27,W |
|
|
1034 |
051B: BTFSS 03.2 |
|
|
1035 |
051C: GOTO 513 |
|
|
1036 |
.................... |
|
|
1037 |
.................... delay_ms(600); |
|
|
1038 |
051D: MOVLW 03 |
|
|
1039 |
051E: MOVWF 27 |
|
|
1040 |
051F: MOVLW C8 |
|
|
1041 |
0520: MOVWF 36 |
|
|
1042 |
0521: CALL 0ED |
|
|
1043 |
0522: DECFSZ 27,F |
|
|
1044 |
0523: GOTO 51F |
|
|
1045 |
.................... } |
|
|
1046 |
0524: GOTO 3C8 |
|
|
1047 |
.................... } |
|
|
1048 |
0525: SLEEP |
|
|
1049 |
|
|
|
1050 |
Configuration Fuses: |
|
|
1051 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |