180 |
pavlicek |
1 |
CCS PCM C Compiler, Version 4.059d, 15399 04-IV-07 20:22 |
157 |
pavlicek |
2 |
|
|
|
3 |
Filename: main.lst |
|
|
4 |
|
180 |
pavlicek |
5 |
ROM used: 1242 words (61%) |
|
|
6 |
Largest free fragment is 806 |
157 |
pavlicek |
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 |
180 |
pavlicek |
14 |
0002: GOTO 330 |
157 |
pavlicek |
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 |
* |
180 |
pavlicek |
36 |
00AF: MOVLW 3A |
|
|
37 |
00B0: MOVWF 04 |
|
|
38 |
00B1: BCF 03.7 |
|
|
39 |
00B2: MOVF 00,W |
|
|
40 |
00B3: BTFSC 03.2 |
|
|
41 |
00B4: GOTO 0C6 |
|
|
42 |
00B5: MOVLW 01 |
|
|
43 |
00B6: MOVWF 78 |
|
|
44 |
00B7: MOVLW BF |
|
|
45 |
00B8: MOVWF 77 |
|
|
46 |
00B9: CLRWDT |
|
|
47 |
00BA: DECFSZ 77,F |
|
|
48 |
00BB: GOTO 0B9 |
|
|
49 |
00BC: DECFSZ 78,F |
|
|
50 |
00BD: GOTO 0B7 |
|
|
51 |
00BE: MOVLW 4A |
|
|
52 |
00BF: MOVWF 77 |
|
|
53 |
00C0: DECFSZ 77,F |
|
|
54 |
00C1: GOTO 0C0 |
|
|
55 |
00C2: NOP |
|
|
56 |
00C3: CLRWDT |
|
|
57 |
00C4: DECFSZ 00,F |
|
|
58 |
00C5: GOTO 0B5 |
|
|
59 |
00C6: RETLW 00 |
157 |
pavlicek |
60 |
.................... |
|
|
61 |
.................... |
|
|
62 |
.................... |
180 |
pavlicek |
63 |
.................... #define LCD_RS PIN_B0 // rizeni registru LCD displeje |
|
|
64 |
.................... #define LCD_E PIN_B1 // enable LCD displeje |
157 |
pavlicek |
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 |
180 |
pavlicek |
177 |
00C7: MOVF 07,W |
|
|
178 |
00C8: ANDLW 0F |
|
|
179 |
00C9: MOVWF 42 |
|
|
180 |
00CA: SWAPF 40,W |
|
|
181 |
00CB: MOVWF 77 |
|
|
182 |
00CC: MOVLW F0 |
|
|
183 |
00CD: ANDWF 77,F |
|
|
184 |
00CE: MOVF 77,W |
|
|
185 |
00CF: ANDLW F0 |
|
|
186 |
00D0: IORWF 42,W |
|
|
187 |
00D1: MOVWF 07 |
157 |
pavlicek |
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 |
180 |
pavlicek |
196 |
00D2: BSF 06.1 |
|
|
197 |
00D3: BSF 03.5 |
|
|
198 |
00D4: BCF 06.1 |
157 |
pavlicek |
199 |
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat |
180 |
pavlicek |
200 |
00D5: CLRWDT |
157 |
pavlicek |
201 |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
180 |
pavlicek |
202 |
00D6: BCF 03.5 |
|
|
203 |
00D7: BCF 06.1 |
|
|
204 |
00D8: BSF 03.5 |
|
|
205 |
00D9: BCF 06.1 |
157 |
pavlicek |
206 |
.................... } |
180 |
pavlicek |
207 |
00DA: BCF 03.5 |
|
|
208 |
00DB: RETLW 00 |
157 |
pavlicek |
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 |
180 |
pavlicek |
219 |
00DC: MOVF 3E,F |
|
|
220 |
00DD: BTFSS 03.2 |
|
|
221 |
00DE: GOTO 0E1 |
|
|
222 |
00DF: BCF 06.0 |
|
|
223 |
00E0: GOTO 0E2 |
|
|
224 |
00E1: BSF 06.0 |
|
|
225 |
00E2: BSF 03.5 |
|
|
226 |
00E3: BCF 06.0 |
157 |
pavlicek |
227 |
.................... swap(n); |
180 |
pavlicek |
228 |
00E4: BCF 03.5 |
|
|
229 |
00E5: SWAPF 3F,F |
157 |
pavlicek |
230 |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
180 |
pavlicek |
231 |
00E6: MOVF 3F,W |
|
|
232 |
00E7: MOVWF 40 |
|
|
233 |
00E8: CALL 0C7 |
157 |
pavlicek |
234 |
.................... swap(n); |
180 |
pavlicek |
235 |
00E9: SWAPF 3F,F |
157 |
pavlicek |
236 |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
180 |
pavlicek |
237 |
00EA: MOVF 3F,W |
|
|
238 |
00EB: MOVWF 40 |
|
|
239 |
00EC: CALL 0C7 |
157 |
pavlicek |
240 |
.................... delay_us(40); // minimalni doba na provedeni prikazu |
180 |
pavlicek |
241 |
00ED: CLRWDT |
|
|
242 |
00EE: MOVLW 0C |
|
|
243 |
00EF: MOVWF 77 |
|
|
244 |
00F0: DECFSZ 77,F |
|
|
245 |
00F1: GOTO 0F0 |
|
|
246 |
00F2: GOTO 0F3 |
157 |
pavlicek |
247 |
.................... } |
180 |
pavlicek |
248 |
00F3: RETLW 00 |
157 |
pavlicek |
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 |
180 |
pavlicek |
261 |
00F4: MOVLW 14 |
|
|
262 |
00F5: MOVWF 3A |
|
|
263 |
00F6: CALL 0AF |
157 |
pavlicek |
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 |
180 |
pavlicek |
268 |
00F7: MOVLW 0F |
|
|
269 |
00F8: BSF 03.5 |
|
|
270 |
00F9: ANDWF 07,F |
157 |
pavlicek |
271 |
.................... #endif |
|
|
272 |
.................... |
|
|
273 |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
180 |
pavlicek |
274 |
00FA: BCF 03.5 |
|
|
275 |
00FB: BCF 06.0 |
|
|
276 |
00FC: BSF 03.5 |
|
|
277 |
00FD: BCF 06.0 |
157 |
pavlicek |
278 |
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav |
180 |
pavlicek |
279 |
00FE: BCF 03.5 |
|
|
280 |
00FF: BCF 06.1 |
|
|
281 |
0100: BSF 03.5 |
|
|
282 |
0101: BCF 06.1 |
157 |
pavlicek |
283 |
.................... |
|
|
284 |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
180 |
pavlicek |
285 |
0102: BCF 03.5 |
|
|
286 |
0103: CLRF 27 |
|
|
287 |
0104: MOVF 27,W |
|
|
288 |
0105: SUBLW 02 |
|
|
289 |
0106: BTFSS 03.0 |
|
|
290 |
0107: GOTO 110 |
157 |
pavlicek |
291 |
.................... { |
|
|
292 |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
180 |
pavlicek |
293 |
0108: MOVLW 02 |
|
|
294 |
0109: MOVWF 3A |
|
|
295 |
010A: CALL 0AF |
157 |
pavlicek |
296 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
180 |
pavlicek |
297 |
010B: MOVLW 03 |
|
|
298 |
010C: MOVWF 40 |
|
|
299 |
010D: CALL 0C7 |
157 |
pavlicek |
300 |
.................... } |
180 |
pavlicek |
301 |
010E: INCF 27,F |
|
|
302 |
010F: GOTO 104 |
157 |
pavlicek |
303 |
.................... |
|
|
304 |
.................... delay_us(40); // cas na zpracovani |
180 |
pavlicek |
305 |
0110: CLRWDT |
|
|
306 |
0111: MOVLW 0C |
|
|
307 |
0112: MOVWF 77 |
|
|
308 |
0113: DECFSZ 77,F |
|
|
309 |
0114: GOTO 113 |
|
|
310 |
0115: GOTO 116 |
157 |
pavlicek |
311 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
180 |
pavlicek |
312 |
0116: MOVLW 02 |
|
|
313 |
0117: MOVWF 40 |
|
|
314 |
0118: CALL 0C7 |
157 |
pavlicek |
315 |
.................... delay_us(40); // cas na zpracovani |
180 |
pavlicek |
316 |
0119: CLRWDT |
|
|
317 |
011A: MOVLW 0C |
|
|
318 |
011B: MOVWF 77 |
|
|
319 |
011C: DECFSZ 77,F |
|
|
320 |
011D: GOTO 11C |
|
|
321 |
011E: GOTO 11F |
157 |
pavlicek |
322 |
.................... |
|
|
323 |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
180 |
pavlicek |
324 |
011F: CLRF 27 |
|
|
325 |
0120: MOVF 27,W |
|
|
326 |
0121: SUBLW 02 |
|
|
327 |
0122: BTFSS 03.0 |
|
|
328 |
0123: GOTO 130 |
157 |
pavlicek |
329 |
.................... { |
|
|
330 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
180 |
pavlicek |
331 |
0124: MOVF 27,W |
|
|
332 |
0125: CALL 004 |
|
|
333 |
0126: MOVWF 28 |
|
|
334 |
0127: CLRF 3E |
|
|
335 |
0128: MOVF 28,W |
|
|
336 |
0129: MOVWF 3F |
|
|
337 |
012A: CALL 0DC |
157 |
pavlicek |
338 |
.................... delay_ms(2); |
180 |
pavlicek |
339 |
012B: MOVLW 02 |
|
|
340 |
012C: MOVWF 3A |
|
|
341 |
012D: CALL 0AF |
157 |
pavlicek |
342 |
.................... } |
180 |
pavlicek |
343 |
012E: INCF 27,F |
|
|
344 |
012F: GOTO 120 |
157 |
pavlicek |
345 |
.................... } |
180 |
pavlicek |
346 |
0130: GOTO 38B (RETURN) |
157 |
pavlicek |
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 |
* |
180 |
pavlicek |
360 |
01C3: MOVLW 01 |
|
|
361 |
01C4: SUBWF 3A,W |
|
|
362 |
01C5: MOVWF 3C |
157 |
pavlicek |
363 |
.................... if(y==2) |
180 |
pavlicek |
364 |
01C6: MOVF 3B,W |
|
|
365 |
01C7: SUBLW 02 |
|
|
366 |
01C8: BTFSS 03.2 |
|
|
367 |
01C9: GOTO 1CC |
157 |
pavlicek |
368 |
.................... Adr+=LCD_LINE_2; |
180 |
pavlicek |
369 |
01CA: MOVLW 40 |
|
|
370 |
01CB: ADDWF 3C,F |
157 |
pavlicek |
371 |
.................... |
|
|
372 |
.................... lcd_send_byte(0,0x80|Adr); |
180 |
pavlicek |
373 |
01CC: MOVF 3C,W |
|
|
374 |
01CD: IORLW 80 |
|
|
375 |
01CE: MOVWF 3D |
|
|
376 |
01CF: CLRF 3E |
|
|
377 |
01D0: MOVF 3D,W |
|
|
378 |
01D1: MOVWF 3F |
|
|
379 |
01D2: CALL 0DC |
157 |
pavlicek |
380 |
.................... } |
180 |
pavlicek |
381 |
01D3: RETLW 00 |
157 |
pavlicek |
382 |
.................... |
|
|
383 |
.................... |
|
|
384 |
.................... // Zapis znaku na displej, zpracovani ridicich znaku |
|
|
385 |
.................... // |
|
|
386 |
.................... void lcd_putc( char c) |
|
|
387 |
.................... { |
|
|
388 |
.................... |
|
|
389 |
.................... switch (c) |
|
|
390 |
.................... { |
180 |
pavlicek |
391 |
01D4: MOVF 39,W |
|
|
392 |
01D5: XORLW 0C |
|
|
393 |
01D6: BTFSC 03.2 |
|
|
394 |
01D7: GOTO 1E2 |
|
|
395 |
01D8: XORLW 06 |
|
|
396 |
01D9: BTFSC 03.2 |
|
|
397 |
01DA: GOTO 1EA |
|
|
398 |
01DB: XORLW 07 |
|
|
399 |
01DC: BTFSC 03.2 |
|
|
400 |
01DD: GOTO 1F0 |
|
|
401 |
01DE: XORLW 05 |
|
|
402 |
01DF: BTFSC 03.2 |
|
|
403 |
01E0: GOTO 1F5 |
|
|
404 |
01E1: GOTO 1FA |
157 |
pavlicek |
405 |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
180 |
pavlicek |
406 |
01E2: CLRF 3E |
|
|
407 |
01E3: MOVLW 01 |
|
|
408 |
01E4: MOVWF 3F |
|
|
409 |
01E5: CALL 0DC |
157 |
pavlicek |
410 |
.................... delay_ms(2); |
180 |
pavlicek |
411 |
01E6: MOVLW 02 |
|
|
412 |
01E7: MOVWF 3A |
|
|
413 |
01E8: CALL 0AF |
157 |
pavlicek |
414 |
.................... break; |
180 |
pavlicek |
415 |
01E9: GOTO 206 |
157 |
pavlicek |
416 |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
180 |
pavlicek |
417 |
01EA: MOVLW 01 |
|
|
418 |
01EB: MOVWF 3A |
|
|
419 |
01EC: MOVLW 02 |
|
|
420 |
01ED: MOVWF 3B |
|
|
421 |
01EE: CALL 1C3 |
|
|
422 |
01EF: GOTO 206 |
157 |
pavlicek |
423 |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
180 |
pavlicek |
424 |
01F0: MOVLW 01 |
|
|
425 |
01F1: MOVWF 3A |
|
|
426 |
01F2: MOVWF 3B |
|
|
427 |
01F3: CALL 1C3 |
|
|
428 |
01F4: GOTO 206 |
157 |
pavlicek |
429 |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
180 |
pavlicek |
430 |
01F5: CLRF 3E |
|
|
431 |
01F6: MOVLW 10 |
|
|
432 |
01F7: MOVWF 3F |
|
|
433 |
01F8: CALL 0DC |
|
|
434 |
01F9: GOTO 206 |
157 |
pavlicek |
435 |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
180 |
pavlicek |
436 |
01FA: MOVF 39,W |
|
|
437 |
01FB: SUBLW 1F |
|
|
438 |
01FC: BTFSS 03.0 |
|
|
439 |
01FD: GOTO 200 |
|
|
440 |
01FE: MOVLW 07 |
|
|
441 |
01FF: ANDWF 39,F |
157 |
pavlicek |
442 |
.................... lcd_send_byte(1,c); break; // zapis znak |
180 |
pavlicek |
443 |
0200: MOVLW 01 |
|
|
444 |
0201: MOVWF 3E |
|
|
445 |
0202: MOVF 39,W |
|
|
446 |
0203: MOVWF 3F |
|
|
447 |
0204: CALL 0DC |
|
|
448 |
0205: GOTO 206 |
157 |
pavlicek |
449 |
.................... } |
|
|
450 |
.................... } |
180 |
pavlicek |
451 |
0206: RETLW 00 |
157 |
pavlicek |
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 |
* |
180 |
pavlicek |
564 |
0330: CLRF 04 |
|
|
565 |
0331: BCF 03.7 |
|
|
566 |
0332: MOVLW 1F |
|
|
567 |
0333: ANDWF 03,F |
|
|
568 |
0334: BSF 03.5 |
|
|
569 |
0335: BSF 1F.0 |
|
|
570 |
0336: BSF 1F.1 |
|
|
571 |
0337: BSF 1F.2 |
|
|
572 |
0338: BCF 1F.3 |
|
|
573 |
0339: MOVLW 07 |
|
|
574 |
033A: MOVWF 1C |
157 |
pavlicek |
575 |
.................... unsigned int16 I; |
|
|
576 |
.................... float E; |
|
|
577 |
.................... |
|
|
578 |
.................... port_b_pullups(TRUE); |
|
|
579 |
* |
180 |
pavlicek |
580 |
033E: BSF 03.5 |
|
|
581 |
033F: BCF 01.7 |
157 |
pavlicek |
582 |
.................... setup_adc_ports(AN0_VREF_VREF); |
180 |
pavlicek |
583 |
0340: BSF 1F.0 |
|
|
584 |
0341: BSF 1F.1 |
|
|
585 |
0342: BSF 1F.2 |
|
|
586 |
0343: BSF 1F.3 |
157 |
pavlicek |
587 |
.................... setup_adc(ADC_CLOCK_DIV_32); |
180 |
pavlicek |
588 |
0344: BCF 1F.6 |
|
|
589 |
0345: BCF 03.5 |
|
|
590 |
0346: BCF 1F.6 |
|
|
591 |
0347: BSF 1F.7 |
|
|
592 |
0348: BSF 03.5 |
|
|
593 |
0349: BSF 1F.7 |
|
|
594 |
034A: BCF 03.5 |
|
|
595 |
034B: BSF 1F.0 |
157 |
pavlicek |
596 |
.................... setup_psp(PSP_DISABLED); |
180 |
pavlicek |
597 |
034C: BSF 03.5 |
|
|
598 |
034D: BCF 09.4 |
157 |
pavlicek |
599 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
600 |
* |
180 |
pavlicek |
601 |
033B: MOVLW FF |
|
|
602 |
033C: BCF 03.5 |
|
|
603 |
033D: MOVWF 20 |
157 |
pavlicek |
604 |
* |
180 |
pavlicek |
605 |
034E: BCF 03.5 |
|
|
606 |
034F: BCF 14.5 |
|
|
607 |
0350: BCF 20.5 |
|
|
608 |
0351: MOVF 20,W |
|
|
609 |
0352: BSF 03.5 |
|
|
610 |
0353: MOVWF 07 |
|
|
611 |
0354: BCF 03.5 |
|
|
612 |
0355: BSF 20.4 |
|
|
613 |
0356: MOVF 20,W |
|
|
614 |
0357: BSF 03.5 |
|
|
615 |
0358: MOVWF 07 |
|
|
616 |
0359: BCF 03.5 |
|
|
617 |
035A: BCF 20.3 |
|
|
618 |
035B: MOVF 20,W |
|
|
619 |
035C: BSF 03.5 |
|
|
620 |
035D: MOVWF 07 |
|
|
621 |
035E: MOVLW 01 |
|
|
622 |
035F: BCF 03.5 |
|
|
623 |
0360: MOVWF 14 |
|
|
624 |
0361: MOVLW 00 |
|
|
625 |
0362: BSF 03.5 |
|
|
626 |
0363: MOVWF 14 |
157 |
pavlicek |
627 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
180 |
pavlicek |
628 |
0364: MOVF 01,W |
|
|
629 |
0365: ANDLW C7 |
|
|
630 |
0366: IORLW 08 |
|
|
631 |
0367: MOVWF 01 |
157 |
pavlicek |
632 |
.................... setup_timer_1(T1_DISABLED); |
180 |
pavlicek |
633 |
0368: BCF 03.5 |
|
|
634 |
0369: CLRF 10 |
157 |
pavlicek |
635 |
.................... setup_timer_2(T2_DISABLED,0,1); |
180 |
pavlicek |
636 |
036A: MOVLW 00 |
|
|
637 |
036B: MOVWF 78 |
|
|
638 |
036C: MOVWF 12 |
|
|
639 |
036D: MOVLW 00 |
|
|
640 |
036E: BSF 03.5 |
|
|
641 |
036F: MOVWF 12 |
157 |
pavlicek |
642 |
.................... setup_comparator(NC_NC_NC_NC); |
180 |
pavlicek |
643 |
0370: MOVLW 07 |
|
|
644 |
0371: MOVWF 1C |
|
|
645 |
0372: MOVF 05,W |
|
|
646 |
0373: CLRWDT |
|
|
647 |
0374: MOVLW 02 |
|
|
648 |
0375: MOVWF 77 |
|
|
649 |
0376: DECFSZ 77,F |
|
|
650 |
0377: GOTO 376 |
|
|
651 |
0378: GOTO 379 |
|
|
652 |
0379: MOVF 1C,W |
|
|
653 |
037A: BCF 03.5 |
|
|
654 |
037B: BCF 0D.6 |
157 |
pavlicek |
655 |
.................... setup_vref(FALSE); |
180 |
pavlicek |
656 |
037C: BSF 03.5 |
|
|
657 |
037D: CLRF 1D |
157 |
pavlicek |
658 |
.................... |
|
|
659 |
.................... set_adc_channel (IN); |
180 |
pavlicek |
660 |
037E: MOVLW 00 |
|
|
661 |
037F: MOVWF 78 |
|
|
662 |
0380: BCF 03.5 |
|
|
663 |
0381: MOVF 1F,W |
|
|
664 |
0382: ANDLW C7 |
|
|
665 |
0383: IORWF 78,W |
|
|
666 |
0384: MOVWF 1F |
157 |
pavlicek |
667 |
.................... delay_us(20); |
180 |
pavlicek |
668 |
0385: CLRWDT |
|
|
669 |
0386: MOVLW 06 |
|
|
670 |
0387: MOVWF 77 |
|
|
671 |
0388: DECFSZ 77,F |
|
|
672 |
0389: GOTO 388 |
157 |
pavlicek |
673 |
.................... lcd_init(); |
180 |
pavlicek |
674 |
038A: GOTO 0F4 |
157 |
pavlicek |
675 |
.................... |
180 |
pavlicek |
676 |
.................... |
157 |
pavlicek |
677 |
.................... while(TRUE) |
|
|
678 |
.................... { |
180 |
pavlicek |
679 |
.................... I=read_adc(); //pøeètení hodnoty z A/D pøevodníku |
|
|
680 |
038B: BSF 1F.2 |
|
|
681 |
038C: BTFSC 1F.2 |
|
|
682 |
038D: GOTO 38C |
|
|
683 |
038E: BSF 03.5 |
|
|
684 |
038F: MOVF 1E,W |
|
|
685 |
0390: BCF 03.5 |
|
|
686 |
0391: MOVWF 21 |
|
|
687 |
0392: MOVF 1E,W |
|
|
688 |
0393: MOVWF 22 |
157 |
pavlicek |
689 |
.................... delay_us(600); |
180 |
pavlicek |
690 |
0394: CLRWDT |
|
|
691 |
0395: MOVLW C7 |
|
|
692 |
0396: MOVWF 77 |
|
|
693 |
0397: DECFSZ 77,F |
|
|
694 |
0398: GOTO 397 |
|
|
695 |
0399: NOP |
|
|
696 |
.................... E=0.009775*I; //výpoèet osvìtlení k=10.0/1023 |
|
|
697 |
039A: MOVF 22,W |
|
|
698 |
039B: MOVWF 28 |
|
|
699 |
039C: MOVF 21,W |
|
|
700 |
039D: MOVWF 27 |
|
|
701 |
039E: GOTO 131 |
|
|
702 |
039F: MOVLW 52 |
|
|
703 |
03A0: MOVWF 3C |
|
|
704 |
03A1: MOVLW 27 |
|
|
705 |
03A2: MOVWF 3B |
|
|
706 |
03A3: MOVLW 20 |
|
|
707 |
03A4: MOVWF 3A |
|
|
708 |
03A5: MOVLW 78 |
|
|
709 |
03A6: MOVWF 39 |
|
|
710 |
03A7: MOVF 7A,W |
|
|
711 |
03A8: MOVWF 40 |
|
|
712 |
03A9: MOVF 79,W |
|
|
713 |
03AA: MOVWF 3F |
|
|
714 |
03AB: MOVF 78,W |
|
|
715 |
03AC: MOVWF 3E |
|
|
716 |
03AD: MOVF 77,W |
|
|
717 |
03AE: MOVWF 3D |
|
|
718 |
03AF: CALL 14E |
|
|
719 |
03B0: MOVF 7A,W |
|
|
720 |
03B1: MOVWF 26 |
|
|
721 |
03B2: MOVF 79,W |
|
|
722 |
03B3: MOVWF 25 |
|
|
723 |
03B4: MOVF 78,W |
|
|
724 |
03B5: MOVWF 24 |
|
|
725 |
03B6: MOVF 77,W |
|
|
726 |
03B7: MOVWF 23 |
|
|
727 |
.................... |
|
|
728 |
.................... |
157 |
pavlicek |
729 |
.................... if(!input(LUX1)) |
180 |
pavlicek |
730 |
03B8: BSF 03.5 |
|
|
731 |
03B9: BSF 06.2 |
|
|
732 |
03BA: BCF 03.5 |
|
|
733 |
03BB: BTFSC 06.2 |
|
|
734 |
03BC: GOTO 403 |
157 |
pavlicek |
735 |
.................... { |
180 |
pavlicek |
736 |
.................... printf(lcd_putc," E=%3.1f lx \n",10*E); |
|
|
737 |
03BD: CLRF 3C |
|
|
738 |
03BE: CLRF 3B |
|
|
739 |
03BF: MOVLW 20 |
|
|
740 |
03C0: MOVWF 3A |
|
|
741 |
03C1: MOVLW 82 |
|
|
742 |
03C2: MOVWF 39 |
|
|
743 |
03C3: MOVF 26,W |
|
|
744 |
03C4: MOVWF 40 |
|
|
745 |
03C5: MOVF 25,W |
|
|
746 |
03C6: MOVWF 3F |
|
|
747 |
03C7: MOVF 24,W |
|
|
748 |
03C8: MOVWF 3E |
|
|
749 |
03C9: MOVF 23,W |
|
|
750 |
03CA: MOVWF 3D |
|
|
751 |
03CB: CALL 14E |
|
|
752 |
03CC: MOVF 77,W |
|
|
753 |
03CD: MOVWF 27 |
|
|
754 |
03CE: MOVF 78,W |
|
|
755 |
03CF: MOVWF 28 |
|
|
756 |
03D0: MOVF 79,W |
|
|
757 |
03D1: MOVWF 29 |
|
|
758 |
03D2: MOVF 7A,W |
|
|
759 |
03D3: MOVWF 2A |
|
|
760 |
03D4: CLRF 2B |
|
|
761 |
03D5: MOVF 2B,W |
|
|
762 |
03D6: CALL 00C |
|
|
763 |
03D7: INCF 2B,F |
|
|
764 |
03D8: MOVWF 77 |
|
|
765 |
03D9: MOVWF 39 |
|
|
766 |
03DA: CALL 1D4 |
|
|
767 |
03DB: MOVLW 04 |
|
|
768 |
03DC: SUBWF 2B,W |
|
|
769 |
03DD: BTFSS 03.2 |
|
|
770 |
03DE: GOTO 3D5 |
|
|
771 |
03DF: MOVLW 02 |
|
|
772 |
03E0: MOVWF 04 |
|
|
773 |
03E1: MOVF 2A,W |
|
|
774 |
03E2: MOVWF 2F |
|
|
775 |
03E3: MOVF 29,W |
|
|
776 |
03E4: MOVWF 2E |
|
|
777 |
03E5: MOVF 28,W |
|
|
778 |
03E6: MOVWF 2D |
|
|
779 |
03E7: MOVF 27,W |
|
|
780 |
03E8: MOVWF 2C |
|
|
781 |
03E9: MOVLW 01 |
|
|
782 |
03EA: MOVWF 30 |
|
|
783 |
03EB: CALL 249 |
|
|
784 |
03EC: MOVLW 09 |
|
|
785 |
03ED: MOVWF 2C |
|
|
786 |
03EE: MOVF 2C,W |
|
|
787 |
03EF: CALL 00C |
|
|
788 |
03F0: INCF 2C,F |
|
|
789 |
03F1: MOVWF 77 |
|
|
790 |
03F2: MOVWF 39 |
|
|
791 |
03F3: CALL 1D4 |
|
|
792 |
03F4: MOVLW 0F |
|
|
793 |
03F5: SUBWF 2C,W |
|
|
794 |
03F6: BTFSS 03.2 |
|
|
795 |
03F7: GOTO 3EE |
|
|
796 |
.................... printf(lcd_putc," rozsah k1 \n\r"); |
|
|
797 |
03F8: CLRF 27 |
|
|
798 |
03F9: MOVF 27,W |
|
|
799 |
03FA: CALL 020 |
|
|
800 |
03FB: INCF 27,F |
|
|
801 |
03FC: MOVWF 77 |
|
|
802 |
03FD: MOVWF 39 |
|
|
803 |
03FE: CALL 1D4 |
|
|
804 |
03FF: MOVLW 0E |
|
|
805 |
0400: SUBWF 27,W |
|
|
806 |
0401: BTFSS 03.2 |
|
|
807 |
0402: GOTO 3F9 |
|
|
808 |
.................... //delay_ms(300); |
157 |
pavlicek |
809 |
.................... } |
|
|
810 |
.................... if(!input(LUX2)) |
180 |
pavlicek |
811 |
0403: BSF 03.5 |
|
|
812 |
0404: BSF 06.3 |
|
|
813 |
0405: BCF 03.5 |
|
|
814 |
0406: BTFSC 06.3 |
|
|
815 |
0407: GOTO 44D |
157 |
pavlicek |
816 |
.................... { |
180 |
pavlicek |
817 |
.................... printf(lcd_putc," E=%3.0f lx \n",100*E); |
|
|
818 |
0408: CLRF 3C |
|
|
819 |
0409: CLRF 3B |
|
|
820 |
040A: MOVLW 48 |
|
|
821 |
040B: MOVWF 3A |
|
|
822 |
040C: MOVLW 85 |
|
|
823 |
040D: MOVWF 39 |
|
|
824 |
040E: MOVF 26,W |
|
|
825 |
040F: MOVWF 40 |
|
|
826 |
0410: MOVF 25,W |
|
|
827 |
0411: MOVWF 3F |
|
|
828 |
0412: MOVF 24,W |
|
|
829 |
0413: MOVWF 3E |
|
|
830 |
0414: MOVF 23,W |
|
|
831 |
0415: MOVWF 3D |
|
|
832 |
0416: CALL 14E |
|
|
833 |
0417: MOVF 77,W |
|
|
834 |
0418: MOVWF 27 |
|
|
835 |
0419: MOVF 78,W |
|
|
836 |
041A: MOVWF 28 |
|
|
837 |
041B: MOVF 79,W |
|
|
838 |
041C: MOVWF 29 |
|
|
839 |
041D: MOVF 7A,W |
|
|
840 |
041E: MOVWF 2A |
|
|
841 |
041F: CLRF 2B |
|
|
842 |
0420: MOVF 2B,W |
|
|
843 |
0421: CALL 033 |
|
|
844 |
0422: INCF 2B,F |
|
|
845 |
0423: MOVWF 77 |
|
|
846 |
0424: MOVWF 39 |
|
|
847 |
0425: CALL 1D4 |
|
|
848 |
0426: MOVLW 04 |
|
|
849 |
0427: SUBWF 2B,W |
|
|
850 |
0428: BTFSS 03.2 |
|
|
851 |
0429: GOTO 420 |
|
|
852 |
042A: MOVLW 02 |
|
|
853 |
042B: MOVWF 04 |
|
|
854 |
042C: MOVF 2A,W |
|
|
855 |
042D: MOVWF 2F |
|
|
856 |
042E: MOVF 29,W |
|
|
857 |
042F: MOVWF 2E |
|
|
858 |
0430: MOVF 28,W |
|
|
859 |
0431: MOVWF 2D |
|
|
860 |
0432: MOVF 27,W |
|
|
861 |
0433: MOVWF 2C |
|
|
862 |
0434: CLRF 30 |
|
|
863 |
0435: CALL 249 |
|
|
864 |
0436: MOVLW 09 |
|
|
865 |
0437: MOVWF 2C |
|
|
866 |
0438: MOVF 2C,W |
|
|
867 |
0439: CALL 033 |
|
|
868 |
043A: INCF 2C,F |
|
|
869 |
043B: MOVWF 77 |
|
|
870 |
043C: MOVWF 39 |
|
|
871 |
043D: CALL 1D4 |
|
|
872 |
043E: MOVLW 0F |
|
|
873 |
043F: SUBWF 2C,W |
|
|
874 |
0440: BTFSS 03.2 |
|
|
875 |
0441: GOTO 438 |
|
|
876 |
.................... printf(lcd_putc," rozsah 1k \n\r"); |
|
|
877 |
0442: CLRF 27 |
|
|
878 |
0443: MOVF 27,W |
|
|
879 |
0444: CALL 047 |
|
|
880 |
0445: INCF 27,F |
|
|
881 |
0446: MOVWF 77 |
|
|
882 |
0447: MOVWF 39 |
|
|
883 |
0448: CALL 1D4 |
|
|
884 |
0449: MOVLW 0F |
|
|
885 |
044A: SUBWF 27,W |
|
|
886 |
044B: BTFSS 03.2 |
|
|
887 |
044C: GOTO 443 |
|
|
888 |
.................... //delay_ms(300); |
157 |
pavlicek |
889 |
.................... } |
|
|
890 |
.................... if(!input(LUX3)) |
180 |
pavlicek |
891 |
044D: BSF 03.5 |
|
|
892 |
044E: BSF 06.4 |
|
|
893 |
044F: BCF 03.5 |
|
|
894 |
0450: BTFSC 06.4 |
|
|
895 |
0451: GOTO 481 |
157 |
pavlicek |
896 |
.................... { |
180 |
pavlicek |
897 |
.................... printf(lcd_putc," E=%3.2f klx \n",E); |
|
|
898 |
0452: CLRF 27 |
|
|
899 |
0453: MOVF 27,W |
|
|
900 |
0454: CALL 05B |
|
|
901 |
0455: INCF 27,F |
|
|
902 |
0456: MOVWF 77 |
|
|
903 |
0457: MOVWF 39 |
|
|
904 |
0458: CALL 1D4 |
|
|
905 |
0459: MOVLW 04 |
|
|
906 |
045A: SUBWF 27,W |
|
|
907 |
045B: BTFSS 03.2 |
|
|
908 |
045C: GOTO 453 |
|
|
909 |
045D: MOVLW 02 |
|
|
910 |
045E: MOVWF 04 |
|
|
911 |
045F: MOVF 26,W |
|
|
912 |
0460: MOVWF 2F |
|
|
913 |
0461: MOVF 25,W |
|
|
914 |
0462: MOVWF 2E |
|
|
915 |
0463: MOVF 24,W |
|
|
916 |
0464: MOVWF 2D |
|
|
917 |
0465: MOVF 23,W |
|
|
918 |
0466: MOVWF 2C |
|
|
919 |
0467: MOVLW 02 |
|
|
920 |
0468: MOVWF 30 |
|
|
921 |
0469: CALL 249 |
|
|
922 |
046A: MOVLW 09 |
|
|
923 |
046B: MOVWF 28 |
|
|
924 |
046C: MOVF 28,W |
|
|
925 |
046D: CALL 05B |
|
|
926 |
046E: INCF 28,F |
|
|
927 |
046F: MOVWF 77 |
|
|
928 |
0470: MOVWF 39 |
|
|
929 |
0471: CALL 1D4 |
|
|
930 |
0472: MOVLW 10 |
|
|
931 |
0473: SUBWF 28,W |
|
|
932 |
0474: BTFSS 03.2 |
|
|
933 |
0475: GOTO 46C |
|
|
934 |
.................... printf(lcd_putc," rozsah 10k \n\r"); |
|
|
935 |
0476: CLRF 27 |
|
|
936 |
0477: MOVF 27,W |
|
|
937 |
0478: CALL 070 |
|
|
938 |
0479: INCF 27,F |
|
|
939 |
047A: MOVWF 77 |
|
|
940 |
047B: MOVWF 39 |
|
|
941 |
047C: CALL 1D4 |
|
|
942 |
047D: MOVLW 10 |
|
|
943 |
047E: SUBWF 27,W |
|
|
944 |
047F: BTFSS 03.2 |
|
|
945 |
0480: GOTO 477 |
|
|
946 |
.................... //delay_ms(300); |
157 |
pavlicek |
947 |
.................... } |
|
|
948 |
.................... if(!input(LUX4)) |
180 |
pavlicek |
949 |
0481: BSF 03.5 |
|
|
950 |
0482: BSF 06.5 |
|
|
951 |
0483: BCF 03.5 |
|
|
952 |
0484: BTFSC 06.5 |
|
|
953 |
0485: GOTO 4CC |
157 |
pavlicek |
954 |
.................... { |
180 |
pavlicek |
955 |
.................... printf(lcd_putc," E=%3.1f klx \n",10*E); |
|
|
956 |
0486: CLRF 3C |
|
|
957 |
0487: CLRF 3B |
|
|
958 |
0488: MOVLW 20 |
|
|
959 |
0489: MOVWF 3A |
|
|
960 |
048A: MOVLW 82 |
|
|
961 |
048B: MOVWF 39 |
|
|
962 |
048C: MOVF 26,W |
|
|
963 |
048D: MOVWF 40 |
|
|
964 |
048E: MOVF 25,W |
|
|
965 |
048F: MOVWF 3F |
|
|
966 |
0490: MOVF 24,W |
|
|
967 |
0491: MOVWF 3E |
|
|
968 |
0492: MOVF 23,W |
|
|
969 |
0493: MOVWF 3D |
|
|
970 |
0494: CALL 14E |
|
|
971 |
0495: MOVF 77,W |
|
|
972 |
0496: MOVWF 27 |
|
|
973 |
0497: MOVF 78,W |
|
|
974 |
0498: MOVWF 28 |
|
|
975 |
0499: MOVF 79,W |
|
|
976 |
049A: MOVWF 29 |
|
|
977 |
049B: MOVF 7A,W |
|
|
978 |
049C: MOVWF 2A |
|
|
979 |
049D: CLRF 2B |
|
|
980 |
049E: MOVF 2B,W |
|
|
981 |
049F: CALL 085 |
|
|
982 |
04A0: INCF 2B,F |
|
|
983 |
04A1: MOVWF 77 |
|
|
984 |
04A2: MOVWF 39 |
|
|
985 |
04A3: CALL 1D4 |
|
|
986 |
04A4: MOVLW 04 |
|
|
987 |
04A5: SUBWF 2B,W |
|
|
988 |
04A6: BTFSS 03.2 |
|
|
989 |
04A7: GOTO 49E |
|
|
990 |
04A8: MOVLW 02 |
|
|
991 |
04A9: MOVWF 04 |
|
|
992 |
04AA: MOVF 2A,W |
|
|
993 |
04AB: MOVWF 2F |
|
|
994 |
04AC: MOVF 29,W |
|
|
995 |
04AD: MOVWF 2E |
|
|
996 |
04AE: MOVF 28,W |
|
|
997 |
04AF: MOVWF 2D |
|
|
998 |
04B0: MOVF 27,W |
|
|
999 |
04B1: MOVWF 2C |
|
|
1000 |
04B2: MOVLW 01 |
|
|
1001 |
04B3: MOVWF 30 |
|
|
1002 |
04B4: CALL 249 |
|
|
1003 |
04B5: MOVLW 09 |
|
|
1004 |
04B6: MOVWF 2C |
|
|
1005 |
04B7: MOVF 2C,W |
|
|
1006 |
04B8: CALL 085 |
|
|
1007 |
04B9: INCF 2C,F |
|
|
1008 |
04BA: MOVWF 77 |
|
|
1009 |
04BB: MOVWF 39 |
|
|
1010 |
04BC: CALL 1D4 |
|
|
1011 |
04BD: MOVLW 10 |
|
|
1012 |
04BE: SUBWF 2C,W |
|
|
1013 |
04BF: BTFSS 03.2 |
|
|
1014 |
04C0: GOTO 4B7 |
|
|
1015 |
.................... printf(lcd_putc," rozsah 100k \n\r"); |
|
|
1016 |
04C1: CLRF 27 |
|
|
1017 |
04C2: MOVF 27,W |
|
|
1018 |
04C3: CALL 09A |
|
|
1019 |
04C4: INCF 27,F |
|
|
1020 |
04C5: MOVWF 77 |
|
|
1021 |
04C6: MOVWF 39 |
|
|
1022 |
04C7: CALL 1D4 |
|
|
1023 |
04C8: MOVLW 10 |
|
|
1024 |
04C9: SUBWF 27,W |
|
|
1025 |
04CA: BTFSS 03.2 |
|
|
1026 |
04CB: GOTO 4C2 |
|
|
1027 |
.................... //delay_ms(300); |
|
|
1028 |
.................... } |
157 |
pavlicek |
1029 |
.................... delay_ms(300); |
180 |
pavlicek |
1030 |
04CC: MOVLW 02 |
|
|
1031 |
04CD: MOVWF 27 |
|
|
1032 |
04CE: MOVLW 96 |
|
|
1033 |
04CF: MOVWF 3A |
|
|
1034 |
04D0: CALL 0AF |
|
|
1035 |
04D1: DECFSZ 27,F |
|
|
1036 |
04D2: GOTO 4CE |
|
|
1037 |
.................... while(!input(HOLD)); //podrení hodnoty |
|
|
1038 |
04D3: BSF 03.5 |
|
|
1039 |
04D4: BSF 06.6 |
|
|
1040 |
04D5: BCF 03.5 |
|
|
1041 |
04D6: BTFSS 06.6 |
|
|
1042 |
04D7: GOTO 4D3 |
|
|
1043 |
.................... } |
|
|
1044 |
04D8: GOTO 38B |
157 |
pavlicek |
1045 |
.................... } |
180 |
pavlicek |
1046 |
04D9: SLEEP |
157 |
pavlicek |
1047 |
|
|
|
1048 |
Configuration Fuses: |
|
|
1049 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |