174 |
kapl |
1 |
CCS PCM C Compiler, Version 4.059d, 15399 30-III-07 19:42 |
|
|
2 |
|
|
|
3 |
Filename: main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 908 words (44%) |
|
|
6 |
Largest free fragment is 1140 |
|
|
7 |
RAM used: 25 (7%) at main() level |
|
|
8 |
33 (9%) worst case |
|
|
9 |
Stack: 4 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 166 |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include ".\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 |
008C: MOVLW 32 |
|
|
37 |
008D: MOVWF 04 |
|
|
38 |
008E: BCF 03.7 |
|
|
39 |
008F: MOVF 00,W |
|
|
40 |
0090: BTFSC 03.2 |
|
|
41 |
0091: GOTO 0A3 |
|
|
42 |
0092: MOVLW 01 |
|
|
43 |
0093: MOVWF 78 |
|
|
44 |
0094: MOVLW BF |
|
|
45 |
0095: MOVWF 77 |
|
|
46 |
0096: CLRWDT |
|
|
47 |
0097: DECFSZ 77,F |
|
|
48 |
0098: GOTO 096 |
|
|
49 |
0099: DECFSZ 78,F |
|
|
50 |
009A: GOTO 094 |
|
|
51 |
009B: MOVLW 4A |
|
|
52 |
009C: MOVWF 77 |
|
|
53 |
009D: DECFSZ 77,F |
|
|
54 |
009E: GOTO 09D |
|
|
55 |
009F: NOP |
|
|
56 |
00A0: CLRWDT |
|
|
57 |
00A1: DECFSZ 00,F |
|
|
58 |
00A2: GOTO 092 |
|
|
59 |
00A3: 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 |
00A4: MOVF 07,W |
|
|
154 |
00A5: ANDLW F0 |
|
|
155 |
00A6: MOVWF 39 |
|
|
156 |
00A7: MOVF 38,W |
|
|
157 |
00A8: ANDLW 0F |
|
|
158 |
00A9: IORWF 39,W |
|
|
159 |
00AA: MOVWF 07 |
|
|
160 |
.................... output_bit(LCD_E,1); // vzestupna hrana |
|
|
161 |
00AB: BSF 06.0 |
|
|
162 |
00AC: BSF 03.5 |
|
|
163 |
00AD: BCF 06.0 |
|
|
164 |
.................... delay_us(100); // pockej alespon 450ns od e nebo alespon 195ns od dat |
|
|
165 |
00AE: CLRWDT |
|
|
166 |
00AF: MOVLW 20 |
|
|
167 |
00B0: MOVWF 77 |
|
|
168 |
00B1: DECFSZ 77,F |
|
|
169 |
00B2: GOTO 0B1 |
|
|
170 |
00B3: GOTO 0B4 |
|
|
171 |
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us) |
|
|
172 |
00B4: BCF 03.5 |
|
|
173 |
00B5: BCF 06.0 |
|
|
174 |
00B6: BSF 03.5 |
|
|
175 |
00B7: BCF 06.0 |
|
|
176 |
.................... } |
|
|
177 |
00B8: BCF 03.5 |
|
|
178 |
00B9: 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 |
00BA: MOVF 36,F |
|
|
190 |
00BB: BTFSS 03.2 |
|
|
191 |
00BC: GOTO 0BF |
|
|
192 |
00BD: BCF 06.1 |
|
|
193 |
00BE: GOTO 0C0 |
|
|
194 |
00BF: BSF 06.1 |
|
|
195 |
00C0: BSF 03.5 |
|
|
196 |
00C1: BCF 06.1 |
|
|
197 |
.................... swap(n); |
|
|
198 |
00C2: BCF 03.5 |
|
|
199 |
00C3: SWAPF 37,F |
|
|
200 |
.................... lcd_send_nibble(n); // posli horni pulku bajtu |
|
|
201 |
00C4: MOVF 37,W |
|
|
202 |
00C5: MOVWF 38 |
|
|
203 |
00C6: CALL 0A4 |
|
|
204 |
.................... swap(n); |
|
|
205 |
00C7: SWAPF 37,F |
|
|
206 |
.................... lcd_send_nibble(n); // posli spodni pulku bajtu |
|
|
207 |
00C8: MOVF 37,W |
|
|
208 |
00C9: MOVWF 38 |
|
|
209 |
00CA: CALL 0A4 |
|
|
210 |
.................... delay_us(200); // minimalni doba na provedeni prikazu |
|
|
211 |
00CB: CLRWDT |
|
|
212 |
00CC: MOVLW 42 |
|
|
213 |
00CD: MOVWF 77 |
|
|
214 |
00CE: DECFSZ 77,F |
|
|
215 |
00CF: GOTO 0CE |
|
|
216 |
.................... } |
|
|
217 |
00D0: 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 |
00D1: MOVLW 14 |
|
|
231 |
00D2: MOVWF 32 |
|
|
232 |
00D3: CALL 08C |
|
|
233 |
.................... |
|
|
234 |
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD |
|
|
235 |
00D4: MOVLW F0 |
|
|
236 |
00D5: BSF 03.5 |
|
|
237 |
00D6: ANDWF 07,F |
|
|
238 |
.................... |
|
|
239 |
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav |
|
|
240 |
00D7: BCF 03.5 |
|
|
241 |
00D8: BCF 06.1 |
|
|
242 |
00D9: BSF 03.5 |
|
|
243 |
00DA: BCF 06.1 |
|
|
244 |
.................... output_bit(LCD_E,0); // nastav jako vystup a nastav klidovy stav |
|
|
245 |
00DB: BCF 03.5 |
|
|
246 |
00DC: BCF 06.0 |
|
|
247 |
00DD: BSF 03.5 |
|
|
248 |
00DE: BCF 06.0 |
|
|
249 |
.................... |
|
|
250 |
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice |
|
|
251 |
00DF: BCF 03.5 |
|
|
252 |
00E0: CLRF 2F |
|
|
253 |
00E1: MOVF 2F,W |
|
|
254 |
00E2: SUBLW 02 |
|
|
255 |
00E3: BTFSS 03.0 |
|
|
256 |
00E4: GOTO 0ED |
|
|
257 |
.................... { |
|
|
258 |
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel |
|
|
259 |
00E5: MOVLW 02 |
|
|
260 |
00E6: MOVWF 32 |
|
|
261 |
00E7: CALL 08C |
|
|
262 |
.................... lcd_send_nibble(3); // rezim 8 bitu |
|
|
263 |
00E8: MOVLW 03 |
|
|
264 |
00E9: MOVWF 38 |
|
|
265 |
00EA: CALL 0A4 |
|
|
266 |
.................... } |
|
|
267 |
00EB: INCF 2F,F |
|
|
268 |
00EC: GOTO 0E1 |
|
|
269 |
.................... |
|
|
270 |
.................... delay_us(40); // cas na zpracovani |
|
|
271 |
00ED: CLRWDT |
|
|
272 |
00EE: MOVLW 0C |
|
|
273 |
00EF: MOVWF 77 |
|
|
274 |
00F0: DECFSZ 77,F |
|
|
275 |
00F1: GOTO 0F0 |
|
|
276 |
00F2: GOTO 0F3 |
|
|
277 |
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu) |
|
|
278 |
00F3: MOVLW 02 |
|
|
279 |
00F4: MOVWF 38 |
|
|
280 |
00F5: CALL 0A4 |
|
|
281 |
.................... delay_us(40); // cas na zpracovani |
|
|
282 |
00F6: CLRWDT |
|
|
283 |
00F7: MOVLW 0C |
|
|
284 |
00F8: MOVWF 77 |
|
|
285 |
00F9: DECFSZ 77,F |
|
|
286 |
00FA: GOTO 0F9 |
|
|
287 |
00FB: GOTO 0FC |
|
|
288 |
.................... |
|
|
289 |
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod) |
|
|
290 |
00FC: CLRF 2F |
|
|
291 |
00FD: MOVF 2F,W |
|
|
292 |
00FE: SUBLW 02 |
|
|
293 |
00FF: BTFSS 03.0 |
|
|
294 |
0100: GOTO 10D |
|
|
295 |
.................... { |
|
|
296 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
|
|
297 |
0101: MOVF 2F,W |
|
|
298 |
0102: CALL 004 |
|
|
299 |
0103: MOVWF 30 |
|
|
300 |
0104: CLRF 36 |
|
|
301 |
0105: MOVF 30,W |
|
|
302 |
0106: MOVWF 37 |
|
|
303 |
0107: CALL 0BA |
|
|
304 |
.................... delay_ms(2); |
|
|
305 |
0108: MOVLW 02 |
|
|
306 |
0109: MOVWF 32 |
|
|
307 |
010A: CALL 08C |
|
|
308 |
.................... } |
|
|
309 |
010B: INCF 2F,F |
|
|
310 |
010C: GOTO 0FD |
|
|
311 |
.................... } |
|
|
312 |
010D: GOTO 1B7 (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 |
010E: MOVLW 01 |
|
|
328 |
010F: SUBWF 33,W |
|
|
329 |
0110: ADDLW FC |
|
|
330 |
0111: BTFSC 03.0 |
|
|
331 |
0112: GOTO 120 |
|
|
332 |
0113: ADDLW 04 |
|
|
333 |
0114: GOTO 12B |
|
|
334 |
.................... case 1: Adr=0; break; |
|
|
335 |
0115: CLRF 34 |
|
|
336 |
0116: GOTO 120 |
|
|
337 |
.................... case 2: Adr=0x40; break; |
|
|
338 |
0117: MOVLW 40 |
|
|
339 |
0118: MOVWF 34 |
|
|
340 |
0119: GOTO 120 |
|
|
341 |
.................... case 3: Adr=0x14; break; |
|
|
342 |
011A: MOVLW 14 |
|
|
343 |
011B: MOVWF 34 |
|
|
344 |
011C: GOTO 120 |
|
|
345 |
.................... case 4: Adr=0x54; break; |
|
|
346 |
011D: MOVLW 54 |
|
|
347 |
011E: MOVWF 34 |
|
|
348 |
011F: GOTO 120 |
|
|
349 |
.................... } |
|
|
350 |
.................... Adr+=x-1; |
|
|
351 |
0120: MOVLW 01 |
|
|
352 |
0121: SUBWF 32,W |
|
|
353 |
0122: ADDWF 34,F |
|
|
354 |
.................... |
|
|
355 |
.................... lcd_send_byte(0,0x80|Adr); |
|
|
356 |
0123: MOVF 34,W |
|
|
357 |
0124: IORLW 80 |
|
|
358 |
0125: MOVWF 35 |
|
|
359 |
0126: CLRF 36 |
|
|
360 |
0127: MOVF 35,W |
|
|
361 |
0128: MOVWF 37 |
|
|
362 |
0129: CALL 0BA |
|
|
363 |
.................... } |
|
|
364 |
012A: 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 |
0133: MOVF 31,W |
|
|
377 |
0134: XORLW 0C |
|
|
378 |
0135: BTFSC 03.2 |
|
|
379 |
0136: GOTO 141 |
|
|
380 |
0137: XORLW 06 |
|
|
381 |
0138: BTFSC 03.2 |
|
|
382 |
0139: GOTO 149 |
|
|
383 |
013A: XORLW 07 |
|
|
384 |
013B: BTFSC 03.2 |
|
|
385 |
013C: GOTO 14F |
|
|
386 |
013D: XORLW 05 |
|
|
387 |
013E: BTFSC 03.2 |
|
|
388 |
013F: GOTO 154 |
|
|
389 |
0140: GOTO 159 |
|
|
390 |
.................... case '\f' : lcd_send_byte(0,1); // smaz displej |
|
|
391 |
0141: CLRF 36 |
|
|
392 |
0142: MOVLW 01 |
|
|
393 |
0143: MOVWF 37 |
|
|
394 |
0144: CALL 0BA |
|
|
395 |
.................... delay_ms(2); |
|
|
396 |
0145: MOVLW 02 |
|
|
397 |
0146: MOVWF 32 |
|
|
398 |
0147: CALL 08C |
|
|
399 |
.................... break; |
|
|
400 |
0148: GOTO 165 |
|
|
401 |
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky |
|
|
402 |
0149: MOVLW 01 |
|
|
403 |
014A: MOVWF 32 |
|
|
404 |
014B: MOVLW 02 |
|
|
405 |
014C: MOVWF 33 |
|
|
406 |
014D: CALL 10E |
|
|
407 |
014E: GOTO 165 |
|
|
408 |
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home |
|
|
409 |
014F: MOVLW 01 |
|
|
410 |
0150: MOVWF 32 |
|
|
411 |
0151: MOVWF 33 |
|
|
412 |
0152: CALL 10E |
|
|
413 |
0153: GOTO 165 |
|
|
414 |
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet |
|
|
415 |
0154: CLRF 36 |
|
|
416 |
0155: MOVLW 10 |
|
|
417 |
0156: MOVWF 37 |
|
|
418 |
0157: CALL 0BA |
|
|
419 |
0158: GOTO 165 |
|
|
420 |
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F |
|
|
421 |
0159: MOVF 31,W |
|
|
422 |
015A: SUBLW 1F |
|
|
423 |
015B: BTFSS 03.0 |
|
|
424 |
015C: GOTO 15F |
|
|
425 |
015D: MOVLW 07 |
|
|
426 |
015E: ANDWF 31,F |
|
|
427 |
.................... lcd_send_byte(1,c); break; // zapis znak |
|
|
428 |
015F: MOVLW 01 |
|
|
429 |
0160: MOVWF 36 |
|
|
430 |
0161: MOVF 31,W |
|
|
431 |
0162: MOVWF 37 |
|
|
432 |
0163: CALL 0BA |
|
|
433 |
0164: GOTO 165 |
|
|
434 |
.................... } |
|
|
435 |
.................... } |
|
|
436 |
0165: 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 |
0166: CLRF 04 |
|
|
539 |
0167: BCF 03.7 |
|
|
540 |
0168: MOVLW 1F |
|
|
541 |
0169: ANDWF 03,F |
|
|
542 |
016A: MOVLW 0C |
|
|
543 |
016B: BSF 03.5 |
|
|
544 |
016C: MOVWF 19 |
|
|
545 |
016D: MOVLW A6 |
|
|
546 |
016E: MOVWF 18 |
|
|
547 |
016F: MOVLW 90 |
|
|
548 |
0170: BCF 03.5 |
|
|
549 |
0171: MOVWF 18 |
|
|
550 |
0172: BSF 03.5 |
|
|
551 |
0173: BSF 1F.0 |
|
|
552 |
0174: BSF 1F.1 |
|
|
553 |
0175: BSF 1F.2 |
|
|
554 |
0176: BCF 1F.3 |
|
|
555 |
0177: MOVLW 07 |
|
|
556 |
0178: MOVWF 1C |
|
|
557 |
.................... char odp[8]; |
|
|
558 |
.................... int pom,pom2,pom3,odkl,odkl2,maskovadlo; |
|
|
559 |
.................... |
|
|
560 |
.................... setup_adc_ports(NO_ANALOGS); |
|
|
561 |
* |
|
|
562 |
017C: BSF 03.5 |
|
|
563 |
017D: BSF 1F.0 |
|
|
564 |
017E: BSF 1F.1 |
|
|
565 |
017F: BSF 1F.2 |
|
|
566 |
0180: BCF 1F.3 |
|
|
567 |
.................... setup_adc(ADC_OFF); |
|
|
568 |
0181: BCF 03.5 |
|
|
569 |
0182: BCF 1F.0 |
|
|
570 |
.................... setup_psp(PSP_DISABLED); |
|
|
571 |
0183: BSF 03.5 |
|
|
572 |
0184: BCF 09.4 |
|
|
573 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
574 |
* |
|
|
575 |
0179: MOVLW FF |
|
|
576 |
017A: BCF 03.5 |
|
|
577 |
017B: MOVWF 20 |
|
|
578 |
* |
|
|
579 |
0185: BCF 03.5 |
|
|
580 |
0186: BCF 14.5 |
|
|
581 |
0187: BCF 20.5 |
|
|
582 |
0188: MOVF 20,W |
|
|
583 |
0189: BSF 03.5 |
|
|
584 |
018A: MOVWF 07 |
|
|
585 |
018B: BCF 03.5 |
|
|
586 |
018C: BSF 20.4 |
|
|
587 |
018D: MOVF 20,W |
|
|
588 |
018E: BSF 03.5 |
|
|
589 |
018F: MOVWF 07 |
|
|
590 |
0190: BCF 03.5 |
|
|
591 |
0191: BCF 20.3 |
|
|
592 |
0192: MOVF 20,W |
|
|
593 |
0193: BSF 03.5 |
|
|
594 |
0194: MOVWF 07 |
|
|
595 |
0195: MOVLW 01 |
|
|
596 |
0196: BCF 03.5 |
|
|
597 |
0197: MOVWF 14 |
|
|
598 |
0198: MOVLW 00 |
|
|
599 |
0199: BSF 03.5 |
|
|
600 |
019A: MOVWF 14 |
|
|
601 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
602 |
019B: MOVF 01,W |
|
|
603 |
019C: ANDLW C7 |
|
|
604 |
019D: IORLW 08 |
|
|
605 |
019E: MOVWF 01 |
|
|
606 |
.................... setup_timer_1(T1_DISABLED); |
|
|
607 |
019F: BCF 03.5 |
|
|
608 |
01A0: CLRF 10 |
|
|
609 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
610 |
01A1: MOVLW 00 |
|
|
611 |
01A2: MOVWF 78 |
|
|
612 |
01A3: MOVWF 12 |
|
|
613 |
01A4: MOVLW 00 |
|
|
614 |
01A5: BSF 03.5 |
|
|
615 |
01A6: MOVWF 12 |
|
|
616 |
.................... setup_comparator(NC_NC_NC_NC); |
|
|
617 |
01A7: MOVLW 07 |
|
|
618 |
01A8: MOVWF 1C |
|
|
619 |
01A9: MOVF 05,W |
|
|
620 |
01AA: CLRWDT |
|
|
621 |
01AB: MOVLW 02 |
|
|
622 |
01AC: MOVWF 77 |
|
|
623 |
01AD: DECFSZ 77,F |
|
|
624 |
01AE: GOTO 1AD |
|
|
625 |
01AF: GOTO 1B0 |
|
|
626 |
01B0: MOVF 1C,W |
|
|
627 |
01B1: BCF 03.5 |
|
|
628 |
01B2: BCF 0D.6 |
|
|
629 |
.................... setup_vref(FALSE); |
|
|
630 |
01B3: BSF 03.5 |
|
|
631 |
01B4: CLRF 1D |
|
|
632 |
.................... lcd_init(); |
|
|
633 |
01B5: BCF 03.5 |
|
|
634 |
01B6: GOTO 0D1 |
|
|
635 |
.................... |
|
|
636 |
.................... while(TRUE) |
|
|
637 |
.................... { |
|
|
638 |
.................... output_low(PIN_A4) ; |
|
|
639 |
01B7: BSF 03.5 |
|
|
640 |
01B8: BCF 05.4 |
|
|
641 |
01B9: BCF 03.5 |
|
|
642 |
01BA: BCF 05.4 |
|
|
643 |
.................... delay_ms(150); |
|
|
644 |
01BB: MOVLW 96 |
|
|
645 |
01BC: MOVWF 32 |
|
|
646 |
01BD: CALL 08C |
|
|
647 |
.................... output_high(PIN_A4); |
|
|
648 |
01BE: BSF 03.5 |
|
|
649 |
01BF: BCF 05.4 |
|
|
650 |
01C0: BCF 03.5 |
|
|
651 |
01C1: BSF 05.4 |
|
|
652 |
.................... delay_ms(150); |
|
|
653 |
01C2: MOVLW 96 |
|
|
654 |
01C3: MOVWF 32 |
|
|
655 |
01C4: CALL 08C |
|
|
656 |
.................... output_low(PIN_A4) ; |
|
|
657 |
01C5: BSF 03.5 |
|
|
658 |
01C6: BCF 05.4 |
|
|
659 |
01C7: BCF 03.5 |
|
|
660 |
01C8: BCF 05.4 |
|
|
661 |
.................... delay_ms(150); |
|
|
662 |
01C9: MOVLW 96 |
|
|
663 |
01CA: MOVWF 32 |
|
|
664 |
01CB: CALL 08C |
|
|
665 |
.................... output_high(PIN_A4); |
|
|
666 |
01CC: BSF 03.5 |
|
|
667 |
01CD: BCF 05.4 |
|
|
668 |
01CE: BCF 03.5 |
|
|
669 |
01CF: BSF 05.4 |
|
|
670 |
.................... delay_ms(150); |
|
|
671 |
01D0: MOVLW 96 |
|
|
672 |
01D1: MOVWF 32 |
|
|
673 |
01D2: CALL 08C |
|
|
674 |
.................... |
|
|
675 |
.................... printf("AT+CMGL=0\r"); //vycti prijate SMS |
|
|
676 |
01D3: CLRF 2F |
|
|
677 |
01D4: MOVF 2F,W |
|
|
678 |
01D5: CALL 00C |
|
|
679 |
01D6: INCF 2F,F |
|
|
680 |
01D7: MOVWF 77 |
|
|
681 |
01D8: MOVF 77,W |
|
|
682 |
01D9: BTFSS 0C.4 |
|
|
683 |
01DA: GOTO 1D9 |
|
|
684 |
01DB: MOVWF 19 |
|
|
685 |
01DC: MOVLW 0A |
|
|
686 |
01DD: SUBWF 2F,W |
|
|
687 |
01DE: BTFSS 03.2 |
|
|
688 |
01DF: GOTO 1D4 |
|
|
689 |
.................... gets(odp); //uloz odpoved prikazu do odp |
|
|
690 |
01E0: MOVLW 21 |
|
|
691 |
01E1: MOVWF 04 |
|
|
692 |
01E2: BCF 03.7 |
|
|
693 |
01E3: DECF 04,F |
|
|
694 |
01E4: INCF 04,F |
|
|
695 |
01E5: BTFSS 0C.5 |
|
|
696 |
01E6: GOTO 1E5 |
|
|
697 |
01E7: MOVF 1A,W |
|
|
698 |
01E8: MOVWF 00 |
|
|
699 |
01E9: MOVLW 0D |
|
|
700 |
01EA: SUBWF 00,W |
|
|
701 |
01EB: BTFSS 03.2 |
|
|
702 |
01EC: GOTO 1E4 |
|
|
703 |
01ED: CLRF 00 |
|
|
704 |
.................... getc(); //preskoc 0A |
|
|
705 |
01EE: BTFSS 0C.5 |
|
|
706 |
01EF: GOTO 1EE |
|
|
707 |
01F0: MOVF 1A,W |
|
|
708 |
.................... getc(); //preskoc 0D |
|
|
709 |
01F1: BTFSS 0C.5 |
|
|
710 |
01F2: GOTO 1F1 |
|
|
711 |
01F3: MOVF 1A,W |
|
|
712 |
.................... gets(odp); //uloz pocatek odpovedi do odp |
|
|
713 |
01F4: MOVLW 21 |
|
|
714 |
01F5: MOVWF 04 |
|
|
715 |
01F6: BCF 03.7 |
|
|
716 |
01F7: DECF 04,F |
|
|
717 |
01F8: INCF 04,F |
|
|
718 |
01F9: BTFSS 0C.5 |
|
|
719 |
01FA: GOTO 1F9 |
|
|
720 |
01FB: MOVF 1A,W |
|
|
721 |
01FC: MOVWF 00 |
|
|
722 |
01FD: MOVLW 0D |
|
|
723 |
01FE: SUBWF 00,W |
|
|
724 |
01FF: BTFSS 03.2 |
|
|
725 |
0200: GOTO 1F8 |
|
|
726 |
0201: CLRF 00 |
|
|
727 |
.................... |
|
|
728 |
.................... if(odp[0] == 79 && odp[1] ==75) |
|
|
729 |
0202: MOVF 21,W |
|
|
730 |
0203: SUBLW 4F |
|
|
731 |
0204: BTFSS 03.2 |
|
|
732 |
0205: GOTO 246 |
|
|
733 |
0206: MOVF 22,W |
|
|
734 |
0207: SUBLW 4B |
|
|
735 |
0208: BTFSS 03.2 |
|
|
736 |
0209: GOTO 246 |
|
|
737 |
.................... { |
|
|
738 |
.................... lcd_gotoxy(1,1); |
|
|
739 |
020A: MOVLW 01 |
|
|
740 |
020B: MOVWF 32 |
|
|
741 |
020C: MOVWF 33 |
|
|
742 |
020D: CALL 10E |
|
|
743 |
.................... printf(lcd_putc,"\fNeni nova SMS zprava!"); |
|
|
744 |
020E: CLRF 2F |
|
|
745 |
020F: MOVF 2F,W |
|
|
746 |
0210: CALL 01B |
|
|
747 |
0211: INCF 2F,F |
|
|
748 |
0212: MOVWF 77 |
|
|
749 |
0213: MOVWF 31 |
|
|
750 |
0214: CALL 133 |
|
|
751 |
0215: MOVLW 16 |
|
|
752 |
0216: SUBWF 2F,W |
|
|
753 |
0217: BTFSS 03.2 |
|
|
754 |
0218: GOTO 20F |
|
|
755 |
.................... lcd_gotoxy(1,2); |
|
|
756 |
0219: MOVLW 01 |
|
|
757 |
021A: MOVWF 32 |
|
|
758 |
021B: MOVLW 02 |
|
|
759 |
021C: MOVWF 33 |
|
|
760 |
021D: CALL 10E |
|
|
761 |
.................... printf(lcd_putc,""); |
|
|
762 |
.................... lcd_gotoxy(1,3); |
|
|
763 |
021E: MOVLW 01 |
|
|
764 |
021F: MOVWF 32 |
|
|
765 |
0220: MOVLW 03 |
|
|
766 |
0221: MOVWF 33 |
|
|
767 |
0222: CALL 10E |
|
|
768 |
.................... printf(lcd_putc,"Zaslete SMS na cislo"); |
|
|
769 |
0223: CLRF 2F |
|
|
770 |
0224: MOVF 2F,W |
|
|
771 |
0225: CALL 036 |
|
|
772 |
0226: INCF 2F,F |
|
|
773 |
0227: MOVWF 77 |
|
|
774 |
0228: MOVWF 31 |
|
|
775 |
0229: CALL 133 |
|
|
776 |
022A: MOVLW 14 |
|
|
777 |
022B: SUBWF 2F,W |
|
|
778 |
022C: BTFSS 03.2 |
|
|
779 |
022D: GOTO 224 |
|
|
780 |
.................... lcd_gotoxy(1,4); |
|
|
781 |
022E: MOVLW 01 |
|
|
782 |
022F: MOVWF 32 |
|
|
783 |
0230: MOVLW 04 |
|
|
784 |
0231: MOVWF 33 |
|
|
785 |
0232: CALL 10E |
|
|
786 |
.................... printf(lcd_putc," 736 655 250"); |
|
|
787 |
0233: CLRF 2F |
|
|
788 |
0234: MOVF 2F,W |
|
|
789 |
0235: CALL 04F |
|
|
790 |
0236: INCF 2F,F |
|
|
791 |
0237: MOVWF 77 |
|
|
792 |
0238: MOVWF 31 |
|
|
793 |
0239: CALL 133 |
|
|
794 |
023A: MOVLW 0F |
|
|
795 |
023B: SUBWF 2F,W |
|
|
796 |
023C: BTFSS 03.2 |
|
|
797 |
023D: GOTO 234 |
|
|
798 |
.................... delay_ms(5000); |
|
|
799 |
023E: MOVLW 14 |
|
|
800 |
023F: MOVWF 2F |
|
|
801 |
0240: MOVLW FA |
|
|
802 |
0241: MOVWF 32 |
|
|
803 |
0242: CALL 08C |
|
|
804 |
0243: DECFSZ 2F,F |
|
|
805 |
0244: GOTO 240 |
|
|
806 |
.................... }else |
|
|
807 |
0245: GOTO 38A |
|
|
808 |
.................... { |
|
|
809 |
.................... |
|
|
810 |
.................... for(pom=0;pom<55;pom++) //preskoc nedulezite informace |
|
|
811 |
0246: CLRF 29 |
|
|
812 |
0247: MOVF 29,W |
|
|
813 |
0248: SUBLW 36 |
|
|
814 |
0249: BTFSS 03.0 |
|
|
815 |
024A: GOTO 250 |
|
|
816 |
.................... { |
|
|
817 |
.................... getc(); |
|
|
818 |
024B: BTFSS 0C.5 |
|
|
819 |
024C: GOTO 24B |
|
|
820 |
024D: MOVF 1A,W |
|
|
821 |
.................... } |
|
|
822 |
024E: INCF 29,F |
|
|
823 |
024F: GOTO 247 |
|
|
824 |
.................... gets(odp); //uloz zakodovany text SMS |
|
|
825 |
0250: MOVLW 21 |
|
|
826 |
0251: MOVWF 04 |
|
|
827 |
0252: BCF 03.7 |
|
|
828 |
0253: DECF 04,F |
|
|
829 |
0254: INCF 04,F |
|
|
830 |
0255: BTFSS 0C.5 |
|
|
831 |
0256: GOTO 255 |
|
|
832 |
0257: MOVF 1A,W |
|
|
833 |
0258: MOVWF 00 |
|
|
834 |
0259: MOVLW 0D |
|
|
835 |
025A: SUBWF 00,W |
|
|
836 |
025B: BTFSS 03.2 |
|
|
837 |
025C: GOTO 254 |
|
|
838 |
025D: CLRF 00 |
|
|
839 |
.................... |
|
|
840 |
.................... /*lcd_gotoxy(1,1); |
|
|
841 |
.................... printf(lcd_putc,"\f%s\n",odp);*/ |
|
|
842 |
.................... |
|
|
843 |
.................... if(odp[0]==0) odp[1]='0'; // Prevod z ASCII do BIN |
|
|
844 |
025E: MOVF 21,F |
|
|
845 |
025F: BTFSS 03.2 |
|
|
846 |
0260: GOTO 263 |
|
|
847 |
0261: MOVLW 30 |
|
|
848 |
0262: MOVWF 22 |
|
|
849 |
.................... odp[0]=odp[0] - '0'; |
|
|
850 |
0263: MOVLW 30 |
|
|
851 |
0264: SUBWF 21,F |
|
|
852 |
.................... odp[1]=odp[1] - '0'; |
|
|
853 |
0265: SUBWF 22,F |
|
|
854 |
.................... if(odp[0]>9) odp[0]=odp[0]-7; |
|
|
855 |
0266: MOVF 21,W |
|
|
856 |
0267: SUBLW 09 |
|
|
857 |
0268: BTFSC 03.0 |
|
|
858 |
0269: GOTO 26C |
|
|
859 |
026A: MOVLW 07 |
|
|
860 |
026B: SUBWF 21,F |
|
|
861 |
.................... if(odp[1]>9) odp[1]=odp[1]-7; |
|
|
862 |
026C: MOVF 22,W |
|
|
863 |
026D: SUBLW 09 |
|
|
864 |
026E: BTFSC 03.0 |
|
|
865 |
026F: GOTO 272 |
|
|
866 |
0270: MOVLW 07 |
|
|
867 |
0271: SUBWF 22,F |
|
|
868 |
.................... odp[0]=odp[0] << 4; |
|
|
869 |
0272: SWAPF 21,F |
|
|
870 |
0273: MOVLW F0 |
|
|
871 |
0274: ANDWF 21,F |
|
|
872 |
.................... odp[0] |= odp[1]; |
|
|
873 |
0275: MOVF 22,W |
|
|
874 |
0276: IORWF 21,F |
|
|
875 |
.................... |
|
|
876 |
.................... if(odp[2]==0) odp[3]='0'; |
|
|
877 |
0277: MOVF 23,F |
|
|
878 |
0278: BTFSS 03.2 |
|
|
879 |
0279: GOTO 27C |
|
|
880 |
027A: MOVLW 30 |
|
|
881 |
027B: MOVWF 24 |
|
|
882 |
.................... odp[2]=odp[2] - '0'; |
|
|
883 |
027C: MOVLW 30 |
|
|
884 |
027D: SUBWF 23,F |
|
|
885 |
.................... odp[3]=odp[3] - '0'; |
|
|
886 |
027E: SUBWF 24,F |
|
|
887 |
.................... if(odp[2]>9) odp[2]=odp[2]-7; |
|
|
888 |
027F: MOVF 23,W |
|
|
889 |
0280: SUBLW 09 |
|
|
890 |
0281: BTFSC 03.0 |
|
|
891 |
0282: GOTO 285 |
|
|
892 |
0283: MOVLW 07 |
|
|
893 |
0284: SUBWF 23,F |
|
|
894 |
.................... if(odp[3]>9) odp[3]=odp[3]-7; |
|
|
895 |
0285: MOVF 24,W |
|
|
896 |
0286: SUBLW 09 |
|
|
897 |
0287: BTFSC 03.0 |
|
|
898 |
0288: GOTO 28B |
|
|
899 |
0289: MOVLW 07 |
|
|
900 |
028A: SUBWF 24,F |
|
|
901 |
.................... odp[2]=odp[2] << 4; |
|
|
902 |
028B: SWAPF 23,F |
|
|
903 |
028C: MOVLW F0 |
|
|
904 |
028D: ANDWF 23,F |
|
|
905 |
.................... odp[2] |= odp[3]; |
|
|
906 |
028E: MOVF 24,W |
|
|
907 |
028F: IORWF 23,F |
|
|
908 |
.................... |
|
|
909 |
.................... if(odp[4]==0) odp[5]='0'; |
|
|
910 |
0290: MOVF 25,F |
|
|
911 |
0291: BTFSS 03.2 |
|
|
912 |
0292: GOTO 295 |
|
|
913 |
0293: MOVLW 30 |
|
|
914 |
0294: MOVWF 26 |
|
|
915 |
.................... odp[4]=odp[4] - '0'; |
|
|
916 |
0295: MOVLW 30 |
|
|
917 |
0296: SUBWF 25,F |
|
|
918 |
.................... odp[5]=odp[5] - '0'; |
|
|
919 |
0297: SUBWF 26,F |
|
|
920 |
.................... if(odp[4]>9) odp[4]=odp[4]-7; |
|
|
921 |
0298: MOVF 25,W |
|
|
922 |
0299: SUBLW 09 |
|
|
923 |
029A: BTFSC 03.0 |
|
|
924 |
029B: GOTO 29E |
|
|
925 |
029C: MOVLW 07 |
|
|
926 |
029D: SUBWF 25,F |
|
|
927 |
.................... if(odp[5]>9) odp[5]=odp[5]-7; |
|
|
928 |
029E: MOVF 26,W |
|
|
929 |
029F: SUBLW 09 |
|
|
930 |
02A0: BTFSC 03.0 |
|
|
931 |
02A1: GOTO 2A4 |
|
|
932 |
02A2: MOVLW 07 |
|
|
933 |
02A3: SUBWF 26,F |
|
|
934 |
.................... odp[4]=odp[4] << 4; |
|
|
935 |
02A4: SWAPF 25,F |
|
|
936 |
02A5: MOVLW F0 |
|
|
937 |
02A6: ANDWF 25,F |
|
|
938 |
.................... odp[4] |= odp[5]; |
|
|
939 |
02A7: MOVF 26,W |
|
|
940 |
02A8: IORWF 25,F |
|
|
941 |
.................... |
|
|
942 |
.................... if(odp[6]==0) odp[7]='0'; |
|
|
943 |
02A9: MOVF 27,F |
|
|
944 |
02AA: BTFSS 03.2 |
|
|
945 |
02AB: GOTO 2AE |
|
|
946 |
02AC: MOVLW 30 |
|
|
947 |
02AD: MOVWF 28 |
|
|
948 |
.................... odp[6]=odp[6] - '0'; |
|
|
949 |
02AE: MOVLW 30 |
|
|
950 |
02AF: SUBWF 27,F |
|
|
951 |
.................... odp[7]=odp[7] - '0'; |
|
|
952 |
02B0: SUBWF 28,F |
|
|
953 |
.................... if(odp[6]>9) odp[6]=odp[6]-7; |
|
|
954 |
02B1: MOVF 27,W |
|
|
955 |
02B2: SUBLW 09 |
|
|
956 |
02B3: BTFSC 03.0 |
|
|
957 |
02B4: GOTO 2B7 |
|
|
958 |
02B5: MOVLW 07 |
|
|
959 |
02B6: SUBWF 27,F |
|
|
960 |
.................... if(odp[7]>9) odp[7]=odp[7]-7; |
|
|
961 |
02B7: MOVF 28,W |
|
|
962 |
02B8: SUBLW 09 |
|
|
963 |
02B9: BTFSC 03.0 |
|
|
964 |
02BA: GOTO 2BD |
|
|
965 |
02BB: MOVLW 07 |
|
|
966 |
02BC: SUBWF 28,F |
|
|
967 |
.................... odp[6]=odp[6] << 4; |
|
|
968 |
02BD: SWAPF 27,F |
|
|
969 |
02BE: MOVLW F0 |
|
|
970 |
02BF: ANDWF 27,F |
|
|
971 |
.................... odp[6] |= odp[7]; |
|
|
972 |
02C0: MOVF 28,W |
|
|
973 |
02C1: IORWF 27,F |
|
|
974 |
.................... |
|
|
975 |
.................... odp[1]=odp[2]; |
|
|
976 |
02C2: MOVF 23,W |
|
|
977 |
02C3: MOVWF 22 |
|
|
978 |
.................... odp[2]=odp[4]; |
|
|
979 |
02C4: MOVF 25,W |
|
|
980 |
02C5: MOVWF 23 |
|
|
981 |
.................... odp[3]=odp[6]; |
|
|
982 |
02C6: MOVF 27,W |
|
|
983 |
02C7: MOVWF 24 |
|
|
984 |
.................... odp[4],odp[5],odp[6]=""; |
|
|
985 |
02C8: CLRF 27 |
|
|
986 |
.................... |
|
|
987 |
.................... /*lcd_gotoxy(1,2); |
|
|
988 |
.................... printf(lcd_putc,"%u %u %u %u",odp[0],odp[1],odp[2]odp[3]); */ |
|
|
989 |
.................... |
|
|
990 |
.................... pom3=0; |
|
|
991 |
02C9: CLRF 2B |
|
|
992 |
.................... for (pom = 0; pom < 4;pom++) |
|
|
993 |
02CA: CLRF 29 |
|
|
994 |
02CB: MOVF 29,W |
|
|
995 |
02CC: SUBLW 03 |
|
|
996 |
02CD: BTFSS 03.0 |
|
|
997 |
02CE: GOTO 33D |
|
|
998 |
.................... { |
|
|
999 |
.................... maskovadlo = maskovadlo >> 1; //rotace promene urcene pro maskovani |
|
|
1000 |
02CF: BCF 03.0 |
|
|
1001 |
02D0: RRF 2E,F |
|
|
1002 |
.................... maskovadlo = maskovadlo | 0x80; |
|
|
1003 |
02D1: BSF 2E.7 |
|
|
1004 |
.................... odkl = odp[pom] & maskovadlo; //odlozeni "prenosu" do odkl pomoci maskovadla |
|
|
1005 |
02D2: MOVLW 21 |
|
|
1006 |
02D3: ADDWF 29,W |
|
|
1007 |
02D4: MOVWF 04 |
|
|
1008 |
02D5: BCF 03.7 |
|
|
1009 |
02D6: MOVF 00,W |
|
|
1010 |
02D7: ANDWF 2E,W |
|
|
1011 |
02D8: MOVWF 2C |
|
|
1012 |
.................... odp[pom] = odp[pom] << pom3; //rotace znaku |
|
|
1013 |
02D9: MOVLW 21 |
|
|
1014 |
02DA: ADDWF 29,W |
|
|
1015 |
02DB: MOVWF 78 |
|
|
1016 |
02DC: CLRF 7A |
|
|
1017 |
02DD: BTFSC 03.0 |
|
|
1018 |
02DE: INCF 7A,F |
|
|
1019 |
02DF: MOVF 78,W |
|
|
1020 |
02E0: MOVWF 2F |
|
|
1021 |
02E1: MOVF 7A,W |
|
|
1022 |
02E2: MOVWF 30 |
|
|
1023 |
02E3: MOVLW 21 |
|
|
1024 |
02E4: ADDWF 29,W |
|
|
1025 |
02E5: MOVWF 04 |
|
|
1026 |
02E6: BCF 03.7 |
|
|
1027 |
02E7: MOVF 00,W |
|
|
1028 |
02E8: MOVWF 77 |
|
|
1029 |
02E9: MOVF 2B,W |
|
|
1030 |
02EA: MOVWF 78 |
|
|
1031 |
02EB: BTFSC 03.2 |
|
|
1032 |
02EC: GOTO 2F1 |
|
|
1033 |
02ED: BCF 03.0 |
|
|
1034 |
02EE: RLF 77,F |
|
|
1035 |
02EF: DECFSZ 78,F |
|
|
1036 |
02F0: GOTO 2ED |
|
|
1037 |
02F1: MOVF 2F,W |
|
|
1038 |
02F2: MOVWF 04 |
|
|
1039 |
02F3: BCF 03.7 |
|
|
1040 |
02F4: BTFSC 30.0 |
|
|
1041 |
02F5: BSF 03.7 |
|
|
1042 |
02F6: MOVF 77,W |
|
|
1043 |
02F7: MOVWF 00 |
|
|
1044 |
.................... for (pom2 = 0; pom2 < (8-pom3);pom2++) //rotace odkl2 |
|
|
1045 |
02F8: CLRF 2A |
|
|
1046 |
02F9: MOVF 2B,W |
|
|
1047 |
02FA: SUBLW 08 |
|
|
1048 |
02FB: SUBWF 2A,W |
|
|
1049 |
02FC: BTFSC 03.0 |
|
|
1050 |
02FD: GOTO 303 |
|
|
1051 |
.................... { |
|
|
1052 |
.................... odkl2 = odkl2 >> 1; |
|
|
1053 |
02FE: BCF 03.0 |
|
|
1054 |
02FF: RRF 2D,F |
|
|
1055 |
.................... odkl2 = odkl2 & 127; |
|
|
1056 |
0300: BCF 2D.7 |
|
|
1057 |
.................... } |
|
|
1058 |
0301: INCF 2A,F |
|
|
1059 |
0302: GOTO 2F9 |
|
|
1060 |
.................... odp[pom] = odp[pom] | odkl2; //pridani odkl2 ke znaku |
|
|
1061 |
0303: MOVLW 21 |
|
|
1062 |
0304: ADDWF 29,W |
|
|
1063 |
0305: MOVWF 78 |
|
|
1064 |
0306: CLRF 7A |
|
|
1065 |
0307: BTFSC 03.0 |
|
|
1066 |
0308: INCF 7A,F |
|
|
1067 |
0309: MOVLW 21 |
|
|
1068 |
030A: ADDWF 29,W |
|
|
1069 |
030B: MOVWF 04 |
|
|
1070 |
030C: BCF 03.7 |
|
|
1071 |
030D: MOVF 00,W |
|
|
1072 |
030E: IORWF 2D,W |
|
|
1073 |
030F: MOVWF 32 |
|
|
1074 |
0310: MOVF 78,W |
|
|
1075 |
0311: MOVWF 04 |
|
|
1076 |
0312: BCF 03.7 |
|
|
1077 |
0313: BTFSC 7A.0 |
|
|
1078 |
0314: BSF 03.7 |
|
|
1079 |
0315: MOVF 32,W |
|
|
1080 |
0316: MOVWF 00 |
|
|
1081 |
.................... odp[pom] = odp[pom] & 127; //smazani nejvysiho bitu |
|
|
1082 |
0317: MOVLW 21 |
|
|
1083 |
0318: ADDWF 29,W |
|
|
1084 |
0319: MOVWF 78 |
|
|
1085 |
031A: CLRF 7A |
|
|
1086 |
031B: BTFSC 03.0 |
|
|
1087 |
031C: INCF 7A,F |
|
|
1088 |
031D: MOVLW 21 |
|
|
1089 |
031E: ADDWF 29,W |
|
|
1090 |
031F: MOVWF 04 |
|
|
1091 |
0320: BCF 03.7 |
|
|
1092 |
0321: MOVF 00,W |
|
|
1093 |
0322: ANDLW 7F |
|
|
1094 |
0323: MOVWF 32 |
|
|
1095 |
0324: MOVF 78,W |
|
|
1096 |
0325: MOVWF 04 |
|
|
1097 |
0326: BCF 03.7 |
|
|
1098 |
0327: BTFSC 7A.0 |
|
|
1099 |
0328: BSF 03.7 |
|
|
1100 |
0329: MOVF 32,W |
|
|
1101 |
032A: MOVWF 00 |
|
|
1102 |
.................... odkl2 = odkl; //ulozeni odlk na dalsi pruchod |
|
|
1103 |
032B: MOVF 2C,W |
|
|
1104 |
032C: MOVWF 2D |
|
|
1105 |
.................... pom3++; //inkrementace citace rotace |
|
|
1106 |
032D: INCF 2B,F |
|
|
1107 |
.................... if (pom3 == 8) //kazdy 8my znak |
|
|
1108 |
032E: MOVF 2B,W |
|
|
1109 |
032F: SUBLW 08 |
|
|
1110 |
0330: BTFSS 03.2 |
|
|
1111 |
0331: GOTO 33B |
|
|
1112 |
.................... { |
|
|
1113 |
.................... pom3 = 0; //smaz citac |
|
|
1114 |
0332: CLRF 2B |
|
|
1115 |
.................... odp[pom+1] = odkl2; //uloz 8my znak vznikly z "prenosu" |
|
|
1116 |
0333: MOVLW 01 |
|
|
1117 |
0334: ADDWF 29,W |
|
|
1118 |
0335: ADDLW 21 |
|
|
1119 |
0336: MOVWF 04 |
|
|
1120 |
0337: BCF 03.7 |
|
|
1121 |
0338: MOVF 2D,W |
|
|
1122 |
0339: MOVWF 00 |
|
|
1123 |
.................... maskovadlo = 0; //smaz maskovadlo |
|
|
1124 |
033A: CLRF 2E |
|
|
1125 |
.................... } |
|
|
1126 |
.................... } |
|
|
1127 |
033B: INCF 29,F |
|
|
1128 |
033C: GOTO 2CB |
|
|
1129 |
.................... odp[pom]='\0'; |
|
|
1130 |
033D: MOVLW 21 |
|
|
1131 |
033E: ADDWF 29,W |
|
|
1132 |
033F: MOVWF 04 |
|
|
1133 |
0340: BCF 03.7 |
|
|
1134 |
0341: CLRF 00 |
|
|
1135 |
.................... /*lcd_gotoxy(1,3); |
|
|
1136 |
.................... printf(lcd_putc,"%u %u %u %u",odp[0],odp[1],odp[2]odp[3]); */ |
|
|
1137 |
.................... lcd_gotoxy(1,2); |
|
|
1138 |
0342: MOVLW 01 |
|
|
1139 |
0343: MOVWF 32 |
|
|
1140 |
0344: MOVLW 02 |
|
|
1141 |
0345: MOVWF 33 |
|
|
1142 |
0346: CALL 10E |
|
|
1143 |
.................... printf(lcd_putc,"\fPrijata SMS s textem",); |
|
|
1144 |
0347: CLRF 2F |
|
|
1145 |
0348: MOVF 2F,W |
|
|
1146 |
0349: CALL 063 |
|
|
1147 |
034A: INCF 2F,F |
|
|
1148 |
034B: MOVWF 77 |
|
|
1149 |
034C: MOVWF 31 |
|
|
1150 |
034D: CALL 133 |
|
|
1151 |
034E: MOVLW 15 |
|
|
1152 |
034F: SUBWF 2F,W |
|
|
1153 |
0350: BTFSS 03.2 |
|
|
1154 |
0351: GOTO 348 |
|
|
1155 |
.................... lcd_gotoxy(9,3); |
|
|
1156 |
0352: MOVLW 09 |
|
|
1157 |
0353: MOVWF 32 |
|
|
1158 |
0354: MOVLW 03 |
|
|
1159 |
0355: MOVWF 33 |
|
|
1160 |
0356: CALL 10E |
|
|
1161 |
.................... printf(lcd_putc,"%s",odp); |
|
|
1162 |
0357: MOVLW 21 |
|
|
1163 |
0358: MOVWF 04 |
|
|
1164 |
0359: BCF 03.7 |
|
|
1165 |
035A: MOVLW 00 |
|
|
1166 |
035B: IORWF 00,W |
|
|
1167 |
035C: BTFSC 03.2 |
|
|
1168 |
035D: GOTO 36E |
|
|
1169 |
035E: CLRF 30 |
|
|
1170 |
035F: MOVF 04,W |
|
|
1171 |
0360: MOVWF 2F |
|
|
1172 |
0361: BCF 30.0 |
|
|
1173 |
0362: BTFSC 03.7 |
|
|
1174 |
0363: BSF 30.0 |
|
|
1175 |
0364: MOVF 00,W |
|
|
1176 |
0365: MOVWF 31 |
|
|
1177 |
0366: CALL 133 |
|
|
1178 |
0367: MOVF 2F,W |
|
|
1179 |
0368: MOVWF 04 |
|
|
1180 |
0369: BCF 03.7 |
|
|
1181 |
036A: BTFSC 30.0 |
|
|
1182 |
036B: BSF 03.7 |
|
|
1183 |
036C: INCF 04,F |
|
|
1184 |
036D: GOTO 35A |
|
|
1185 |
.................... output_low(PIN_A4) ; |
|
|
1186 |
036E: BSF 03.5 |
|
|
1187 |
036F: BCF 05.4 |
|
|
1188 |
0370: BCF 03.5 |
|
|
1189 |
0371: BCF 05.4 |
|
|
1190 |
.................... delay_ms(30000); |
|
|
1191 |
0372: MOVLW 78 |
|
|
1192 |
0373: MOVWF 2F |
|
|
1193 |
0374: MOVLW FA |
|
|
1194 |
0375: MOVWF 32 |
|
|
1195 |
0376: CALL 08C |
|
|
1196 |
0377: DECFSZ 2F,F |
|
|
1197 |
0378: GOTO 374 |
|
|
1198 |
.................... output_high(PIN_A4); |
|
|
1199 |
0379: BSF 03.5 |
|
|
1200 |
037A: BCF 05.4 |
|
|
1201 |
037B: BCF 03.5 |
|
|
1202 |
037C: BSF 05.4 |
|
|
1203 |
.................... printf("AT+CMGD=1\r"); //smaz prijatou SMSku |
|
|
1204 |
037D: CLRF 2F |
|
|
1205 |
037E: MOVF 2F,W |
|
|
1206 |
037F: CALL 07D |
|
|
1207 |
0380: INCF 2F,F |
|
|
1208 |
0381: MOVWF 77 |
|
|
1209 |
0382: MOVF 77,W |
|
|
1210 |
0383: BTFSS 0C.4 |
|
|
1211 |
0384: GOTO 383 |
|
|
1212 |
0385: MOVWF 19 |
|
|
1213 |
0386: MOVLW 0A |
|
|
1214 |
0387: SUBWF 2F,W |
|
|
1215 |
0388: BTFSS 03.2 |
|
|
1216 |
0389: GOTO 37E |
|
|
1217 |
.................... } |
|
|
1218 |
.................... } |
|
|
1219 |
038A: GOTO 1B7 |
|
|
1220 |
.................... } |
|
|
1221 |
038B: SLEEP |
|
|
1222 |
|
|
|
1223 |
Configuration Fuses: |
|
|
1224 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |