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