170 |
kapl |
1 |
CCS PCM C Compiler, Version 4.059d, 15399 29-III-07 21:10 |
|
|
2 |
|
|
|
3 |
Filename: main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 627 words (31%) |
|
|
6 |
Largest free fragment is 1421 |
|
|
7 |
RAM used: 18 (5%) at main() level |
|
|
8 |
28 (8%) worst case |
|
|
9 |
Stack: 5 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 13F |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\RS\projekty\project1\main.h" |
|
|
17 |
.................... #include <16F877A.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F877A device //////////////// |
|
|
19 |
.................... #device PIC16F877A |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=8 |
|
|
23 |
.................... |
|
|
24 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
25 |
.................... #FUSES XT //Crystal osc <= 4mhz |
|
|
26 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
27 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
28 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
29 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
30 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
31 |
.................... #FUSES NOCPD //No EE protection |
|
|
32 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
33 |
.................... |
|
|
34 |
.................... #use delay(clock=4000000,RESTART_WDT) |
|
|
35 |
* |
|
|
36 |
001B: MOVLW 2D |
|
|
37 |
001C: MOVWF 04 |
|
|
38 |
001D: BCF 03.7 |
|
|
39 |
001E: MOVF 00,W |
|
|
40 |
001F: BTFSC 03.2 |
|
|
41 |
0020: GOTO 032 |
|
|
42 |
0021: MOVLW 01 |
|
|
43 |
0022: MOVWF 78 |
|
|
44 |
0023: MOVLW BF |
|
|
45 |
0024: MOVWF 77 |
|
|
46 |
0025: CLRWDT |
|
|
47 |
0026: DECFSZ 77,F |
|
|
48 |
0027: GOTO 025 |
|
|
49 |
0028: DECFSZ 78,F |
|
|
50 |
0029: GOTO 023 |
|
|
51 |
002A: MOVLW 4A |
|
|
52 |
002B: MOVWF 77 |
|
|
53 |
002C: DECFSZ 77,F |
|
|
54 |
002D: GOTO 02C |
|
|
55 |
002E: NOP |
|
|
56 |
002F: CLRWDT |
|
|
57 |
0030: DECFSZ 00,F |
|
|
58 |
0031: GOTO 021 |
|
|
59 |
0032: RETLW 00 |
|
|
60 |
.................... #use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
61 |
.................... |
|
|
62 |
.................... |
|
|
63 |
.................... |
|
|
64 |
.................... #define LCD_RS PIN_B1 // rizeni registru LCD displeje |
|
|
65 |
.................... #define LCD_E PIN_B0 // enable LCD displeje |
|
|
66 |
.................... #define LCD_DATA_LSB PIN_C0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
|
|
67 |
.................... |
|
|
68 |
.................... #include "mylcd.c" |
|
|
69 |
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem |
|
|
70 |
.................... // (c)miho 2002 |
|
|
71 |
.................... // |
|
|
72 |
.................... // Historie: |
|
|
73 |
.................... // |
|
|
74 |
.................... // 0.0 Uvodni verze se snadnou definici portu LCD displeje |
|
|
75 |
.................... // |
|
|
76 |
.................... // |
|
|
77 |
.................... // Funkce: |
|
|
78 |
.................... // |
|
|
79 |
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni |
|
|
80 |
.................... // |
|
|
81 |
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky |
|
|
82 |
.................... // \f = \x0C - nova stranka - smazani displeje |
|
|
83 |
.................... // \n = \x0A - odradkovani (prechod na druhou radku) |
|
|
84 |
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet |
|
|
85 |
.................... // \r = \x0D - goto home to position 1,1 |
|
|
86 |
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM |
|
|
87 |
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM |
|
|
88 |
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce) |
|
|
89 |
.................... // |
|
|
90 |
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu |
|
|
91 |
.................... // nekontroluje parametry |
|
|
92 |
.................... // |
|
|
93 |
.................... // lcd_cursor_on zapne kurzor |
|
|
94 |
.................... // lcd_cursor_off vypne kurzor |
|
|
95 |
.................... // |
|
|
96 |
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho |
|
|
97 |
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM. |
|
|
98 |
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7. |
|
|
99 |
.................... // Na konci se provede lcd_gotoxy(1,1). |
|
|
100 |
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku |
|
|
101 |
.................... // |
|
|
102 |
.................... // Definice portu: |
|
|
103 |
.................... // |
|
|
104 |
.................... // #DEFINE LCD_RS PIN_B2 // rizeni registru LCD displeje |
|
|
105 |
.................... // #DEFINE LCD_E PIN_B1 // enable LCD displeje |
|
|
106 |
.................... // #DEFINE LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou) |
|
|
107 |
.................... |
|
|
108 |
.................... |
|
|
109 |
.................... |
|
|
110 |
.................... |
|
|
111 |
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje |
|
|
112 |
.................... |
|
|
113 |
.................... |
|
|
114 |
.................... |
|
|
115 |
.................... |
|
|
116 |
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne |
|
|
117 |
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva |
|
|
118 |
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu |
|
|
119 |
.................... // |
|
|
120 |
.................... #DEFINE LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu dataoveho kanalu v datovem portu |
|
|
121 |
.................... #DEFINE LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu |
|
|
122 |
.................... #DEFINE LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru |
|
|
123 |
.................... #DEFINE LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu |
|
|
124 |
.................... // |
|
|
125 |
.................... #IF LCD_SHIFT>4 // kontrola mezi |
|
|
126 |
.................... #ERROR LCD data port LSB bit not in range 0..4 |
|
|
127 |
.................... #ENDIF |
|
|
128 |
.................... |
|
|
129 |
.................... |
|
|
130 |
.................... // Definice konstant pro LCD display |
|
|
131 |
.................... // |
|
|
132 |
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem |
|
|
133 |
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor |
|
|
134 |
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky |
|
|
135 |
.................... |
|
|
136 |
.................... |
|
|
137 |
.................... // Definice rezimu LCD displeje |
|
|
138 |
.................... // |
|
|
139 |
.................... BYTE const LCD_INIT_STRING[4] = |
|
|
140 |
.................... { |
|
|
141 |
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7 |
|
|
142 |
.................... LCD_CURSOR_OFF_, // display on, kurzor off, |
|
|
143 |
.................... 0x01, // clear displeje |
|
|
144 |
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava) |
|
|
145 |
.................... }; |
|
|
146 |
.................... |
|
|
147 |
.................... |
|
|
148 |
.................... // Odesle nibble do displeje (posle data a klikne signalem e) |
|
|
149 |
.................... // |
|
|
150 |
.................... void lcd_send_nibble( BYTE n ) |
|
|
151 |
.................... { |
|
|
152 |
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej |
|
|
153 |
0033: MOVF 07,W |
|
|
154 |
0034: ANDLW F0 |
|
|
155 |
0035: MOVWF 34 |
|
|
156 |
0036: MOVF 33,W |
|
|
157 |
0037: ANDLW 0F |
|
|
158 |
0038: IORWF 34,W |
|
|
159 |
0039: MOVWF 07 |
|
|
160 |
.................... output_bit(LCD_E,1); // vzestupna hrana |
|
|
161 |
003A: BSF 06.0 |
|
|
162 |
003B: BSF 03.5 |
|
|
163 |
003C: BCF 06.0 |
|
|
164 |
.................... delay_us(100); // pockej alespon 450ns od e nebo alespon 195ns od dat |
|
|
165 |
003D: CLRWDT |
|
|
166 |
003E: MOVLW 20 |
|
|
167 |
003F: MOVWF 77 |
|
|
168 |
0040: DECFSZ 77,F |
|
|
169 |
0041: GOTO 040 |
|
|
170 |
0042: GOTO 043 |
|
|
171 |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
|
|
172 |
0043: BCF 03.5 |
|
|
173 |
0044: BCF 06.0 |
|
|
174 |
0045: BSF 03.5 |
|
|
175 |
0046: BCF 06.0 |
|
|
176 |
.................... } |
|
|
177 |
0047: BCF 03.5 |
|
|
178 |
0048: RETLW 00 |
|
|
179 |
.................... |
|
|
180 |
.................... |
|
|
181 |
.................... // Odesle bajt do registru LCD |
|
|
182 |
.................... // |
|
|
183 |
.................... // Pokud je Adr=0 .. instrukcni registr |
|
|
184 |
.................... // Pokud je Adr=1 .. datovy registr |
|
|
185 |
.................... // |
|
|
186 |
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n ) |
|
|
187 |
.................... { |
|
|
188 |
.................... output_bit(LCD_RS,Adr); // vyber registr |
|
|
189 |
0049: MOVF 31,F |
|
|
190 |
004A: BTFSS 03.2 |
|
|
191 |
004B: GOTO 04E |
|
|
192 |
004C: BCF 06.1 |
|
|
193 |
004D: GOTO 04F |
|
|
194 |
004E: BSF 06.1 |
|
|
195 |
004F: BSF 03.5 |
|
|
196 |
0050: BCF 06.1 |
|
|
197 |
.................... swap(n); |
|
|
198 |
0051: BCF 03.5 |
|
|
199 |
0052: SWAPF 32,F |
|
|
200 |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
|
|
201 |
0053: MOVF 32,W |
|
|
202 |
0054: MOVWF 33 |
|
|
203 |
0055: CALL 033 |
|
|
204 |
.................... swap(n); |
|
|
205 |
0056: SWAPF 32,F |
|
|
206 |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
|
|
207 |
0057: MOVF 32,W |
|
|
208 |
0058: MOVWF 33 |
|
|
209 |
0059: CALL 033 |
|
|
210 |
.................... delay_us(200); // minimalni doba na provedeni prikazu |
|
|
211 |
005A: CLRWDT |
|
|
212 |
005B: MOVLW 42 |
|
|
213 |
005C: MOVWF 77 |
|
|
214 |
005D: DECFSZ 77,F |
|
|
215 |
005E: GOTO 05D |
|
|
216 |
.................... } |
|
|
217 |
005F: RETLW 00 |
|
|
218 |
.................... |
|
|
219 |
.................... |
|
|
220 |
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje |
|
|
221 |
.................... // |
|
|
222 |
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur |
|
|
223 |
.................... // |
|
|
224 |
.................... void lcd_init() |
|
|
225 |
.................... { |
|
|
226 |
.................... |
|
|
227 |
.................... int i; // pocitadlo cyklu |
|
|
228 |
.................... |
|
|
229 |
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni |
|
|
230 |
0060: MOVLW 14 |
|
|
231 |
0061: MOVWF 2D |
|
|
232 |
0062: CALL 01B |
|
|
233 |
.................... |
|
|
234 |
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD |
|
|
235 |
0063: MOVLW F0 |
|
|
236 |
0064: BSF 03.5 |
|
|
237 |
0065: ANDWF 07,F |
|
|
238 |
.................... |
|
|
239 |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
|
|
240 |
0066: BCF 03.5 |
|
|
241 |
0067: BCF 06.1 |
|
|
242 |
0068: BSF 03.5 |
|
|
243 |
0069: BCF 06.1 |
|
|
244 |
.................... output_bit(LCD_E,0); // nastav jako vystup a nastav klidovy stav |
|
|
245 |
006A: BCF 03.5 |
|
|
246 |
006B: BCF 06.0 |
|
|
247 |
006C: BSF 03.5 |
|
|
248 |
006D: BCF 06.0 |
|
|
249 |
.................... |
|
|
250 |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
|
|
251 |
006E: BCF 03.5 |
|
|
252 |
006F: CLRF 2A |
|
|
253 |
0070: MOVF 2A,W |
|
|
254 |
0071: SUBLW 02 |
|
|
255 |
0072: BTFSS 03.0 |
|
|
256 |
0073: GOTO 07C |
|
|
257 |
.................... { |
|
|
258 |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
|
|
259 |
0074: MOVLW 02 |
|
|
260 |
0075: MOVWF 2D |
|
|
261 |
0076: CALL 01B |
|
|
262 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
|
|
263 |
0077: MOVLW 03 |
|
|
264 |
0078: MOVWF 33 |
|
|
265 |
0079: CALL 033 |
|
|
266 |
.................... } |
|
|
267 |
007A: INCF 2A,F |
|
|
268 |
007B: GOTO 070 |
|
|
269 |
.................... |
|
|
270 |
.................... delay_us(40); // cas na zpracovani |
|
|
271 |
007C: CLRWDT |
|
|
272 |
007D: MOVLW 0C |
|
|
273 |
007E: MOVWF 77 |
|
|
274 |
007F: DECFSZ 77,F |
|
|
275 |
0080: GOTO 07F |
|
|
276 |
0081: GOTO 082 |
|
|
277 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
|
|
278 |
0082: MOVLW 02 |
|
|
279 |
0083: MOVWF 33 |
|
|
280 |
0084: CALL 033 |
|
|
281 |
.................... delay_us(40); // cas na zpracovani |
|
|
282 |
0085: CLRWDT |
|
|
283 |
0086: MOVLW 0C |
|
|
284 |
0087: MOVWF 77 |
|
|
285 |
0088: DECFSZ 77,F |
|
|
286 |
0089: GOTO 088 |
|
|
287 |
008A: GOTO 08B |
|
|
288 |
.................... |
|
|
289 |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
|
|
290 |
008B: CLRF 2A |
|
|
291 |
008C: MOVF 2A,W |
|
|
292 |
008D: SUBLW 02 |
|
|
293 |
008E: BTFSS 03.0 |
|
|
294 |
008F: GOTO 09C |
|
|
295 |
.................... { |
|
|
296 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
|
|
297 |
0090: MOVF 2A,W |
|
|
298 |
0091: CALL 004 |
|
|
299 |
0092: MOVWF 2B |
|
|
300 |
0093: CLRF 31 |
|
|
301 |
0094: MOVF 2B,W |
|
|
302 |
0095: MOVWF 32 |
|
|
303 |
0096: CALL 049 |
|
|
304 |
.................... delay_ms(2); |
|
|
305 |
0097: MOVLW 02 |
|
|
306 |
0098: MOVWF 2D |
|
|
307 |
0099: CALL 01B |
|
|
308 |
.................... } |
|
|
309 |
009A: INCF 2A,F |
|
|
310 |
009B: GOTO 08C |
|
|
311 |
.................... } |
|
|
312 |
009C: GOTO 190 (RETURN) |
|
|
313 |
.................... |
|
|
314 |
.................... |
|
|
315 |
.................... // Proved presun kurzoru |
|
|
316 |
.................... // |
|
|
317 |
.................... // Pozice 1.1 je domu |
|
|
318 |
.................... // |
|
|
319 |
.................... #separate |
|
|
320 |
.................... void lcd_gotoxy( BYTE x, BYTE y) |
|
|
321 |
.................... { |
|
|
322 |
.................... |
|
|
323 |
.................... BYTE Adr; |
|
|
324 |
.................... |
|
|
325 |
.................... switch(y) |
|
|
326 |
.................... { |
|
|
327 |
009D: MOVLW 01 |
|
|
328 |
009E: SUBWF 2E,W |
|
|
329 |
009F: ADDLW FC |
|
|
330 |
00A0: BTFSC 03.0 |
|
|
331 |
00A1: GOTO 0AF |
|
|
332 |
00A2: ADDLW 04 |
|
|
333 |
00A3: GOTO 0BA |
|
|
334 |
.................... case 1: Adr=0; break; |
|
|
335 |
00A4: CLRF 2F |
|
|
336 |
00A5: GOTO 0AF |
|
|
337 |
.................... case 2: Adr=0x40; break; |
|
|
338 |
00A6: MOVLW 40 |
|
|
339 |
00A7: MOVWF 2F |
|
|
340 |
00A8: GOTO 0AF |
|
|
341 |
.................... case 3: Adr=0x14; break; |
|
|
342 |
00A9: MOVLW 14 |
|
|
343 |
00AA: MOVWF 2F |
|
|
344 |
00AB: GOTO 0AF |
|
|
345 |
.................... case 4: Adr=0x54; break; |
|
|
346 |
00AC: MOVLW 54 |
|
|
347 |
00AD: MOVWF 2F |
|
|
348 |
00AE: GOTO 0AF |
|
|
349 |
.................... } |
|
|
350 |
.................... Adr+=x-1; |
|
|
351 |
00AF: MOVLW 01 |
|
|
352 |
00B0: SUBWF 2D,W |
|
|
353 |
00B1: ADDWF 2F,F |
|
|
354 |
.................... |
|
|
355 |
.................... lcd_send_byte(0,0x80|Adr); |
|
|
356 |
00B2: MOVF 2F,W |
|
|
357 |
00B3: IORLW 80 |
|
|
358 |
00B4: MOVWF 30 |
|
|
359 |
00B5: CLRF 31 |
|
|
360 |
00B6: MOVF 30,W |
|
|
361 |
00B7: MOVWF 32 |
|
|
362 |
00B8: CALL 049 |
|
|
363 |
.................... } |
|
|
364 |
00B9: RETLW 00 |
|
|
365 |
.................... |
|
|
366 |
.................... |
|
|
367 |
.................... // Zapis znaku na displej, zpracovani ridicich znaku |
|
|
368 |
.................... // |
|
|
369 |
.................... #separate |
|
|
370 |
.................... void lcd_putc( char c) |
|
|
371 |
.................... { |
|
|
372 |
.................... |
|
|
373 |
.................... switch (c) |
|
|
374 |
.................... { |
|
|
375 |
* |
|
|
376 |
00C2: MOVF 2C,W |
|
|
377 |
00C3: XORLW 0C |
|
|
378 |
00C4: BTFSC 03.2 |
|
|
379 |
00C5: GOTO 0D0 |
|
|
380 |
00C6: XORLW 06 |
|
|
381 |
00C7: BTFSC 03.2 |
|
|
382 |
00C8: GOTO 0D8 |
|
|
383 |
00C9: XORLW 07 |
|
|
384 |
00CA: BTFSC 03.2 |
|
|
385 |
00CB: GOTO 0DE |
|
|
386 |
00CC: XORLW 05 |
|
|
387 |
00CD: BTFSC 03.2 |
|
|
388 |
00CE: GOTO 0E3 |
|
|
389 |
00CF: GOTO 0E8 |
|
|
390 |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
|
|
391 |
00D0: CLRF 31 |
|
|
392 |
00D1: MOVLW 01 |
|
|
393 |
00D2: MOVWF 32 |
|
|
394 |
00D3: CALL 049 |
|
|
395 |
.................... delay_ms(2); |
|
|
396 |
00D4: MOVLW 02 |
|
|
397 |
00D5: MOVWF 2D |
|
|
398 |
00D6: CALL 01B |
|
|
399 |
.................... break; |
|
|
400 |
00D7: GOTO 0F4 |
|
|
401 |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
|
|
402 |
00D8: MOVLW 01 |
|
|
403 |
00D9: MOVWF 2D |
|
|
404 |
00DA: MOVLW 02 |
|
|
405 |
00DB: MOVWF 2E |
|
|
406 |
00DC: CALL 09D |
|
|
407 |
00DD: GOTO 0F4 |
|
|
408 |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
|
|
409 |
00DE: MOVLW 01 |
|
|
410 |
00DF: MOVWF 2D |
|
|
411 |
00E0: MOVWF 2E |
|
|
412 |
00E1: CALL 09D |
|
|
413 |
00E2: GOTO 0F4 |
|
|
414 |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
|
|
415 |
00E3: CLRF 31 |
|
|
416 |
00E4: MOVLW 10 |
|
|
417 |
00E5: MOVWF 32 |
|
|
418 |
00E6: CALL 049 |
|
|
419 |
00E7: GOTO 0F4 |
|
|
420 |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
|
|
421 |
00E8: MOVF 2C,W |
|
|
422 |
00E9: SUBLW 1F |
|
|
423 |
00EA: BTFSS 03.0 |
|
|
424 |
00EB: GOTO 0EE |
|
|
425 |
00EC: MOVLW 07 |
|
|
426 |
00ED: ANDWF 2C,F |
|
|
427 |
.................... lcd_send_byte(1,c); break; // zapis znak |
|
|
428 |
00EE: MOVLW 01 |
|
|
429 |
00EF: MOVWF 31 |
|
|
430 |
00F0: MOVF 2C,W |
|
|
431 |
00F1: MOVWF 32 |
|
|
432 |
00F2: CALL 049 |
|
|
433 |
00F3: GOTO 0F4 |
|
|
434 |
.................... } |
|
|
435 |
.................... } |
|
|
436 |
00F4: RETLW 00 |
|
|
437 |
.................... |
|
|
438 |
.................... |
|
|
439 |
.................... // Zapni kurzor |
|
|
440 |
.................... // |
|
|
441 |
.................... void lcd_cursor_on() |
|
|
442 |
.................... { |
|
|
443 |
.................... lcd_send_byte(0,LCD_CURSOR_ON_); |
|
|
444 |
.................... } |
|
|
445 |
.................... |
|
|
446 |
.................... |
|
|
447 |
.................... // Vypni kurzor |
|
|
448 |
.................... // |
|
|
449 |
.................... void lcd_cursor_off() |
|
|
450 |
.................... { |
|
|
451 |
.................... lcd_send_byte(0,LCD_CURSOR_OFF_); |
|
|
452 |
.................... } |
|
|
453 |
.................... |
|
|
454 |
.................... |
|
|
455 |
.................... // Definice vlastnich fontu |
|
|
456 |
.................... // |
|
|
457 |
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje |
|
|
458 |
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden |
|
|
459 |
.................... // priklad pouziti definovanych znaku. |
|
|
460 |
.................... |
|
|
461 |
.................... |
|
|
462 |
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje |
|
|
463 |
.................... // |
|
|
464 |
.................... void lcd_putc2(int Data) |
|
|
465 |
.................... { |
|
|
466 |
.................... lcd_send_byte(1,Data); |
|
|
467 |
.................... } |
|
|
468 |
.................... |
|
|
469 |
.................... |
|
|
470 |
.................... // Pomocne definice pro programovani obsahu CGRAM |
|
|
471 |
.................... // |
|
|
472 |
.................... #DEFINE lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2) |
|
|
473 |
.................... #DEFINE lcd_define_def(String) printf(lcd_putc2,String); |
|
|
474 |
.................... #DEFINE lcd_define_end() lcd_send_byte(0,3); delay_ms(2) |
|
|
475 |
.................... |
|
|
476 |
.................... |
|
|
477 |
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def |
|
|
478 |
.................... // |
|
|
479 |
.................... #DEFINE lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end(); |
|
|
480 |
.................... |
|
|
481 |
.................... |
|
|
482 |
.................... // Pripravene definice fontu vybranych znaku |
|
|
483 |
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80 |
|
|
484 |
.................... // |
|
|
485 |
.................... #DEFINE LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */ |
|
|
486 |
.................... #DEFINE LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */ |
|
|
487 |
.................... #DEFINE LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */ |
|
|
488 |
.................... #DEFINE LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */ |
|
|
489 |
.................... #DEFINE LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */ |
|
|
490 |
.................... #DEFINE LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */ |
|
|
491 |
.................... #DEFINE LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */ |
|
|
492 |
.................... #DEFINE LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */ |
|
|
493 |
.................... #DEFINE LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */ |
|
|
494 |
.................... #DEFINE LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */ |
|
|
495 |
.................... #DEFINE LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */ |
|
|
496 |
.................... #DEFINE LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */ |
|
|
497 |
.................... #DEFINE LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */ |
|
|
498 |
.................... #DEFINE LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */ |
|
|
499 |
.................... #DEFINE LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */ |
|
|
500 |
.................... #DEFINE LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */ |
|
|
501 |
.................... #DEFINE LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */ |
|
|
502 |
.................... #DEFINE LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */ |
|
|
503 |
.................... #DEFINE LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */ |
|
|
504 |
.................... #DEFINE LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */ |
|
|
505 |
.................... #DEFINE LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */ |
|
|
506 |
.................... #DEFINE LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */ |
|
|
507 |
.................... #DEFINE LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */ |
|
|
508 |
.................... #DEFINE LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */ |
|
|
509 |
.................... #DEFINE LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */ |
|
|
510 |
.................... #DEFINE LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */ |
|
|
511 |
.................... #DEFINE LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */ |
|
|
512 |
.................... #DEFINE LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */ |
|
|
513 |
.................... #DEFINE LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */ |
|
|
514 |
.................... #DEFINE LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */ |
|
|
515 |
.................... #DEFINE LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */ |
|
|
516 |
.................... #DEFINE LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */ |
|
|
517 |
.................... #DEFINE LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */ |
|
|
518 |
.................... |
|
|
519 |
.................... |
|
|
520 |
.................... // Priklad pouziti definovanych znaku |
|
|
521 |
.................... // |
|
|
522 |
.................... // |
|
|
523 |
.................... //void lcd_sample() |
|
|
524 |
.................... //{ |
|
|
525 |
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0 |
|
|
526 |
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2 |
|
|
527 |
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji |
|
|
528 |
.................... // // jediny definicni retezec) |
|
|
529 |
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3 |
|
|
530 |
.................... // delay_ms(1000); |
|
|
531 |
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0 |
|
|
532 |
.................... // delay_ms(1000); |
|
|
533 |
.................... //} |
|
|
534 |
.................... |
|
|
535 |
.................... |
|
|
536 |
.................... void main() |
|
|
537 |
.................... { |
|
|
538 |
* |
|
|
539 |
013F: CLRF 04 |
|
|
540 |
0140: BCF 03.7 |
|
|
541 |
0141: MOVLW 1F |
|
|
542 |
0142: ANDWF 03,F |
|
|
543 |
0143: MOVLW 0C |
|
|
544 |
0144: BSF 03.5 |
|
|
545 |
0145: MOVWF 19 |
|
|
546 |
0146: MOVLW A6 |
|
|
547 |
0147: MOVWF 18 |
|
|
548 |
0148: MOVLW 90 |
|
|
549 |
0149: BCF 03.5 |
|
|
550 |
014A: MOVWF 18 |
|
|
551 |
014B: BSF 03.5 |
|
|
552 |
014C: BSF 1F.0 |
|
|
553 |
014D: BSF 1F.1 |
|
|
554 |
014E: BSF 1F.2 |
|
|
555 |
014F: BCF 1F.3 |
|
|
556 |
0150: MOVLW 07 |
|
|
557 |
0151: MOVWF 1C |
|
|
558 |
.................... char odp[8]; |
|
|
559 |
.................... int i; |
|
|
560 |
.................... setup_adc_ports(NO_ANALOGS); |
|
|
561 |
* |
|
|
562 |
0155: BSF 03.5 |
|
|
563 |
0156: BSF 1F.0 |
|
|
564 |
0157: BSF 1F.1 |
|
|
565 |
0158: BSF 1F.2 |
|
|
566 |
0159: BCF 1F.3 |
|
|
567 |
.................... setup_adc(ADC_OFF); |
|
|
568 |
015A: BCF 03.5 |
|
|
569 |
015B: BCF 1F.0 |
|
|
570 |
.................... setup_psp(PSP_DISABLED); |
|
|
571 |
015C: BSF 03.5 |
|
|
572 |
015D: BCF 09.4 |
|
|
573 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
574 |
* |
|
|
575 |
0152: MOVLW FF |
|
|
576 |
0153: BCF 03.5 |
|
|
577 |
0154: MOVWF 20 |
|
|
578 |
* |
|
|
579 |
015E: BCF 03.5 |
|
|
580 |
015F: BCF 14.5 |
|
|
581 |
0160: BCF 20.5 |
|
|
582 |
0161: MOVF 20,W |
|
|
583 |
0162: BSF 03.5 |
|
|
584 |
0163: MOVWF 07 |
|
|
585 |
0164: BCF 03.5 |
|
|
586 |
0165: BSF 20.4 |
|
|
587 |
0166: MOVF 20,W |
|
|
588 |
0167: BSF 03.5 |
|
|
589 |
0168: MOVWF 07 |
|
|
590 |
0169: BCF 03.5 |
|
|
591 |
016A: BCF 20.3 |
|
|
592 |
016B: MOVF 20,W |
|
|
593 |
016C: BSF 03.5 |
|
|
594 |
016D: MOVWF 07 |
|
|
595 |
016E: MOVLW 01 |
|
|
596 |
016F: BCF 03.5 |
|
|
597 |
0170: MOVWF 14 |
|
|
598 |
0171: MOVLW 00 |
|
|
599 |
0172: BSF 03.5 |
|
|
600 |
0173: MOVWF 14 |
|
|
601 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
602 |
0174: MOVF 01,W |
|
|
603 |
0175: ANDLW C7 |
|
|
604 |
0176: IORLW 08 |
|
|
605 |
0177: MOVWF 01 |
|
|
606 |
.................... setup_timer_1(T1_DISABLED); |
|
|
607 |
0178: BCF 03.5 |
|
|
608 |
0179: CLRF 10 |
|
|
609 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
610 |
017A: MOVLW 00 |
|
|
611 |
017B: MOVWF 78 |
|
|
612 |
017C: MOVWF 12 |
|
|
613 |
017D: MOVLW 00 |
|
|
614 |
017E: BSF 03.5 |
|
|
615 |
017F: MOVWF 12 |
|
|
616 |
.................... setup_comparator(NC_NC_NC_NC); |
|
|
617 |
0180: MOVLW 07 |
|
|
618 |
0181: MOVWF 1C |
|
|
619 |
0182: MOVF 05,W |
|
|
620 |
0183: CLRWDT |
|
|
621 |
0184: MOVLW 02 |
|
|
622 |
0185: MOVWF 77 |
|
|
623 |
0186: DECFSZ 77,F |
|
|
624 |
0187: GOTO 186 |
|
|
625 |
0188: GOTO 189 |
|
|
626 |
0189: MOVF 1C,W |
|
|
627 |
018A: BCF 03.5 |
|
|
628 |
018B: BCF 0D.6 |
|
|
629 |
.................... setup_vref(FALSE); |
|
|
630 |
018C: BSF 03.5 |
|
|
631 |
018D: CLRF 1D |
|
|
632 |
.................... lcd_init(); |
|
|
633 |
018E: BCF 03.5 |
|
|
634 |
018F: GOTO 060 |
|
|
635 |
.................... |
|
|
636 |
.................... printf("AT+CMGL=1\r"); //vycti prijate SMS |
|
|
637 |
0190: CLRF 2A |
|
|
638 |
0191: MOVF 2A,W |
|
|
639 |
0192: CALL 00C |
|
|
640 |
0193: INCF 2A,F |
|
|
641 |
0194: MOVWF 77 |
|
|
642 |
0195: MOVF 77,W |
|
|
643 |
0196: BTFSS 0C.4 |
|
|
644 |
0197: GOTO 196 |
|
|
645 |
0198: MOVWF 19 |
|
|
646 |
0199: MOVLW 0A |
|
|
647 |
019A: SUBWF 2A,W |
|
|
648 |
019B: BTFSS 03.2 |
|
|
649 |
019C: GOTO 191 |
|
|
650 |
.................... gets(odp); //uloz odpoved prikazu do odp |
|
|
651 |
019D: MOVLW 21 |
|
|
652 |
019E: MOVWF 04 |
|
|
653 |
019F: BCF 03.7 |
|
|
654 |
01A0: DECF 04,F |
|
|
655 |
01A1: INCF 04,F |
|
|
656 |
01A2: BTFSS 0C.5 |
|
|
657 |
01A3: GOTO 1A2 |
|
|
658 |
01A4: MOVF 1A,W |
|
|
659 |
01A5: MOVWF 00 |
|
|
660 |
01A6: MOVLW 0D |
|
|
661 |
01A7: SUBWF 00,W |
|
|
662 |
01A8: BTFSS 03.2 |
|
|
663 |
01A9: GOTO 1A1 |
|
|
664 |
01AA: CLRF 00 |
|
|
665 |
.................... getc(); //preskoc 0A |
|
|
666 |
01AB: BTFSS 0C.5 |
|
|
667 |
01AC: GOTO 1AB |
|
|
668 |
01AD: MOVF 1A,W |
|
|
669 |
.................... getc(); //preskoc 0D |
|
|
670 |
01AE: BTFSS 0C.5 |
|
|
671 |
01AF: GOTO 1AE |
|
|
672 |
01B0: MOVF 1A,W |
|
|
673 |
.................... gets(odp); //uloz pocatek odpovedi do odp |
|
|
674 |
01B1: MOVLW 21 |
|
|
675 |
01B2: MOVWF 04 |
|
|
676 |
01B3: BCF 03.7 |
|
|
677 |
01B4: DECF 04,F |
|
|
678 |
01B5: INCF 04,F |
|
|
679 |
01B6: BTFSS 0C.5 |
|
|
680 |
01B7: GOTO 1B6 |
|
|
681 |
01B8: MOVF 1A,W |
|
|
682 |
01B9: MOVWF 00 |
|
|
683 |
01BA: MOVLW 0D |
|
|
684 |
01BB: SUBWF 00,W |
|
|
685 |
01BC: BTFSS 03.2 |
|
|
686 |
01BD: GOTO 1B5 |
|
|
687 |
01BE: CLRF 00 |
|
|
688 |
.................... for(i=0;i<55;i++) //preskoc nedulezite informace |
|
|
689 |
01BF: CLRF 29 |
|
|
690 |
01C0: MOVF 29,W |
|
|
691 |
01C1: SUBLW 36 |
|
|
692 |
01C2: BTFSS 03.0 |
|
|
693 |
01C3: GOTO 1C9 |
|
|
694 |
.................... { |
|
|
695 |
.................... getc(); |
|
|
696 |
01C4: BTFSS 0C.5 |
|
|
697 |
01C5: GOTO 1C4 |
|
|
698 |
01C6: MOVF 1A,W |
|
|
699 |
.................... } |
|
|
700 |
01C7: INCF 29,F |
|
|
701 |
01C8: GOTO 1C0 |
|
|
702 |
.................... gets(odp); //uloz zakodovany text SMS |
|
|
703 |
01C9: MOVLW 21 |
|
|
704 |
01CA: MOVWF 04 |
|
|
705 |
01CB: BCF 03.7 |
|
|
706 |
01CC: DECF 04,F |
|
|
707 |
01CD: INCF 04,F |
|
|
708 |
01CE: BTFSS 0C.5 |
|
|
709 |
01CF: GOTO 1CE |
|
|
710 |
01D0: MOVF 1A,W |
|
|
711 |
01D1: MOVWF 00 |
|
|
712 |
01D2: MOVLW 0D |
|
|
713 |
01D3: SUBWF 00,W |
|
|
714 |
01D4: BTFSS 03.2 |
|
|
715 |
01D5: GOTO 1CD |
|
|
716 |
01D6: CLRF 00 |
|
|
717 |
.................... printf(lcd_putc,"%s\n",odp); |
|
|
718 |
01D7: MOVLW 21 |
|
|
719 |
01D8: MOVWF 04 |
|
|
720 |
01D9: BCF 03.7 |
|
|
721 |
01DA: MOVLW 00 |
|
|
722 |
01DB: IORWF 00,W |
|
|
723 |
01DC: BTFSC 03.2 |
|
|
724 |
01DD: GOTO 1EE |
|
|
725 |
01DE: CLRF 2B |
|
|
726 |
01DF: MOVF 04,W |
|
|
727 |
01E0: MOVWF 2A |
|
|
728 |
01E1: BCF 2B.0 |
|
|
729 |
01E2: BTFSC 03.7 |
|
|
730 |
01E3: BSF 2B.0 |
|
|
731 |
01E4: MOVF 00,W |
|
|
732 |
01E5: MOVWF 2C |
|
|
733 |
01E6: CALL 0C2 |
|
|
734 |
01E7: MOVF 2A,W |
|
|
735 |
01E8: MOVWF 04 |
|
|
736 |
01E9: BCF 03.7 |
|
|
737 |
01EA: BTFSC 2B.0 |
|
|
738 |
01EB: BSF 03.7 |
|
|
739 |
01EC: INCF 04,F |
|
|
740 |
01ED: GOTO 1DA |
|
|
741 |
01EE: MOVLW 0A |
|
|
742 |
01EF: MOVWF 2C |
|
|
743 |
01F0: CALL 0C2 |
|
|
744 |
.................... |
|
|
745 |
.................... if(odp[0]==0) odp[1]='0'; // Prevod z ASCII do DEC |
|
|
746 |
01F1: MOVF 21,F |
|
|
747 |
01F2: BTFSS 03.2 |
|
|
748 |
01F3: GOTO 1F6 |
|
|
749 |
01F4: MOVLW 30 |
|
|
750 |
01F5: MOVWF 22 |
|
|
751 |
.................... odp[0]=odp[0] - '0'; |
|
|
752 |
01F6: MOVLW 30 |
|
|
753 |
01F7: SUBWF 21,F |
|
|
754 |
.................... odp[1]=odp[1] - '0'; |
|
|
755 |
01F8: SUBWF 22,F |
|
|
756 |
.................... if(odp[0]>9) odp[0]=odp[0]-7; |
|
|
757 |
01F9: MOVF 21,W |
|
|
758 |
01FA: SUBLW 09 |
|
|
759 |
01FB: BTFSC 03.0 |
|
|
760 |
01FC: GOTO 1FF |
|
|
761 |
01FD: MOVLW 07 |
|
|
762 |
01FE: SUBWF 21,F |
|
|
763 |
.................... if(odp[1]>9) odp[1]=odp[1]-7; |
|
|
764 |
01FF: MOVF 22,W |
|
|
765 |
0200: SUBLW 09 |
|
|
766 |
0201: BTFSC 03.0 |
|
|
767 |
0202: GOTO 205 |
|
|
768 |
0203: MOVLW 07 |
|
|
769 |
0204: SUBWF 22,F |
|
|
770 |
.................... odp[0]=odp[0] << 4; |
|
|
771 |
0205: SWAPF 21,F |
|
|
772 |
0206: MOVLW F0 |
|
|
773 |
0207: ANDWF 21,F |
|
|
774 |
.................... odp[0] |= odp[1]; |
|
|
775 |
0208: MOVF 22,W |
|
|
776 |
0209: IORWF 21,F |
|
|
777 |
.................... |
|
|
778 |
.................... if(odp[2]==0) odp[3]='0'; |
|
|
779 |
020A: MOVF 23,F |
|
|
780 |
020B: BTFSS 03.2 |
|
|
781 |
020C: GOTO 20F |
|
|
782 |
020D: MOVLW 30 |
|
|
783 |
020E: MOVWF 24 |
|
|
784 |
.................... odp[2]=odp[2] - '0'; |
|
|
785 |
020F: MOVLW 30 |
|
|
786 |
0210: SUBWF 23,F |
|
|
787 |
.................... odp[3]=odp[3] - '0'; |
|
|
788 |
0211: SUBWF 24,F |
|
|
789 |
.................... if(odp[2]>9) odp[2]=odp[2]-7; |
|
|
790 |
0212: MOVF 23,W |
|
|
791 |
0213: SUBLW 09 |
|
|
792 |
0214: BTFSC 03.0 |
|
|
793 |
0215: GOTO 218 |
|
|
794 |
0216: MOVLW 07 |
|
|
795 |
0217: SUBWF 23,F |
|
|
796 |
.................... if(odp[3]>9) odp[3]=odp[3]-7; |
|
|
797 |
0218: MOVF 24,W |
|
|
798 |
0219: SUBLW 09 |
|
|
799 |
021A: BTFSC 03.0 |
|
|
800 |
021B: GOTO 21E |
|
|
801 |
021C: MOVLW 07 |
|
|
802 |
021D: SUBWF 24,F |
|
|
803 |
.................... odp[2]=odp[2] << 4; |
|
|
804 |
021E: SWAPF 23,F |
|
|
805 |
021F: MOVLW F0 |
|
|
806 |
0220: ANDWF 23,F |
|
|
807 |
.................... odp[2] |= odp[3]; |
|
|
808 |
0221: MOVF 24,W |
|
|
809 |
0222: IORWF 23,F |
|
|
810 |
.................... |
|
|
811 |
.................... if(odp[4]==0) odp[5]='0'; |
|
|
812 |
0223: MOVF 25,F |
|
|
813 |
0224: BTFSS 03.2 |
|
|
814 |
0225: GOTO 228 |
|
|
815 |
0226: MOVLW 30 |
|
|
816 |
0227: MOVWF 26 |
|
|
817 |
.................... odp[4]=odp[4] - '0'; |
|
|
818 |
0228: MOVLW 30 |
|
|
819 |
0229: SUBWF 25,F |
|
|
820 |
.................... odp[5]=odp[5] - '0'; |
|
|
821 |
022A: SUBWF 26,F |
|
|
822 |
.................... if(odp[4]>9) odp[4]=odp[4]-7; |
|
|
823 |
022B: MOVF 25,W |
|
|
824 |
022C: SUBLW 09 |
|
|
825 |
022D: BTFSC 03.0 |
|
|
826 |
022E: GOTO 231 |
|
|
827 |
022F: MOVLW 07 |
|
|
828 |
0230: SUBWF 25,F |
|
|
829 |
.................... if(odp[5]>9) odp[5]=odp[5]-7; |
|
|
830 |
0231: MOVF 26,W |
|
|
831 |
0232: SUBLW 09 |
|
|
832 |
0233: BTFSC 03.0 |
|
|
833 |
0234: GOTO 237 |
|
|
834 |
0235: MOVLW 07 |
|
|
835 |
0236: SUBWF 26,F |
|
|
836 |
.................... odp[4]=odp[4] << 4; |
|
|
837 |
0237: SWAPF 25,F |
|
|
838 |
0238: MOVLW F0 |
|
|
839 |
0239: ANDWF 25,F |
|
|
840 |
.................... odp[4] |= odp[5]; |
|
|
841 |
023A: MOVF 26,W |
|
|
842 |
023B: IORWF 25,F |
|
|
843 |
.................... |
|
|
844 |
.................... if(odp[6]==0) odp[7]='0'; |
|
|
845 |
023C: MOVF 27,F |
|
|
846 |
023D: BTFSS 03.2 |
|
|
847 |
023E: GOTO 241 |
|
|
848 |
023F: MOVLW 30 |
|
|
849 |
0240: MOVWF 28 |
|
|
850 |
.................... odp[6]=odp[6] - '0'; |
|
|
851 |
0241: MOVLW 30 |
|
|
852 |
0242: SUBWF 27,F |
|
|
853 |
.................... odp[7]=odp[7] - '0'; |
|
|
854 |
0243: SUBWF 28,F |
|
|
855 |
.................... if(odp[6]>9) odp[6]=odp[6]-7; |
|
|
856 |
0244: MOVF 27,W |
|
|
857 |
0245: SUBLW 09 |
|
|
858 |
0246: BTFSC 03.0 |
|
|
859 |
0247: GOTO 24A |
|
|
860 |
0248: MOVLW 07 |
|
|
861 |
0249: SUBWF 27,F |
|
|
862 |
.................... if(odp[7]>9) odp[7]=odp[7]-7; |
|
|
863 |
024A: MOVF 28,W |
|
|
864 |
024B: SUBLW 09 |
|
|
865 |
024C: BTFSC 03.0 |
|
|
866 |
024D: GOTO 250 |
|
|
867 |
024E: MOVLW 07 |
|
|
868 |
024F: SUBWF 28,F |
|
|
869 |
.................... odp[6]=odp[6] << 4; |
|
|
870 |
0250: SWAPF 27,F |
|
|
871 |
0251: MOVLW F0 |
|
|
872 |
0252: ANDWF 27,F |
|
|
873 |
.................... odp[6] |= odp[7]; |
|
|
874 |
0253: MOVF 28,W |
|
|
875 |
0254: IORWF 27,F |
|
|
876 |
.................... |
|
|
877 |
.................... printf(lcd_putc,"%u %u %u %u",odp[0],odp[2],odp[4]odp[6]); |
|
|
878 |
0255: MOVF 21,W |
|
|
879 |
0256: MOVWF 2A |
|
|
880 |
0257: MOVLW 1B |
|
|
881 |
0258: MOVWF 2B |
|
|
882 |
0259: CALL 10A |
|
|
883 |
025A: MOVLW 20 |
|
|
884 |
025B: MOVWF 2C |
|
|
885 |
025C: CALL 0C2 |
|
|
886 |
025D: MOVF 23,W |
|
|
887 |
025E: MOVWF 2A |
|
|
888 |
025F: MOVLW 1B |
|
|
889 |
0260: MOVWF 2B |
|
|
890 |
0261: CALL 10A |
|
|
891 |
0262: MOVLW 20 |
|
|
892 |
0263: MOVWF 2C |
|
|
893 |
0264: CALL 0C2 |
|
|
894 |
0265: MOVF 25,W |
|
|
895 |
0266: MOVWF 2A |
|
|
896 |
0267: MOVLW 1B |
|
|
897 |
0268: MOVWF 2B |
|
|
898 |
0269: CALL 10A |
|
|
899 |
026A: MOVLW 20 |
|
|
900 |
026B: MOVWF 2C |
|
|
901 |
026C: CALL 0C2 |
|
|
902 |
026D: MOVF 27,W |
|
|
903 |
026E: MOVWF 2A |
|
|
904 |
026F: MOVLW 1B |
|
|
905 |
0270: MOVWF 2B |
|
|
906 |
0271: CALL 10A |
|
|
907 |
.................... } |
|
|
908 |
0272: SLEEP |
|
|
909 |
|
|
|
910 |
Configuration Fuses: |
|
|
911 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |