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