3275 |
kaklik |
1 |
CCS PCM C Compiler, Version 4.106, 47914 26-VIII-13 19:04 |
|
|
2 |
|
|
|
3 |
Filename: Z:\home\kaklik\svnMLAB\Designs\Measuring_instruments\GeoMet01A\SW\PIC16F887\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 2940 words (36%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 21 (6%) at main() level |
|
|
8 |
46 (12%) worst case |
|
|
9 |
Stack: 5 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 0A |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 228 |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "main.h" |
|
|
17 |
.................... #include <16F887.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
19 |
.................... #device PIC16F887 |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=10 |
|
|
23 |
.................... |
|
|
24 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
25 |
.................... #FUSES INTRC //Internal RC Osc |
|
|
26 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
27 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
28 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
29 |
.................... #FUSES NOCPD //No EE protection |
|
|
30 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
31 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
32 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
33 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
34 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
35 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
|
|
37 |
.................... |
|
|
38 |
.................... #use delay(clock=8000000) |
|
|
39 |
* |
|
|
40 |
0078: MOVLW 3D |
|
|
41 |
0079: MOVWF 04 |
|
|
42 |
007A: BCF 03.7 |
|
|
43 |
007B: MOVF 00,W |
|
|
44 |
007C: BTFSC 03.2 |
|
|
45 |
007D: GOTO 08B |
|
|
46 |
007E: MOVLW 02 |
|
|
47 |
007F: MOVWF 78 |
|
|
48 |
0080: CLRF 77 |
|
|
49 |
0081: DECFSZ 77,F |
|
|
50 |
0082: GOTO 081 |
|
|
51 |
0083: DECFSZ 78,F |
|
|
52 |
0084: GOTO 080 |
|
|
53 |
0085: MOVLW 97 |
|
|
54 |
0086: MOVWF 77 |
|
|
55 |
0087: DECFSZ 77,F |
|
|
56 |
0088: GOTO 087 |
|
|
57 |
0089: DECFSZ 00,F |
|
|
58 |
008A: GOTO 07E |
|
|
59 |
008B: RETURN |
|
|
60 |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
|
|
61 |
* |
|
|
62 |
0202: MOVLW 08 |
|
|
63 |
0203: MOVWF 78 |
|
|
64 |
0204: NOP |
|
|
65 |
0205: BCF 07.3 |
|
|
66 |
0206: BCF 20.3 |
|
|
67 |
0207: MOVF 20,W |
|
|
68 |
0208: BSF 03.5 |
|
|
69 |
0209: MOVWF 07 |
|
|
70 |
020A: NOP |
|
|
71 |
020B: BCF 03.5 |
|
|
72 |
020C: RLF 34,F |
|
|
73 |
020D: BCF 07.4 |
|
|
74 |
020E: BTFSS 03.0 |
|
|
75 |
020F: GOTO 216 |
|
|
76 |
0210: BSF 20.4 |
|
|
77 |
0211: MOVF 20,W |
|
|
78 |
0212: BSF 03.5 |
|
|
79 |
0213: MOVWF 07 |
|
|
80 |
0214: GOTO 21A |
|
|
81 |
0215: BCF 03.5 |
|
|
82 |
0216: BCF 20.4 |
|
|
83 |
0217: MOVF 20,W |
|
|
84 |
0218: BSF 03.5 |
|
|
85 |
0219: MOVWF 07 |
|
|
86 |
021A: NOP |
|
|
87 |
021B: BCF 03.5 |
|
|
88 |
021C: BSF 20.3 |
|
|
89 |
021D: MOVF 20,W |
|
|
90 |
021E: BSF 03.5 |
|
|
91 |
021F: MOVWF 07 |
|
|
92 |
0220: BCF 03.5 |
|
|
93 |
0221: BTFSS 07.3 |
|
|
94 |
0222: GOTO 221 |
|
|
95 |
0223: DECFSZ 78,F |
|
|
96 |
0224: GOTO 204 |
|
|
97 |
0225: NOP |
|
|
98 |
0226: BCF 07.3 |
|
|
99 |
0227: BCF 20.3 |
|
|
100 |
0228: MOVF 20,W |
|
|
101 |
0229: BSF 03.5 |
|
|
102 |
022A: MOVWF 07 |
|
|
103 |
022B: NOP |
|
|
104 |
022C: BCF 03.5 |
|
|
105 |
022D: BSF 20.4 |
|
|
106 |
022E: MOVF 20,W |
|
|
107 |
022F: BSF 03.5 |
|
|
108 |
0230: MOVWF 07 |
|
|
109 |
0231: NOP |
|
|
110 |
0232: NOP |
|
|
111 |
0233: BCF 03.5 |
|
|
112 |
0234: BSF 20.3 |
|
|
113 |
0235: MOVF 20,W |
|
|
114 |
0236: BSF 03.5 |
|
|
115 |
0237: MOVWF 07 |
|
|
116 |
0238: BCF 03.5 |
|
|
117 |
0239: BTFSS 07.3 |
|
|
118 |
023A: GOTO 239 |
|
|
119 |
023B: CLRF 78 |
|
|
120 |
023C: NOP |
|
|
121 |
023D: BTFSC 07.4 |
|
|
122 |
023E: BSF 78.0 |
|
|
123 |
023F: BCF 07.3 |
|
|
124 |
0240: BCF 20.3 |
|
|
125 |
0241: MOVF 20,W |
|
|
126 |
0242: BSF 03.5 |
|
|
127 |
0243: MOVWF 07 |
|
|
128 |
0244: BCF 03.5 |
|
|
129 |
0245: BCF 07.4 |
|
|
130 |
0246: BCF 20.4 |
|
|
131 |
0247: MOVF 20,W |
|
|
132 |
0248: BSF 03.5 |
|
|
133 |
0249: MOVWF 07 |
|
|
134 |
024A: BCF 03.5 |
|
|
135 |
024B: RETURN |
|
|
136 |
024C: MOVLW 08 |
|
|
137 |
024D: MOVWF 35 |
|
|
138 |
024E: MOVF 77,W |
|
|
139 |
024F: MOVWF 36 |
|
|
140 |
0250: BSF 20.4 |
|
|
141 |
0251: MOVF 20,W |
|
|
142 |
0252: BSF 03.5 |
|
|
143 |
0253: MOVWF 07 |
|
|
144 |
0254: NOP |
|
|
145 |
0255: BCF 03.5 |
|
|
146 |
0256: BSF 20.3 |
|
|
147 |
0257: MOVF 20,W |
|
|
148 |
0258: BSF 03.5 |
|
|
149 |
0259: MOVWF 07 |
|
|
150 |
025A: BCF 03.5 |
|
|
151 |
025B: BTFSS 07.3 |
|
|
152 |
025C: GOTO 25B |
|
|
153 |
025D: BTFSC 07.4 |
|
|
154 |
025E: BSF 03.0 |
|
|
155 |
025F: BTFSS 07.4 |
|
|
156 |
0260: BCF 03.0 |
|
|
157 |
0261: RLF 78,F |
|
|
158 |
0262: NOP |
|
|
159 |
0263: BCF 20.3 |
|
|
160 |
0264: MOVF 20,W |
|
|
161 |
0265: BSF 03.5 |
|
|
162 |
0266: MOVWF 07 |
|
|
163 |
0267: BCF 03.5 |
|
|
164 |
0268: BCF 07.3 |
|
|
165 |
0269: DECFSZ 35,F |
|
|
166 |
026A: GOTO 250 |
|
|
167 |
026B: BSF 20.4 |
|
|
168 |
026C: MOVF 20,W |
|
|
169 |
026D: BSF 03.5 |
|
|
170 |
026E: MOVWF 07 |
|
|
171 |
026F: NOP |
|
|
172 |
0270: BCF 03.5 |
|
|
173 |
0271: BCF 07.4 |
|
|
174 |
0272: MOVF 36,W |
|
|
175 |
0273: BTFSC 03.2 |
|
|
176 |
0274: GOTO 27A |
|
|
177 |
0275: BCF 20.4 |
|
|
178 |
0276: MOVF 20,W |
|
|
179 |
0277: BSF 03.5 |
|
|
180 |
0278: MOVWF 07 |
|
|
181 |
0279: BCF 03.5 |
|
|
182 |
027A: NOP |
|
|
183 |
027B: BSF 20.3 |
|
|
184 |
027C: MOVF 20,W |
|
|
185 |
027D: BSF 03.5 |
|
|
186 |
027E: MOVWF 07 |
|
|
187 |
027F: BCF 03.5 |
|
|
188 |
0280: BTFSS 07.3 |
|
|
189 |
0281: GOTO 280 |
|
|
190 |
0282: NOP |
|
|
191 |
0283: BCF 07.3 |
|
|
192 |
0284: BCF 20.3 |
|
|
193 |
0285: MOVF 20,W |
|
|
194 |
0286: BSF 03.5 |
|
|
195 |
0287: MOVWF 07 |
|
|
196 |
0288: NOP |
|
|
197 |
0289: BCF 03.5 |
|
|
198 |
028A: BCF 07.4 |
|
|
199 |
028B: BCF 20.4 |
|
|
200 |
028C: MOVF 20,W |
|
|
201 |
028D: BSF 03.5 |
|
|
202 |
028E: MOVWF 07 |
|
|
203 |
028F: BCF 03.5 |
|
|
204 |
0290: RETURN |
|
|
205 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
206 |
.................... |
|
|
207 |
.................... |
|
|
208 |
.................... |
|
|
209 |
.................... #define LCD_ENABLE_PIN PIN_E0 //// |
|
|
210 |
.................... #define LCD_RS_PIN PIN_E1 //// |
|
|
211 |
.................... #define LCD_RW_PIN PIN_E2 //// |
|
|
212 |
.................... #define LCD_DATA4 PIN_D4 //// |
|
|
213 |
.................... #define LCD_DATA5 PIN_D5 //// |
|
|
214 |
.................... #define LCD_DATA6 PIN_D6 //// |
|
|
215 |
.................... #define LCD_DATA7 PIN_D7 |
|
|
216 |
.................... #include <lcd.c> |
|
|
217 |
.................... /////////////////////////////////////////////////////////////////////////////// |
|
|
218 |
.................... //// LCD.C //// |
|
|
219 |
.................... //// Driver for common LCD modules //// |
|
|
220 |
.................... //// //// |
|
|
221 |
.................... //// lcd_init() Must be called before any other function. //// |
|
|
222 |
.................... //// //// |
|
|
223 |
.................... //// lcd_putc(c) Will display c on the next position of the LCD. //// |
|
|
224 |
.................... //// \a Set cursor position to upper left //// |
|
|
225 |
.................... //// \f Clear display, set cursor to upper left //// |
|
|
226 |
.................... //// \n Go to start of second line //// |
|
|
227 |
.................... //// \b Move back one position //// |
|
|
228 |
.................... //// If LCD_EXTENDED_NEWLINE is defined, the \n character //// |
|
|
229 |
.................... //// will erase all remanining characters on the current //// |
|
|
230 |
.................... //// line, and move the cursor to the beginning of the next //// |
|
|
231 |
.................... //// line. //// |
|
|
232 |
.................... //// If LCD_EXTENDED_NEWLINE is defined, the \r character //// |
|
|
233 |
.................... //// will move the cursor to the start of the current //// |
|
|
234 |
.................... //// line. //// |
|
|
235 |
.................... //// //// |
|
|
236 |
.................... //// lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) //// |
|
|
237 |
.................... //// //// |
|
|
238 |
.................... //// lcd_getc(x,y) Returns character at position x,y on LCD //// |
|
|
239 |
.................... //// //// |
|
|
240 |
.................... //// CONFIGURATION //// |
|
|
241 |
.................... //// The LCD can be configured in one of two ways: a.) port access or //// |
|
|
242 |
.................... //// b.) pin access. Port access requires the entire 7 bit interface //// |
|
|
243 |
.................... //// connected to one GPIO port, and the data bits (D4:D7 of the LCD) //// |
|
|
244 |
.................... //// connected to sequential pins on the GPIO. Pin access //// |
|
|
245 |
.................... //// has no requirements, all 7 bits of the control interface can //// |
|
|
246 |
.................... //// can be connected to any GPIO using several ports. //// |
|
|
247 |
.................... //// //// |
|
|
248 |
.................... //// To use port access, #define LCD_DATA_PORT to the SFR location of //// |
|
|
249 |
.................... //// of the GPIO port that holds the interface, -AND- edit LCD_PIN_MAP //// |
|
|
250 |
.................... //// of this file to configure the pin order. If you are using a //// |
|
|
251 |
.................... //// baseline PIC (PCB), then LCD_OUTPUT_MAP and LCD_INPUT_MAP also must //// |
|
|
252 |
.................... //// be defined. //// |
|
|
253 |
.................... //// //// |
|
|
254 |
.................... //// Example of port access: //// |
|
|
255 |
.................... //// #define LCD_DATA_PORT getenv("SFR:PORTD") //// |
|
|
256 |
.................... //// //// |
|
|
257 |
.................... //// To use pin access, the following pins must be defined: //// |
|
|
258 |
.................... //// LCD_ENABLE_PIN //// |
|
|
259 |
.................... //// LCD_RS_PIN //// |
|
|
260 |
.................... //// LCD_RW_PIN //// |
|
|
261 |
.................... //// LCD_DATA4 //// |
|
|
262 |
.................... //// LCD_DATA5 //// |
|
|
263 |
.................... //// LCD_DATA6 //// |
|
|
264 |
.................... //// LCD_DATA7 //// |
|
|
265 |
.................... //// //// |
|
|
266 |
.................... //// Example of pin access: //// |
|
|
267 |
.................... //// #define LCD_ENABLE_PIN PIN_E0 //// |
|
|
268 |
.................... //// #define LCD_RS_PIN PIN_E1 //// |
|
|
269 |
.................... //// #define LCD_RW_PIN PIN_E2 //// |
|
|
270 |
.................... //// #define LCD_DATA4 PIN_D4 //// |
|
|
271 |
.................... //// #define LCD_DATA5 PIN_D5 //// |
|
|
272 |
.................... //// #define LCD_DATA6 PIN_D6 //// |
|
|
273 |
.................... //// #define LCD_DATA7 PIN_D7 //// |
|
|
274 |
.................... //// //// |
|
|
275 |
.................... /////////////////////////////////////////////////////////////////////////////// |
|
|
276 |
.................... //// (C) Copyright 1996,2010 Custom Computer Services //// |
|
|
277 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
278 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
279 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
280 |
.................... //// or distribution is permitted without written permission. //// |
|
|
281 |
.................... //// Derivative programs created using this software in object code //// |
|
|
282 |
.................... //// form are not restricted in any way. //// |
|
|
283 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
284 |
.................... |
|
|
285 |
.................... // define the pinout. |
|
|
286 |
.................... // only required if port access is being used. |
|
|
287 |
.................... typedef struct |
|
|
288 |
.................... { // This structure is overlayed |
|
|
289 |
.................... BOOLEAN enable; // on to an I/O port to gain |
|
|
290 |
.................... BOOLEAN rs; // access to the LCD pins. |
|
|
291 |
.................... BOOLEAN rw; // The bits are allocated from |
|
|
292 |
.................... BOOLEAN unused; // low order up. ENABLE will |
|
|
293 |
.................... int data : 4; // be LSB pin of that port. |
|
|
294 |
.................... #if defined(__PCD__) // The port used will be LCD_DATA_PORT. |
|
|
295 |
.................... int reserved: 8; |
|
|
296 |
.................... #endif |
|
|
297 |
.................... } LCD_PIN_MAP; |
|
|
298 |
.................... |
|
|
299 |
.................... // this is to improve compatability with previous LCD drivers that accepted |
|
|
300 |
.................... // a define labeled 'use_portb_lcd' that configured the LCD onto port B. |
|
|
301 |
.................... #if ((defined(use_portb_lcd)) && (use_portb_lcd==TRUE)) |
|
|
302 |
.................... #define LCD_DATA_PORT getenv("SFR:PORTB") |
|
|
303 |
.................... #endif |
|
|
304 |
.................... |
|
|
305 |
.................... #if defined(__PCB__) |
|
|
306 |
.................... // these definitions only need to be modified for baseline PICs. |
|
|
307 |
.................... // all other PICs use LCD_PIN_MAP or individual LCD_xxx pin definitions. |
|
|
308 |
.................... /* EN, RS, RW, UNUSED, DATA */ |
|
|
309 |
.................... const LCD_PIN_MAP LCD_OUTPUT_MAP = {0, 0, 0, 0, 0}; |
|
|
310 |
.................... const LCD_PIN_MAP LCD_INPUT_MAP = {0, 0, 0, 0, 0xF}; |
|
|
311 |
.................... #endif |
|
|
312 |
.................... |
|
|
313 |
.................... ////////////////////// END CONFIGURATION /////////////////////////////////// |
|
|
314 |
.................... |
|
|
315 |
.................... #ifndef LCD_ENABLE_PIN |
|
|
316 |
.................... #define lcd_output_enable(x) lcdlat.enable=x |
|
|
317 |
.................... #define lcd_enable_tris() lcdtris.enable=0 |
|
|
318 |
.................... #else |
|
|
319 |
.................... #define lcd_output_enable(x) output_bit(LCD_ENABLE_PIN, x) |
|
|
320 |
.................... #define lcd_enable_tris() output_drive(LCD_ENABLE_PIN) |
|
|
321 |
.................... #endif |
|
|
322 |
.................... |
|
|
323 |
.................... #ifndef LCD_RS_PIN |
|
|
324 |
.................... #define lcd_output_rs(x) lcdlat.rs=x |
|
|
325 |
.................... #define lcd_rs_tris() lcdtris.rs=0 |
|
|
326 |
.................... #else |
|
|
327 |
.................... #define lcd_output_rs(x) output_bit(LCD_RS_PIN, x) |
|
|
328 |
.................... #define lcd_rs_tris() output_drive(LCD_RS_PIN) |
|
|
329 |
.................... #endif |
|
|
330 |
.................... |
|
|
331 |
.................... #ifndef LCD_RW_PIN |
|
|
332 |
.................... #define lcd_output_rw(x) lcdlat.rw=x |
|
|
333 |
.................... #define lcd_rw_tris() lcdtris.rw=0 |
|
|
334 |
.................... #else |
|
|
335 |
.................... #define lcd_output_rw(x) output_bit(LCD_RW_PIN, x) |
|
|
336 |
.................... #define lcd_rw_tris() output_drive(LCD_RW_PIN) |
|
|
337 |
.................... #endif |
|
|
338 |
.................... |
|
|
339 |
.................... // original version of this library incorrectly labeled LCD_DATA0 as LCD_DATA4, |
|
|
340 |
.................... // LCD_DATA1 as LCD_DATA5, and so on. this block of code makes the driver |
|
|
341 |
.................... // compatible with any code written for the original library |
|
|
342 |
.................... #if (defined(LCD_DATA0) && defined(LCD_DATA1) && defined(LCD_DATA2) && defined(LCD_DATA3) && !defined(LCD_DATA4) && !defined(LCD_DATA5) && !defined(LCD_DATA6) && !defined(LCD_DATA7)) |
|
|
343 |
.................... #define LCD_DATA4 LCD_DATA0 |
|
|
344 |
.................... #define LCD_DATA5 LCD_DATA1 |
|
|
345 |
.................... #define LCD_DATA6 LCD_DATA2 |
|
|
346 |
.................... #define LCD_DATA7 LCD_DATA3 |
|
|
347 |
.................... #endif |
|
|
348 |
.................... |
|
|
349 |
.................... #ifndef LCD_DATA4 |
|
|
350 |
.................... #ifndef LCD_DATA_PORT |
|
|
351 |
.................... #if defined(__PCB__) |
|
|
352 |
.................... #define LCD_DATA_PORT 0x06 //portb |
|
|
353 |
.................... #define set_tris_lcd(x) set_tris_b(x) |
|
|
354 |
.................... #else |
|
|
355 |
.................... #if defined(PIN_D0) |
|
|
356 |
.................... #define LCD_DATA_PORT getenv("SFR:PORTD") //portd |
|
|
357 |
.................... #else |
|
|
358 |
.................... #define LCD_DATA_PORT getenv("SFR:PORTB") //portb |
|
|
359 |
.................... #endif |
|
|
360 |
.................... #endif |
|
|
361 |
.................... #endif |
|
|
362 |
.................... |
|
|
363 |
.................... #if defined(__PCB__) |
|
|
364 |
.................... LCD_PIN_MAP lcd, lcdlat; |
|
|
365 |
.................... #byte lcd = LCD_DATA_PORT |
|
|
366 |
.................... #byte lcdlat = LCD_DATA_PORT |
|
|
367 |
.................... #elif defined(__PCM__) |
|
|
368 |
.................... LCD_PIN_MAP lcd, lcdlat, lcdtris; |
|
|
369 |
.................... #byte lcd = LCD_DATA_PORT |
|
|
370 |
.................... #byte lcdlat = LCD_DATA_PORT |
|
|
371 |
.................... #byte lcdtris = LCD_DATA_PORT+0x80 |
|
|
372 |
.................... #elif defined(__PCH__) |
|
|
373 |
.................... LCD_PIN_MAP lcd, lcdlat, lcdtris; |
|
|
374 |
.................... #byte lcd = LCD_DATA_PORT |
|
|
375 |
.................... #byte lcdlat = LCD_DATA_PORT+9 |
|
|
376 |
.................... #byte lcdtris = LCD_DATA_PORT+0x12 |
|
|
377 |
.................... #elif defined(__PCD__) |
|
|
378 |
.................... LCD_PIN_MAP lcd, lcdlat, lcdtris; |
|
|
379 |
.................... #word lcd = LCD_DATA_PORT |
|
|
380 |
.................... #word lcdlat = LCD_DATA_PORT+2 |
|
|
381 |
.................... #word lcdtris = LCD_DATA_PORT-0x02 |
|
|
382 |
.................... #endif |
|
|
383 |
.................... #endif //LCD_DATA4 not defined |
|
|
384 |
.................... |
|
|
385 |
.................... #ifndef LCD_TYPE |
|
|
386 |
.................... #define LCD_TYPE 2 // 0=5x7, 1=5x10, 2=2 lines |
|
|
387 |
.................... #endif |
|
|
388 |
.................... |
|
|
389 |
.................... #ifndef LCD_LINE_TWO |
|
|
390 |
.................... #define LCD_LINE_TWO 0x40 // LCD RAM address for the second line |
|
|
391 |
.................... #endif |
|
|
392 |
.................... |
|
|
393 |
.................... #ifndef LCD_LINE_LENGTH |
|
|
394 |
.................... #define LCD_LINE_LENGTH 20 |
|
|
395 |
.................... #endif |
|
|
396 |
.................... |
|
|
397 |
.................... BYTE const LCD_INIT_STRING[4] = {0x20 | (LCD_TYPE << 2), 0xc, 1, 6}; |
|
|
398 |
.................... // These bytes need to be sent to the LCD |
|
|
399 |
.................... // to start it up. |
|
|
400 |
.................... |
|
|
401 |
.................... BYTE lcd_read_nibble(void); |
|
|
402 |
.................... |
|
|
403 |
.................... BYTE lcd_read_byte(void) |
|
|
404 |
.................... { |
|
|
405 |
.................... BYTE low,high; |
|
|
406 |
.................... |
|
|
407 |
.................... #if defined(__PCB__) |
|
|
408 |
.................... set_tris_lcd(LCD_INPUT_MAP); |
|
|
409 |
.................... #else |
|
|
410 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
|
|
411 |
.................... output_float(LCD_DATA4); |
|
|
412 |
* |
|
|
413 |
00F1: BSF 08.4 |
|
|
414 |
.................... output_float(LCD_DATA5); |
|
|
415 |
00F2: BSF 08.5 |
|
|
416 |
.................... output_float(LCD_DATA6); |
|
|
417 |
00F3: BSF 08.6 |
|
|
418 |
.................... output_float(LCD_DATA7); |
|
|
419 |
00F4: BSF 08.7 |
|
|
420 |
.................... #else |
|
|
421 |
.................... lcdtris.data = 0xF; |
|
|
422 |
.................... #endif |
|
|
423 |
.................... #endif |
|
|
424 |
.................... |
|
|
425 |
.................... lcd_output_rw(1); |
|
|
426 |
00F5: BCF 03.5 |
|
|
427 |
00F6: BSF 09.2 |
|
|
428 |
00F7: BSF 03.5 |
|
|
429 |
00F8: BCF 09.2 |
|
|
430 |
.................... delay_cycles(1); |
|
|
431 |
00F9: NOP |
|
|
432 |
.................... lcd_output_enable(1); |
|
|
433 |
00FA: BCF 03.5 |
|
|
434 |
00FB: BSF 09.0 |
|
|
435 |
00FC: BSF 03.5 |
|
|
436 |
00FD: BCF 09.0 |
|
|
437 |
.................... delay_cycles(1); |
|
|
438 |
00FE: NOP |
|
|
439 |
.................... high = lcd_read_nibble(); |
|
|
440 |
00FF: BCF 03.5 |
|
|
441 |
0100: CALL 0B8 |
|
|
442 |
0101: MOVF 78,W |
|
|
443 |
0102: MOVWF 44 |
|
|
444 |
.................... |
|
|
445 |
.................... lcd_output_enable(0); |
|
|
446 |
0103: BCF 09.0 |
|
|
447 |
0104: BSF 03.5 |
|
|
448 |
0105: BCF 09.0 |
|
|
449 |
.................... delay_cycles(1); |
|
|
450 |
0106: NOP |
|
|
451 |
.................... lcd_output_enable(1); |
|
|
452 |
0107: BCF 03.5 |
|
|
453 |
0108: BSF 09.0 |
|
|
454 |
0109: BSF 03.5 |
|
|
455 |
010A: BCF 09.0 |
|
|
456 |
.................... delay_us(1); |
|
|
457 |
010B: GOTO 10C |
|
|
458 |
.................... low = lcd_read_nibble(); |
|
|
459 |
010C: BCF 03.5 |
|
|
460 |
010D: CALL 0B8 |
|
|
461 |
010E: MOVF 78,W |
|
|
462 |
010F: MOVWF 43 |
|
|
463 |
.................... |
|
|
464 |
.................... lcd_output_enable(0); |
|
|
465 |
0110: BCF 09.0 |
|
|
466 |
0111: BSF 03.5 |
|
|
467 |
0112: BCF 09.0 |
|
|
468 |
.................... |
|
|
469 |
.................... #if defined(__PCB__) |
|
|
470 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
|
|
471 |
.................... #else |
|
|
472 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
|
|
473 |
.................... output_drive(LCD_DATA4); |
|
|
474 |
0113: BCF 08.4 |
|
|
475 |
.................... output_drive(LCD_DATA5); |
|
|
476 |
0114: BCF 08.5 |
|
|
477 |
.................... output_drive(LCD_DATA6); |
|
|
478 |
0115: BCF 08.6 |
|
|
479 |
.................... output_drive(LCD_DATA7); |
|
|
480 |
0116: BCF 08.7 |
|
|
481 |
.................... #else |
|
|
482 |
.................... lcdtris.data = 0x0; |
|
|
483 |
.................... #endif |
|
|
484 |
.................... #endif |
|
|
485 |
.................... |
|
|
486 |
.................... return( (high<<4) | low); |
|
|
487 |
0117: BCF 03.5 |
|
|
488 |
0118: SWAPF 44,W |
|
|
489 |
0119: MOVWF 77 |
|
|
490 |
011A: MOVLW F0 |
|
|
491 |
011B: ANDWF 77,F |
|
|
492 |
011C: MOVF 77,W |
|
|
493 |
011D: IORWF 43,W |
|
|
494 |
011E: MOVWF 78 |
|
|
495 |
.................... } |
|
|
496 |
.................... |
|
|
497 |
.................... BYTE lcd_read_nibble(void) |
|
|
498 |
.................... { |
|
|
499 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
|
|
500 |
* |
|
|
501 |
00B8: CLRF 45 |
|
|
502 |
.................... BYTE n = 0x00; |
|
|
503 |
.................... |
|
|
504 |
.................... /* Read the data port */ |
|
|
505 |
.................... n |= input(LCD_DATA4); |
|
|
506 |
00B9: BSF 03.5 |
|
|
507 |
00BA: BSF 08.4 |
|
|
508 |
00BB: MOVLW 00 |
|
|
509 |
00BC: BCF 03.5 |
|
|
510 |
00BD: BTFSC 08.4 |
|
|
511 |
00BE: MOVLW 01 |
|
|
512 |
00BF: IORWF 45,F |
|
|
513 |
.................... n |= input(LCD_DATA5) << 1; |
|
|
514 |
00C0: BSF 03.5 |
|
|
515 |
00C1: BSF 08.5 |
|
|
516 |
00C2: MOVLW 00 |
|
|
517 |
00C3: BCF 03.5 |
|
|
518 |
00C4: BTFSC 08.5 |
|
|
519 |
00C5: MOVLW 01 |
|
|
520 |
00C6: MOVWF 77 |
|
|
521 |
00C7: BCF 03.0 |
|
|
522 |
00C8: RLF 77,F |
|
|
523 |
00C9: MOVF 77,W |
|
|
524 |
00CA: IORWF 45,F |
|
|
525 |
.................... n |= input(LCD_DATA6) << 2; |
|
|
526 |
00CB: BSF 03.5 |
|
|
527 |
00CC: BSF 08.6 |
|
|
528 |
00CD: MOVLW 00 |
|
|
529 |
00CE: BCF 03.5 |
|
|
530 |
00CF: BTFSC 08.6 |
|
|
531 |
00D0: MOVLW 01 |
|
|
532 |
00D1: MOVWF 77 |
|
|
533 |
00D2: RLF 77,F |
|
|
534 |
00D3: RLF 77,F |
|
|
535 |
00D4: MOVLW FC |
|
|
536 |
00D5: ANDWF 77,F |
|
|
537 |
00D6: MOVF 77,W |
|
|
538 |
00D7: IORWF 45,F |
|
|
539 |
.................... n |= input(LCD_DATA7) << 3; |
|
|
540 |
00D8: BSF 03.5 |
|
|
541 |
00D9: BSF 08.7 |
|
|
542 |
00DA: MOVLW 00 |
|
|
543 |
00DB: BCF 03.5 |
|
|
544 |
00DC: BTFSC 08.7 |
|
|
545 |
00DD: MOVLW 01 |
|
|
546 |
00DE: MOVWF 77 |
|
|
547 |
00DF: RLF 77,F |
|
|
548 |
00E0: RLF 77,F |
|
|
549 |
00E1: RLF 77,F |
|
|
550 |
00E2: MOVLW F8 |
|
|
551 |
00E3: ANDWF 77,F |
|
|
552 |
00E4: MOVF 77,W |
|
|
553 |
00E5: IORWF 45,F |
|
|
554 |
.................... |
|
|
555 |
.................... return(n); |
|
|
556 |
00E6: MOVF 45,W |
|
|
557 |
00E7: MOVWF 78 |
|
|
558 |
.................... #else |
|
|
559 |
.................... return(lcd.data); |
|
|
560 |
.................... #endif |
|
|
561 |
.................... } |
|
|
562 |
00E8: RETURN |
|
|
563 |
.................... |
|
|
564 |
.................... void lcd_send_nibble(BYTE n) |
|
|
565 |
.................... { |
|
|
566 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
|
|
567 |
.................... /* Write to the data port */ |
|
|
568 |
.................... output_bit(LCD_DATA4, bit_test(n, 0)); |
|
|
569 |
* |
|
|
570 |
008C: BTFSC 44.0 |
|
|
571 |
008D: GOTO 090 |
|
|
572 |
008E: BCF 08.4 |
|
|
573 |
008F: GOTO 091 |
|
|
574 |
0090: BSF 08.4 |
|
|
575 |
0091: BSF 03.5 |
|
|
576 |
0092: BCF 08.4 |
|
|
577 |
.................... output_bit(LCD_DATA5, bit_test(n, 1)); |
|
|
578 |
0093: BCF 03.5 |
|
|
579 |
0094: BTFSC 44.1 |
|
|
580 |
0095: GOTO 098 |
|
|
581 |
0096: BCF 08.5 |
|
|
582 |
0097: GOTO 099 |
|
|
583 |
0098: BSF 08.5 |
|
|
584 |
0099: BSF 03.5 |
|
|
585 |
009A: BCF 08.5 |
|
|
586 |
.................... output_bit(LCD_DATA6, bit_test(n, 2)); |
|
|
587 |
009B: BCF 03.5 |
|
|
588 |
009C: BTFSC 44.2 |
|
|
589 |
009D: GOTO 0A0 |
|
|
590 |
009E: BCF 08.6 |
|
|
591 |
009F: GOTO 0A1 |
|
|
592 |
00A0: BSF 08.6 |
|
|
593 |
00A1: BSF 03.5 |
|
|
594 |
00A2: BCF 08.6 |
|
|
595 |
.................... output_bit(LCD_DATA7, bit_test(n, 3)); |
|
|
596 |
00A3: BCF 03.5 |
|
|
597 |
00A4: BTFSC 44.3 |
|
|
598 |
00A5: GOTO 0A8 |
|
|
599 |
00A6: BCF 08.7 |
|
|
600 |
00A7: GOTO 0A9 |
|
|
601 |
00A8: BSF 08.7 |
|
|
602 |
00A9: BSF 03.5 |
|
|
603 |
00AA: BCF 08.7 |
|
|
604 |
.................... #else |
|
|
605 |
.................... lcdlat.data = n; |
|
|
606 |
.................... #endif |
|
|
607 |
.................... |
|
|
608 |
.................... delay_cycles(1); |
|
|
609 |
00AB: NOP |
|
|
610 |
.................... lcd_output_enable(1); |
|
|
611 |
00AC: BCF 03.5 |
|
|
612 |
00AD: BSF 09.0 |
|
|
613 |
00AE: BSF 03.5 |
|
|
614 |
00AF: BCF 09.0 |
|
|
615 |
.................... delay_us(2); |
|
|
616 |
00B0: GOTO 0B1 |
|
|
617 |
00B1: GOTO 0B2 |
|
|
618 |
.................... lcd_output_enable(0); |
|
|
619 |
00B2: BCF 03.5 |
|
|
620 |
00B3: BCF 09.0 |
|
|
621 |
00B4: BSF 03.5 |
|
|
622 |
00B5: BCF 09.0 |
|
|
623 |
.................... } |
|
|
624 |
00B6: BCF 03.5 |
|
|
625 |
00B7: RETURN |
|
|
626 |
.................... |
|
|
627 |
.................... void lcd_send_byte(BYTE address, BYTE n) |
|
|
628 |
.................... { |
|
|
629 |
.................... #if defined(__PCB__) |
|
|
630 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
|
|
631 |
.................... #else |
|
|
632 |
.................... lcd_enable_tris(); |
|
|
633 |
* |
|
|
634 |
00E9: BSF 03.5 |
|
|
635 |
00EA: BCF 09.0 |
|
|
636 |
.................... lcd_rs_tris(); |
|
|
637 |
00EB: BCF 09.1 |
|
|
638 |
.................... lcd_rw_tris(); |
|
|
639 |
00EC: BCF 09.2 |
|
|
640 |
.................... #endif |
|
|
641 |
.................... |
|
|
642 |
.................... lcd_output_rs(0); |
|
|
643 |
00ED: BCF 03.5 |
|
|
644 |
00EE: BCF 09.1 |
|
|
645 |
00EF: BSF 03.5 |
|
|
646 |
00F0: BCF 09.1 |
|
|
647 |
.................... while ( bit_test(lcd_read_byte(),7) ) ; |
|
|
648 |
* |
|
|
649 |
011F: MOVF 78,W |
|
|
650 |
0120: MOVWF 43 |
|
|
651 |
0121: BTFSS 43.7 |
|
|
652 |
0122: GOTO 125 |
|
|
653 |
0123: BSF 03.5 |
|
|
654 |
0124: GOTO 0F1 |
|
|
655 |
.................... lcd_output_rs(address); |
|
|
656 |
0125: MOVF 41,F |
|
|
657 |
0126: BTFSS 03.2 |
|
|
658 |
0127: GOTO 12A |
|
|
659 |
0128: BCF 09.1 |
|
|
660 |
0129: GOTO 12B |
|
|
661 |
012A: BSF 09.1 |
|
|
662 |
012B: BSF 03.5 |
|
|
663 |
012C: BCF 09.1 |
|
|
664 |
.................... delay_cycles(1); |
|
|
665 |
012D: NOP |
|
|
666 |
.................... lcd_output_rw(0); |
|
|
667 |
012E: BCF 03.5 |
|
|
668 |
012F: BCF 09.2 |
|
|
669 |
0130: BSF 03.5 |
|
|
670 |
0131: BCF 09.2 |
|
|
671 |
.................... delay_cycles(1); |
|
|
672 |
0132: NOP |
|
|
673 |
.................... lcd_output_enable(0); |
|
|
674 |
0133: BCF 03.5 |
|
|
675 |
0134: BCF 09.0 |
|
|
676 |
0135: BSF 03.5 |
|
|
677 |
0136: BCF 09.0 |
|
|
678 |
.................... lcd_send_nibble(n >> 4); |
|
|
679 |
0137: BCF 03.5 |
|
|
680 |
0138: SWAPF 42,W |
|
|
681 |
0139: MOVWF 43 |
|
|
682 |
013A: MOVLW 0F |
|
|
683 |
013B: ANDWF 43,F |
|
|
684 |
013C: MOVF 43,W |
|
|
685 |
013D: MOVWF 44 |
|
|
686 |
013E: CALL 08C |
|
|
687 |
.................... lcd_send_nibble(n & 0xf); |
|
|
688 |
013F: MOVF 42,W |
|
|
689 |
0140: ANDLW 0F |
|
|
690 |
0141: MOVWF 43 |
|
|
691 |
0142: MOVWF 44 |
|
|
692 |
0143: CALL 08C |
|
|
693 |
.................... } |
|
|
694 |
0144: RETURN |
|
|
695 |
.................... |
|
|
696 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
|
|
697 |
.................... unsigned int8 g_LcdX, g_LcdY; |
|
|
698 |
.................... #endif |
|
|
699 |
.................... |
|
|
700 |
.................... void lcd_init(void) |
|
|
701 |
.................... { |
|
|
702 |
.................... BYTE i; |
|
|
703 |
.................... |
|
|
704 |
.................... #if defined(__PCB__) |
|
|
705 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
|
|
706 |
.................... #else |
|
|
707 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
|
|
708 |
.................... output_drive(LCD_DATA4); |
|
|
709 |
0145: BSF 03.5 |
|
|
710 |
0146: BCF 08.4 |
|
|
711 |
.................... output_drive(LCD_DATA5); |
|
|
712 |
0147: BCF 08.5 |
|
|
713 |
.................... output_drive(LCD_DATA6); |
|
|
714 |
0148: BCF 08.6 |
|
|
715 |
.................... output_drive(LCD_DATA7); |
|
|
716 |
0149: BCF 08.7 |
|
|
717 |
.................... #else |
|
|
718 |
.................... lcdtris.data = 0x0; |
|
|
719 |
.................... #endif |
|
|
720 |
.................... lcd_enable_tris(); |
|
|
721 |
014A: BCF 09.0 |
|
|
722 |
.................... lcd_rs_tris(); |
|
|
723 |
014B: BCF 09.1 |
|
|
724 |
.................... lcd_rw_tris(); |
|
|
725 |
014C: BCF 09.2 |
|
|
726 |
.................... #endif |
|
|
727 |
.................... |
|
|
728 |
.................... lcd_output_rs(0); |
|
|
729 |
014D: BCF 03.5 |
|
|
730 |
014E: BCF 09.1 |
|
|
731 |
014F: BSF 03.5 |
|
|
732 |
0150: BCF 09.1 |
|
|
733 |
.................... lcd_output_rw(0); |
|
|
734 |
0151: BCF 03.5 |
|
|
735 |
0152: BCF 09.2 |
|
|
736 |
0153: BSF 03.5 |
|
|
737 |
0154: BCF 09.2 |
|
|
738 |
.................... lcd_output_enable(0); |
|
|
739 |
0155: BCF 03.5 |
|
|
740 |
0156: BCF 09.0 |
|
|
741 |
0157: BSF 03.5 |
|
|
742 |
0158: BCF 09.0 |
|
|
743 |
.................... |
|
|
744 |
.................... delay_ms(15); |
|
|
745 |
0159: MOVLW 0F |
|
|
746 |
015A: BCF 03.5 |
|
|
747 |
015B: MOVWF 3D |
|
|
748 |
015C: CALL 078 |
|
|
749 |
.................... for(i=1;i<=3;++i) |
|
|
750 |
015D: MOVLW 01 |
|
|
751 |
015E: MOVWF 2F |
|
|
752 |
015F: MOVF 2F,W |
|
|
753 |
0160: SUBLW 03 |
|
|
754 |
0161: BTFSS 03.0 |
|
|
755 |
0162: GOTO 16B |
|
|
756 |
.................... { |
|
|
757 |
.................... lcd_send_nibble(3); |
|
|
758 |
0163: MOVLW 03 |
|
|
759 |
0164: MOVWF 44 |
|
|
760 |
0165: CALL 08C |
|
|
761 |
.................... delay_ms(5); |
|
|
762 |
0166: MOVLW 05 |
|
|
763 |
0167: MOVWF 3D |
|
|
764 |
0168: CALL 078 |
|
|
765 |
.................... } |
|
|
766 |
0169: INCF 2F,F |
|
|
767 |
016A: GOTO 15F |
|
|
768 |
.................... |
|
|
769 |
.................... lcd_send_nibble(2); |
|
|
770 |
016B: MOVLW 02 |
|
|
771 |
016C: MOVWF 44 |
|
|
772 |
016D: CALL 08C |
|
|
773 |
.................... for(i=0;i<=3;++i) |
|
|
774 |
016E: CLRF 2F |
|
|
775 |
016F: MOVF 2F,W |
|
|
776 |
0170: SUBLW 03 |
|
|
777 |
0171: BTFSS 03.0 |
|
|
778 |
0172: GOTO 17C |
|
|
779 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
|
|
780 |
0173: MOVF 2F,W |
|
|
781 |
0174: CALL 004 |
|
|
782 |
0175: MOVWF 30 |
|
|
783 |
0176: CLRF 41 |
|
|
784 |
0177: MOVF 30,W |
|
|
785 |
0178: MOVWF 42 |
|
|
786 |
0179: CALL 0E9 |
|
|
787 |
.................... |
|
|
788 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
|
|
789 |
017A: INCF 2F,F |
|
|
790 |
017B: GOTO 16F |
|
|
791 |
.................... g_LcdX = 0; |
|
|
792 |
.................... g_LcdY = 0; |
|
|
793 |
.................... #endif |
|
|
794 |
.................... } |
|
|
795 |
017C: RETURN |
|
|
796 |
.................... |
|
|
797 |
.................... void lcd_gotoxy(BYTE x, BYTE y) |
|
|
798 |
.................... { |
|
|
799 |
.................... BYTE address; |
|
|
800 |
.................... |
|
|
801 |
.................... if(y!=1) |
|
|
802 |
017D: DECFSZ 3E,W |
|
|
803 |
017E: GOTO 180 |
|
|
804 |
017F: GOTO 183 |
|
|
805 |
.................... address=LCD_LINE_TWO; |
|
|
806 |
0180: MOVLW 40 |
|
|
807 |
0181: MOVWF 3F |
|
|
808 |
.................... else |
|
|
809 |
0182: GOTO 184 |
|
|
810 |
.................... address=0; |
|
|
811 |
0183: CLRF 3F |
|
|
812 |
.................... |
|
|
813 |
.................... address+=x-1; |
|
|
814 |
0184: MOVLW 01 |
|
|
815 |
0185: SUBWF 3D,W |
|
|
816 |
0186: ADDWF 3F,F |
|
|
817 |
.................... lcd_send_byte(0,0x80|address); |
|
|
818 |
0187: MOVF 3F,W |
|
|
819 |
0188: IORLW 80 |
|
|
820 |
0189: MOVWF 40 |
|
|
821 |
018A: CLRF 41 |
|
|
822 |
018B: MOVF 40,W |
|
|
823 |
018C: MOVWF 42 |
|
|
824 |
018D: CALL 0E9 |
|
|
825 |
.................... |
|
|
826 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
|
|
827 |
.................... g_LcdX = x - 1; |
|
|
828 |
.................... g_LcdY = y - 1; |
|
|
829 |
.................... #endif |
|
|
830 |
.................... } |
|
|
831 |
018E: RETURN |
|
|
832 |
.................... |
|
|
833 |
.................... void lcd_putc(char c) |
|
|
834 |
.................... { |
|
|
835 |
.................... switch (c) |
|
|
836 |
.................... { |
|
|
837 |
018F: MOVF 3C,W |
|
|
838 |
0190: XORLW 07 |
|
|
839 |
0191: BTFSC 03.2 |
|
|
840 |
0192: GOTO 19D |
|
|
841 |
0193: XORLW 0B |
|
|
842 |
0194: BTFSC 03.2 |
|
|
843 |
0195: GOTO 1A2 |
|
|
844 |
0196: XORLW 06 |
|
|
845 |
0197: BTFSC 03.2 |
|
|
846 |
0198: GOTO 1AA |
|
|
847 |
0199: XORLW 02 |
|
|
848 |
019A: BTFSC 03.2 |
|
|
849 |
019B: GOTO 1B0 |
|
|
850 |
019C: GOTO 1B5 |
|
|
851 |
.................... case '\a' : lcd_gotoxy(1,1); break; |
|
|
852 |
019D: MOVLW 01 |
|
|
853 |
019E: MOVWF 3D |
|
|
854 |
019F: MOVWF 3E |
|
|
855 |
01A0: CALL 17D |
|
|
856 |
01A1: GOTO 1BB |
|
|
857 |
.................... |
|
|
858 |
.................... case '\f' : lcd_send_byte(0,1); |
|
|
859 |
01A2: CLRF 41 |
|
|
860 |
01A3: MOVLW 01 |
|
|
861 |
01A4: MOVWF 42 |
|
|
862 |
01A5: CALL 0E9 |
|
|
863 |
.................... delay_ms(2); |
|
|
864 |
01A6: MOVLW 02 |
|
|
865 |
01A7: MOVWF 3D |
|
|
866 |
01A8: CALL 078 |
|
|
867 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
|
|
868 |
.................... g_LcdX = 0; |
|
|
869 |
.................... g_LcdY = 0; |
|
|
870 |
.................... #endif |
|
|
871 |
.................... break; |
|
|
872 |
01A9: GOTO 1BB |
|
|
873 |
.................... |
|
|
874 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
|
|
875 |
.................... case '\r' : lcd_gotoxy(1, g_LcdY+1); break; |
|
|
876 |
.................... case '\n' : |
|
|
877 |
.................... while (g_LcdX++ < LCD_LINE_LENGTH) |
|
|
878 |
.................... { |
|
|
879 |
.................... lcd_send_byte(1, ' '); |
|
|
880 |
.................... } |
|
|
881 |
.................... lcd_gotoxy(1, g_LcdY+2); |
|
|
882 |
.................... break; |
|
|
883 |
.................... #else |
|
|
884 |
.................... case '\n' : lcd_gotoxy(1,2); break; |
|
|
885 |
01AA: MOVLW 01 |
|
|
886 |
01AB: MOVWF 3D |
|
|
887 |
01AC: MOVLW 02 |
|
|
888 |
01AD: MOVWF 3E |
|
|
889 |
01AE: CALL 17D |
|
|
890 |
01AF: GOTO 1BB |
|
|
891 |
.................... #endif |
|
|
892 |
.................... |
|
|
893 |
.................... case '\b' : lcd_send_byte(0,0x10); break; |
|
|
894 |
01B0: CLRF 41 |
|
|
895 |
01B1: MOVLW 10 |
|
|
896 |
01B2: MOVWF 42 |
|
|
897 |
01B3: CALL 0E9 |
|
|
898 |
01B4: GOTO 1BB |
|
|
899 |
.................... |
|
|
900 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
|
|
901 |
.................... default : |
|
|
902 |
.................... if (g_LcdX < LCD_LINE_LENGTH) |
|
|
903 |
.................... { |
|
|
904 |
.................... lcd_send_byte(1, c); |
|
|
905 |
.................... g_LcdX++; |
|
|
906 |
.................... } |
|
|
907 |
.................... break; |
|
|
908 |
.................... #else |
|
|
909 |
.................... default : lcd_send_byte(1,c); break; |
|
|
910 |
01B5: MOVLW 01 |
|
|
911 |
01B6: MOVWF 41 |
|
|
912 |
01B7: MOVF 3C,W |
|
|
913 |
01B8: MOVWF 42 |
|
|
914 |
01B9: CALL 0E9 |
|
|
915 |
01BA: GOTO 1BB |
|
|
916 |
.................... #endif |
|
|
917 |
.................... } |
|
|
918 |
.................... } |
|
|
919 |
01BB: RETURN |
|
|
920 |
.................... |
|
|
921 |
.................... char lcd_getc(BYTE x, BYTE y) |
|
|
922 |
.................... { |
|
|
923 |
.................... char value; |
|
|
924 |
.................... |
|
|
925 |
.................... lcd_gotoxy(x,y); |
|
|
926 |
.................... while ( bit_test(lcd_read_byte(),7) ); // wait until busy flag is low |
|
|
927 |
.................... lcd_output_rs(1); |
|
|
928 |
.................... value = lcd_read_byte(); |
|
|
929 |
.................... lcd_output_rs(0); |
|
|
930 |
.................... |
|
|
931 |
.................... return(value); |
|
|
932 |
.................... } |
|
|
933 |
.................... |
|
|
934 |
.................... |
|
|
935 |
.................... #include "../SHT25.h" |
|
|
936 |
.................... |
|
|
937 |
.................... #define SHT25_HEATER_ON 0x04 |
|
|
938 |
.................... #define SHT25_HEATER_OFF 0x00 |
|
|
939 |
.................... #define SHT25_OTP_reload_off 0x02 |
|
|
940 |
.................... #define SHT25_RH12_T14 0x00 |
|
|
941 |
.................... #define SHT25_RH8_T12 0x01 |
|
|
942 |
.................... #define SHT25_RH10_T13 0x80 |
|
|
943 |
.................... #define SHT25_RH11_T11 0x81 |
|
|
944 |
.................... |
|
|
945 |
.................... #define SHT25_ADDR 0x80 |
|
|
946 |
.................... |
|
|
947 |
.................... #include "SHT25.c" |
|
|
948 |
.................... void SHT25_soft_reset() |
|
|
949 |
.................... { |
|
|
950 |
.................... i2c_start(); // Start condition |
|
|
951 |
.................... i2c_write(0x80); // Device address |
|
|
952 |
.................... i2c_write(0xFE); // Device command |
|
|
953 |
.................... i2c_stop(); // Stop condition |
|
|
954 |
.................... } |
|
|
955 |
.................... |
|
|
956 |
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value |
|
|
957 |
.................... { |
|
|
958 |
.................... unsigned int8 reg; |
|
|
959 |
.................... |
|
|
960 |
.................... i2c_start(); // Start condition |
|
|
961 |
.................... i2c_write(SHT25_ADDR); // Device address |
|
|
962 |
.................... i2c_write(0xE7); // Device command |
|
|
963 |
.................... |
|
|
964 |
.................... i2c_start(); // Start condition |
|
|
965 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
|
|
966 |
.................... reg=i2c_read(0); // Read status actual status register |
|
|
967 |
.................... |
|
|
968 |
.................... reg = (reg & 0x3A) | setup_reg; |
|
|
969 |
.................... |
|
|
970 |
.................... i2c_start(); // Start condition |
|
|
971 |
.................... i2c_write(SHT25_ADDR); // Device address |
|
|
972 |
.................... i2c_write(0xE6); // Write to status register |
|
|
973 |
.................... i2c_write(reg); // Device command |
|
|
974 |
.................... i2c_stop(); // Stop condition |
|
|
975 |
.................... |
|
|
976 |
.................... delay_ms(10); |
|
|
977 |
.................... |
|
|
978 |
.................... i2c_start(); // Start condition |
|
|
979 |
.................... i2c_write(SHT25_ADDR); // Device address |
|
|
980 |
.................... i2c_write(0xE7); // Device command |
|
|
981 |
.................... |
|
|
982 |
.................... i2c_start(); // Start condition |
|
|
983 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
|
|
984 |
.................... reg=i2c_read(0); // Read status actual status register |
|
|
985 |
.................... |
|
|
986 |
.................... return (reg); |
|
|
987 |
.................... } |
|
|
988 |
.................... |
|
|
989 |
.................... |
|
|
990 |
.................... float SHT25_get_temp() |
|
|
991 |
.................... { |
|
|
992 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
993 |
.................... unsigned int16 data; |
|
|
994 |
.................... |
|
|
995 |
.................... i2c_start(); |
|
|
996 |
* |
|
|
997 |
052E: BSF 20.4 |
|
|
998 |
052F: MOVF 20,W |
|
|
999 |
0530: BSF 03.5 |
|
|
1000 |
0531: MOVWF 07 |
|
|
1001 |
0532: NOP |
|
|
1002 |
0533: BCF 03.5 |
|
|
1003 |
0534: BSF 20.3 |
|
|
1004 |
0535: MOVF 20,W |
|
|
1005 |
0536: BSF 03.5 |
|
|
1006 |
0537: MOVWF 07 |
|
|
1007 |
0538: NOP |
|
|
1008 |
0539: BCF 03.5 |
|
|
1009 |
053A: BTFSS 07.3 |
|
|
1010 |
053B: GOTO 53A |
|
|
1011 |
053C: BCF 07.4 |
|
|
1012 |
053D: BCF 20.4 |
|
|
1013 |
053E: MOVF 20,W |
|
|
1014 |
053F: BSF 03.5 |
|
|
1015 |
0540: MOVWF 07 |
|
|
1016 |
0541: NOP |
|
|
1017 |
0542: BCF 03.5 |
|
|
1018 |
0543: BCF 07.3 |
|
|
1019 |
0544: BCF 20.3 |
|
|
1020 |
0545: MOVF 20,W |
|
|
1021 |
0546: BSF 03.5 |
|
|
1022 |
0547: MOVWF 07 |
|
|
1023 |
.................... I2C_Write(SHT25_ADDR); |
|
|
1024 |
0548: MOVLW 80 |
|
|
1025 |
0549: BCF 03.5 |
|
|
1026 |
054A: MOVWF 34 |
|
|
1027 |
054B: CALL 202 |
|
|
1028 |
.................... I2C_write(0xE3); |
|
|
1029 |
054C: MOVLW E3 |
|
|
1030 |
054D: MOVWF 34 |
|
|
1031 |
054E: CALL 202 |
|
|
1032 |
.................... i2c_stop(); |
|
|
1033 |
054F: BCF 20.4 |
|
|
1034 |
0550: MOVF 20,W |
|
|
1035 |
0551: BSF 03.5 |
|
|
1036 |
0552: MOVWF 07 |
|
|
1037 |
0553: NOP |
|
|
1038 |
0554: BCF 03.5 |
|
|
1039 |
0555: BSF 20.3 |
|
|
1040 |
0556: MOVF 20,W |
|
|
1041 |
0557: BSF 03.5 |
|
|
1042 |
0558: MOVWF 07 |
|
|
1043 |
0559: BCF 03.5 |
|
|
1044 |
055A: BTFSS 07.3 |
|
|
1045 |
055B: GOTO 55A |
|
|
1046 |
055C: NOP |
|
|
1047 |
055D: GOTO 55E |
|
|
1048 |
055E: NOP |
|
|
1049 |
055F: BSF 20.4 |
|
|
1050 |
0560: MOVF 20,W |
|
|
1051 |
0561: BSF 03.5 |
|
|
1052 |
0562: MOVWF 07 |
|
|
1053 |
0563: NOP |
|
|
1054 |
.................... |
|
|
1055 |
.................... delay_ms(100); |
|
|
1056 |
0564: MOVLW 64 |
|
|
1057 |
0565: BCF 03.5 |
|
|
1058 |
0566: MOVWF 3D |
|
|
1059 |
0567: CALL 078 |
|
|
1060 |
.................... |
|
|
1061 |
.................... i2c_start(); |
|
|
1062 |
0568: BSF 20.4 |
|
|
1063 |
0569: MOVF 20,W |
|
|
1064 |
056A: BSF 03.5 |
|
|
1065 |
056B: MOVWF 07 |
|
|
1066 |
056C: NOP |
|
|
1067 |
056D: BCF 03.5 |
|
|
1068 |
056E: BSF 20.3 |
|
|
1069 |
056F: MOVF 20,W |
|
|
1070 |
0570: BSF 03.5 |
|
|
1071 |
0571: MOVWF 07 |
|
|
1072 |
0572: NOP |
|
|
1073 |
0573: BCF 03.5 |
|
|
1074 |
0574: BCF 07.4 |
|
|
1075 |
0575: BCF 20.4 |
|
|
1076 |
0576: MOVF 20,W |
|
|
1077 |
0577: BSF 03.5 |
|
|
1078 |
0578: MOVWF 07 |
|
|
1079 |
0579: NOP |
|
|
1080 |
057A: BCF 03.5 |
|
|
1081 |
057B: BCF 07.3 |
|
|
1082 |
057C: BCF 20.3 |
|
|
1083 |
057D: MOVF 20,W |
|
|
1084 |
057E: BSF 03.5 |
|
|
1085 |
057F: MOVWF 07 |
|
|
1086 |
.................... I2C_Write(SHT25_ADDR+1); |
|
|
1087 |
0580: MOVLW 81 |
|
|
1088 |
0581: BCF 03.5 |
|
|
1089 |
0582: MOVWF 34 |
|
|
1090 |
0583: CALL 202 |
|
|
1091 |
.................... MSB=i2c_read(1); |
|
|
1092 |
0584: MOVLW 01 |
|
|
1093 |
0585: MOVWF 77 |
|
|
1094 |
0586: CALL 24C |
|
|
1095 |
0587: MOVF 78,W |
|
|
1096 |
0588: MOVWF 2F |
|
|
1097 |
.................... LSB=i2c_read(1); |
|
|
1098 |
0589: MOVLW 01 |
|
|
1099 |
058A: MOVWF 77 |
|
|
1100 |
058B: CALL 24C |
|
|
1101 |
058C: MOVF 78,W |
|
|
1102 |
058D: MOVWF 30 |
|
|
1103 |
.................... Check=i2c_read(0); |
|
|
1104 |
058E: CLRF 77 |
|
|
1105 |
058F: CALL 24C |
|
|
1106 |
0590: MOVF 78,W |
|
|
1107 |
0591: MOVWF 31 |
|
|
1108 |
.................... i2c_stop(); |
|
|
1109 |
0592: BCF 20.4 |
|
|
1110 |
0593: MOVF 20,W |
|
|
1111 |
0594: BSF 03.5 |
|
|
1112 |
0595: MOVWF 07 |
|
|
1113 |
0596: NOP |
|
|
1114 |
0597: BCF 03.5 |
|
|
1115 |
0598: BSF 20.3 |
|
|
1116 |
0599: MOVF 20,W |
|
|
1117 |
059A: BSF 03.5 |
|
|
1118 |
059B: MOVWF 07 |
|
|
1119 |
059C: BCF 03.5 |
|
|
1120 |
059D: BTFSS 07.3 |
|
|
1121 |
059E: GOTO 59D |
|
|
1122 |
059F: NOP |
|
|
1123 |
05A0: GOTO 5A1 |
|
|
1124 |
05A1: NOP |
|
|
1125 |
05A2: BSF 20.4 |
|
|
1126 |
05A3: MOVF 20,W |
|
|
1127 |
05A4: BSF 03.5 |
|
|
1128 |
05A5: MOVWF 07 |
|
|
1129 |
05A6: NOP |
|
|
1130 |
.................... |
|
|
1131 |
.................... LSB = LSB >> 2; // trow out status bits |
|
|
1132 |
05A7: BCF 03.5 |
|
|
1133 |
05A8: RRF 30,F |
|
|
1134 |
05A9: RRF 30,F |
|
|
1135 |
05AA: MOVLW 3F |
|
|
1136 |
05AB: ANDWF 30,F |
|
|
1137 |
.................... |
|
|
1138 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
|
|
1139 |
05AC: CLRF 35 |
|
|
1140 |
05AD: MOVF 2F,W |
|
|
1141 |
05AE: MOVWF 34 |
|
|
1142 |
05AF: MOVWF 35 |
|
|
1143 |
05B0: CLRF 34 |
|
|
1144 |
05B1: SWAPF 30,W |
|
|
1145 |
05B2: MOVWF 77 |
|
|
1146 |
05B3: MOVLW F0 |
|
|
1147 |
05B4: ANDWF 77,F |
|
|
1148 |
05B5: MOVF 77,W |
|
|
1149 |
05B6: ADDWF 34,W |
|
|
1150 |
05B7: MOVWF 32 |
|
|
1151 |
05B8: MOVF 35,W |
|
|
1152 |
05B9: MOVWF 33 |
|
|
1153 |
05BA: BTFSC 03.0 |
|
|
1154 |
05BB: INCF 33,F |
|
|
1155 |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
|
|
1156 |
05BC: MOVF 33,W |
|
|
1157 |
05BD: MOVWF 35 |
|
|
1158 |
05BE: MOVF 32,W |
|
|
1159 |
05BF: MOVWF 34 |
|
|
1160 |
05C0: CALL 291 |
|
|
1161 |
05C1: MOVF 77,W |
|
|
1162 |
05C2: MOVWF 34 |
|
|
1163 |
05C3: MOVF 78,W |
|
|
1164 |
05C4: MOVWF 35 |
|
|
1165 |
05C5: MOVF 79,W |
|
|
1166 |
05C6: MOVWF 36 |
|
|
1167 |
05C7: MOVF 7A,W |
|
|
1168 |
05C8: MOVWF 37 |
|
|
1169 |
05C9: MOVWF 3B |
|
|
1170 |
05CA: MOVF 79,W |
|
|
1171 |
05CB: MOVWF 3A |
|
|
1172 |
05CC: MOVF 78,W |
|
|
1173 |
05CD: MOVWF 39 |
|
|
1174 |
05CE: MOVF 77,W |
|
|
1175 |
05CF: MOVWF 38 |
|
|
1176 |
05D0: CLRF 3F |
|
|
1177 |
05D1: MOVLW FF |
|
|
1178 |
05D2: MOVWF 3E |
|
|
1179 |
05D3: MOVLW 7F |
|
|
1180 |
05D4: MOVWF 3D |
|
|
1181 |
05D5: MOVLW 8E |
|
|
1182 |
05D6: MOVWF 3C |
|
|
1183 |
05D7: CALL 2AE |
|
|
1184 |
05D8: MOVLW 52 |
|
|
1185 |
05D9: MOVWF 3F |
|
|
1186 |
05DA: MOVLW B8 |
|
|
1187 |
05DB: MOVWF 3E |
|
|
1188 |
05DC: MOVLW 2F |
|
|
1189 |
05DD: MOVWF 3D |
|
|
1190 |
05DE: MOVLW 86 |
|
|
1191 |
05DF: MOVWF 3C |
|
|
1192 |
05E0: MOVF 7A,W |
|
|
1193 |
05E1: MOVWF 43 |
|
|
1194 |
05E2: MOVF 79,W |
|
|
1195 |
05E3: MOVWF 42 |
|
|
1196 |
05E4: MOVF 78,W |
|
|
1197 |
05E5: MOVWF 41 |
|
|
1198 |
05E6: MOVF 77,W |
|
|
1199 |
05E7: MOVWF 40 |
|
|
1200 |
05E8: CALL 378 |
|
|
1201 |
05E9: BCF 03.1 |
|
|
1202 |
05EA: MOVLW 66 |
|
|
1203 |
05EB: MOVWF 37 |
|
|
1204 |
05EC: MOVWF 36 |
|
|
1205 |
05ED: MOVLW BB |
|
|
1206 |
05EE: MOVWF 35 |
|
|
1207 |
05EF: MOVLW 84 |
|
|
1208 |
05F0: MOVWF 34 |
|
|
1209 |
05F1: MOVF 7A,W |
|
|
1210 |
05F2: MOVWF 3B |
|
|
1211 |
05F3: MOVF 79,W |
|
|
1212 |
05F4: MOVWF 3A |
|
|
1213 |
05F5: MOVF 78,W |
|
|
1214 |
05F6: MOVWF 39 |
|
|
1215 |
05F7: MOVF 77,W |
|
|
1216 |
05F8: MOVWF 38 |
|
|
1217 |
05F9: CALL 3ED |
|
|
1218 |
.................... } |
|
|
1219 |
05FA: BSF 0A.3 |
|
|
1220 |
05FB: BCF 0A.4 |
|
|
1221 |
05FC: GOTO 2E4 (RETURN) |
|
|
1222 |
.................... |
|
|
1223 |
.................... float SHT25_get_hum() |
|
|
1224 |
.................... { |
|
|
1225 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
1226 |
.................... unsigned int16 data; |
|
|
1227 |
.................... |
|
|
1228 |
.................... i2c_start(); //RH |
|
|
1229 |
05FD: BSF 20.4 |
|
|
1230 |
05FE: MOVF 20,W |
|
|
1231 |
05FF: BSF 03.5 |
|
|
1232 |
0600: MOVWF 07 |
|
|
1233 |
0601: NOP |
|
|
1234 |
0602: BCF 03.5 |
|
|
1235 |
0603: BSF 20.3 |
|
|
1236 |
0604: MOVF 20,W |
|
|
1237 |
0605: BSF 03.5 |
|
|
1238 |
0606: MOVWF 07 |
|
|
1239 |
0607: NOP |
|
|
1240 |
0608: BCF 03.5 |
|
|
1241 |
0609: BCF 07.4 |
|
|
1242 |
060A: BCF 20.4 |
|
|
1243 |
060B: MOVF 20,W |
|
|
1244 |
060C: BSF 03.5 |
|
|
1245 |
060D: MOVWF 07 |
|
|
1246 |
060E: NOP |
|
|
1247 |
060F: BCF 03.5 |
|
|
1248 |
0610: BCF 07.3 |
|
|
1249 |
0611: BCF 20.3 |
|
|
1250 |
0612: MOVF 20,W |
|
|
1251 |
0613: BSF 03.5 |
|
|
1252 |
0614: MOVWF 07 |
|
|
1253 |
.................... I2C_Write(SHT25_ADDR); |
|
|
1254 |
0615: MOVLW 80 |
|
|
1255 |
0616: BCF 03.5 |
|
|
1256 |
0617: MOVWF 34 |
|
|
1257 |
0618: CALL 202 |
|
|
1258 |
.................... I2C_write(0xE5); |
|
|
1259 |
0619: MOVLW E5 |
|
|
1260 |
061A: MOVWF 34 |
|
|
1261 |
061B: CALL 202 |
|
|
1262 |
.................... |
|
|
1263 |
.................... delay_ms(100); |
|
|
1264 |
061C: MOVLW 64 |
|
|
1265 |
061D: MOVWF 3D |
|
|
1266 |
061E: CALL 078 |
|
|
1267 |
.................... |
|
|
1268 |
.................... i2c_start(); |
|
|
1269 |
061F: BSF 20.4 |
|
|
1270 |
0620: MOVF 20,W |
|
|
1271 |
0621: BSF 03.5 |
|
|
1272 |
0622: MOVWF 07 |
|
|
1273 |
0623: NOP |
|
|
1274 |
0624: BCF 03.5 |
|
|
1275 |
0625: BSF 20.3 |
|
|
1276 |
0626: MOVF 20,W |
|
|
1277 |
0627: BSF 03.5 |
|
|
1278 |
0628: MOVWF 07 |
|
|
1279 |
0629: NOP |
|
|
1280 |
062A: BCF 03.5 |
|
|
1281 |
062B: BTFSS 07.3 |
|
|
1282 |
062C: GOTO 62B |
|
|
1283 |
062D: BCF 07.4 |
|
|
1284 |
062E: BCF 20.4 |
|
|
1285 |
062F: MOVF 20,W |
|
|
1286 |
0630: BSF 03.5 |
|
|
1287 |
0631: MOVWF 07 |
|
|
1288 |
0632: NOP |
|
|
1289 |
0633: BCF 03.5 |
|
|
1290 |
0634: BCF 07.3 |
|
|
1291 |
0635: BCF 20.3 |
|
|
1292 |
0636: MOVF 20,W |
|
|
1293 |
0637: BSF 03.5 |
|
|
1294 |
0638: MOVWF 07 |
|
|
1295 |
.................... I2C_Write(SHT25_ADDR+1); |
|
|
1296 |
0639: MOVLW 81 |
|
|
1297 |
063A: BCF 03.5 |
|
|
1298 |
063B: MOVWF 34 |
|
|
1299 |
063C: CALL 202 |
|
|
1300 |
.................... MSB=i2c_read(1); |
|
|
1301 |
063D: MOVLW 01 |
|
|
1302 |
063E: MOVWF 77 |
|
|
1303 |
063F: CALL 24C |
|
|
1304 |
0640: MOVF 78,W |
|
|
1305 |
0641: MOVWF 2F |
|
|
1306 |
.................... LSB=i2c_read(1); |
|
|
1307 |
0642: MOVLW 01 |
|
|
1308 |
0643: MOVWF 77 |
|
|
1309 |
0644: CALL 24C |
|
|
1310 |
0645: MOVF 78,W |
|
|
1311 |
0646: MOVWF 30 |
|
|
1312 |
.................... Check=i2c_read(0); |
|
|
1313 |
0647: CLRF 77 |
|
|
1314 |
0648: CALL 24C |
|
|
1315 |
0649: MOVF 78,W |
|
|
1316 |
064A: MOVWF 31 |
|
|
1317 |
.................... i2c_stop(); |
|
|
1318 |
064B: BCF 20.4 |
|
|
1319 |
064C: MOVF 20,W |
|
|
1320 |
064D: BSF 03.5 |
|
|
1321 |
064E: MOVWF 07 |
|
|
1322 |
064F: NOP |
|
|
1323 |
0650: BCF 03.5 |
|
|
1324 |
0651: BSF 20.3 |
|
|
1325 |
0652: MOVF 20,W |
|
|
1326 |
0653: BSF 03.5 |
|
|
1327 |
0654: MOVWF 07 |
|
|
1328 |
0655: BCF 03.5 |
|
|
1329 |
0656: BTFSS 07.3 |
|
|
1330 |
0657: GOTO 656 |
|
|
1331 |
0658: NOP |
|
|
1332 |
0659: GOTO 65A |
|
|
1333 |
065A: NOP |
|
|
1334 |
065B: BSF 20.4 |
|
|
1335 |
065C: MOVF 20,W |
|
|
1336 |
065D: BSF 03.5 |
|
|
1337 |
065E: MOVWF 07 |
|
|
1338 |
065F: NOP |
|
|
1339 |
.................... |
|
|
1340 |
.................... LSB = LSB >> 2; // trow out status bits |
|
|
1341 |
0660: BCF 03.5 |
|
|
1342 |
0661: RRF 30,F |
|
|
1343 |
0662: RRF 30,F |
|
|
1344 |
0663: MOVLW 3F |
|
|
1345 |
0664: ANDWF 30,F |
|
|
1346 |
.................... |
|
|
1347 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
|
|
1348 |
0665: CLRF 35 |
|
|
1349 |
0666: MOVF 2F,W |
|
|
1350 |
0667: MOVWF 34 |
|
|
1351 |
0668: MOVWF 35 |
|
|
1352 |
0669: CLRF 34 |
|
|
1353 |
066A: SWAPF 30,W |
|
|
1354 |
066B: MOVWF 77 |
|
|
1355 |
066C: MOVLW F0 |
|
|
1356 |
066D: ANDWF 77,F |
|
|
1357 |
066E: MOVF 77,W |
|
|
1358 |
066F: ADDWF 34,W |
|
|
1359 |
0670: MOVWF 32 |
|
|
1360 |
0671: MOVF 35,W |
|
|
1361 |
0672: MOVWF 33 |
|
|
1362 |
0673: BTFSC 03.0 |
|
|
1363 |
0674: INCF 33,F |
|
|
1364 |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
|
|
1365 |
0675: MOVF 33,W |
|
|
1366 |
0676: MOVWF 35 |
|
|
1367 |
0677: MOVF 32,W |
|
|
1368 |
0678: MOVWF 34 |
|
|
1369 |
0679: CALL 291 |
|
|
1370 |
067A: MOVF 77,W |
|
|
1371 |
067B: MOVWF 34 |
|
|
1372 |
067C: MOVF 78,W |
|
|
1373 |
067D: MOVWF 35 |
|
|
1374 |
067E: MOVF 79,W |
|
|
1375 |
067F: MOVWF 36 |
|
|
1376 |
0680: MOVF 7A,W |
|
|
1377 |
0681: MOVWF 37 |
|
|
1378 |
0682: MOVWF 3B |
|
|
1379 |
0683: MOVF 79,W |
|
|
1380 |
0684: MOVWF 3A |
|
|
1381 |
0685: MOVF 78,W |
|
|
1382 |
0686: MOVWF 39 |
|
|
1383 |
0687: MOVF 77,W |
|
|
1384 |
0688: MOVWF 38 |
|
|
1385 |
0689: CLRF 3F |
|
|
1386 |
068A: MOVLW FF |
|
|
1387 |
068B: MOVWF 3E |
|
|
1388 |
068C: MOVLW 7F |
|
|
1389 |
068D: MOVWF 3D |
|
|
1390 |
068E: MOVLW 8E |
|
|
1391 |
068F: MOVWF 3C |
|
|
1392 |
0690: CALL 2AE |
|
|
1393 |
0691: CLRF 3F |
|
|
1394 |
0692: CLRF 3E |
|
|
1395 |
0693: MOVLW 7A |
|
|
1396 |
0694: MOVWF 3D |
|
|
1397 |
0695: MOVLW 85 |
|
|
1398 |
0696: MOVWF 3C |
|
|
1399 |
0697: MOVF 7A,W |
|
|
1400 |
0698: MOVWF 43 |
|
|
1401 |
0699: MOVF 79,W |
|
|
1402 |
069A: MOVWF 42 |
|
|
1403 |
069B: MOVF 78,W |
|
|
1404 |
069C: MOVWF 41 |
|
|
1405 |
069D: MOVF 77,W |
|
|
1406 |
069E: MOVWF 40 |
|
|
1407 |
069F: CALL 378 |
|
|
1408 |
06A0: BCF 03.1 |
|
|
1409 |
06A1: CLRF 37 |
|
|
1410 |
06A2: CLRF 36 |
|
|
1411 |
06A3: MOVLW C0 |
|
|
1412 |
06A4: MOVWF 35 |
|
|
1413 |
06A5: MOVLW 81 |
|
|
1414 |
06A6: MOVWF 34 |
|
|
1415 |
06A7: MOVF 7A,W |
|
|
1416 |
06A8: MOVWF 3B |
|
|
1417 |
06A9: MOVF 79,W |
|
|
1418 |
06AA: MOVWF 3A |
|
|
1419 |
06AB: MOVF 78,W |
|
|
1420 |
06AC: MOVWF 39 |
|
|
1421 |
06AD: MOVF 77,W |
|
|
1422 |
06AE: MOVWF 38 |
|
|
1423 |
06AF: CALL 3ED |
|
|
1424 |
.................... } |
|
|
1425 |
06B0: BSF 0A.3 |
|
|
1426 |
06B1: BCF 0A.4 |
|
|
1427 |
06B2: GOTO 2EF (RETURN) |
|
|
1428 |
.................... |
|
|
1429 |
.................... |
|
|
1430 |
.................... |
|
|
1431 |
.................... |
|
|
1432 |
.................... #include "../LTS01.h" |
|
|
1433 |
.................... //Adresa pro VDD, VDD, VDD W 0x9E R 0x9F |
|
|
1434 |
.................... //Adresa pro GND GND GND W 0x90 R 0x91 |
|
|
1435 |
.................... |
|
|
1436 |
.................... #define LTS01A_address 0x90 |
|
|
1437 |
.................... |
|
|
1438 |
.................... #include "LTS01.c" |
|
|
1439 |
.................... float LTS01_get_temp() |
|
|
1440 |
.................... { |
|
|
1441 |
.................... unsigned int8 MSB; |
|
|
1442 |
.................... unsigned int8 LSB; |
|
|
1443 |
.................... signed int16 data; |
|
|
1444 |
.................... |
|
|
1445 |
.................... i2c_start(); |
|
|
1446 |
06B3: BSF 20.4 |
|
|
1447 |
06B4: MOVF 20,W |
|
|
1448 |
06B5: BSF 03.5 |
|
|
1449 |
06B6: MOVWF 07 |
|
|
1450 |
06B7: NOP |
|
|
1451 |
06B8: BCF 03.5 |
|
|
1452 |
06B9: BSF 20.3 |
|
|
1453 |
06BA: MOVF 20,W |
|
|
1454 |
06BB: BSF 03.5 |
|
|
1455 |
06BC: MOVWF 07 |
|
|
1456 |
06BD: NOP |
|
|
1457 |
06BE: BCF 03.5 |
|
|
1458 |
06BF: BCF 07.4 |
|
|
1459 |
06C0: BCF 20.4 |
|
|
1460 |
06C1: MOVF 20,W |
|
|
1461 |
06C2: BSF 03.5 |
|
|
1462 |
06C3: MOVWF 07 |
|
|
1463 |
06C4: NOP |
|
|
1464 |
06C5: BCF 03.5 |
|
|
1465 |
06C6: BCF 07.3 |
|
|
1466 |
06C7: BCF 20.3 |
|
|
1467 |
06C8: MOVF 20,W |
|
|
1468 |
06C9: BSF 03.5 |
|
|
1469 |
06CA: MOVWF 07 |
|
|
1470 |
.................... I2C_Write(LTS01A_address); |
|
|
1471 |
06CB: MOVLW 90 |
|
|
1472 |
06CC: BCF 03.5 |
|
|
1473 |
06CD: MOVWF 34 |
|
|
1474 |
06CE: CALL 202 |
|
|
1475 |
.................... I2C_write(0x00); |
|
|
1476 |
06CF: CLRF 34 |
|
|
1477 |
06D0: CALL 202 |
|
|
1478 |
.................... i2c_stop(); |
|
|
1479 |
06D1: BCF 20.4 |
|
|
1480 |
06D2: MOVF 20,W |
|
|
1481 |
06D3: BSF 03.5 |
|
|
1482 |
06D4: MOVWF 07 |
|
|
1483 |
06D5: NOP |
|
|
1484 |
06D6: BCF 03.5 |
|
|
1485 |
06D7: BSF 20.3 |
|
|
1486 |
06D8: MOVF 20,W |
|
|
1487 |
06D9: BSF 03.5 |
|
|
1488 |
06DA: MOVWF 07 |
|
|
1489 |
06DB: BCF 03.5 |
|
|
1490 |
06DC: BTFSS 07.3 |
|
|
1491 |
06DD: GOTO 6DC |
|
|
1492 |
06DE: NOP |
|
|
1493 |
06DF: GOTO 6E0 |
|
|
1494 |
06E0: NOP |
|
|
1495 |
06E1: BSF 20.4 |
|
|
1496 |
06E2: MOVF 20,W |
|
|
1497 |
06E3: BSF 03.5 |
|
|
1498 |
06E4: MOVWF 07 |
|
|
1499 |
06E5: NOP |
|
|
1500 |
.................... i2c_start(); |
|
|
1501 |
06E6: BCF 03.5 |
|
|
1502 |
06E7: BSF 20.4 |
|
|
1503 |
06E8: MOVF 20,W |
|
|
1504 |
06E9: BSF 03.5 |
|
|
1505 |
06EA: MOVWF 07 |
|
|
1506 |
06EB: NOP |
|
|
1507 |
06EC: BCF 03.5 |
|
|
1508 |
06ED: BSF 20.3 |
|
|
1509 |
06EE: MOVF 20,W |
|
|
1510 |
06EF: BSF 03.5 |
|
|
1511 |
06F0: MOVWF 07 |
|
|
1512 |
06F1: NOP |
|
|
1513 |
06F2: BCF 03.5 |
|
|
1514 |
06F3: BCF 07.4 |
|
|
1515 |
06F4: BCF 20.4 |
|
|
1516 |
06F5: MOVF 20,W |
|
|
1517 |
06F6: BSF 03.5 |
|
|
1518 |
06F7: MOVWF 07 |
|
|
1519 |
06F8: NOP |
|
|
1520 |
06F9: BCF 03.5 |
|
|
1521 |
06FA: BCF 07.3 |
|
|
1522 |
06FB: BCF 20.3 |
|
|
1523 |
06FC: MOVF 20,W |
|
|
1524 |
06FD: BSF 03.5 |
|
|
1525 |
06FE: MOVWF 07 |
|
|
1526 |
.................... I2C_Write(LTS01A_address+1); |
|
|
1527 |
06FF: MOVLW 91 |
|
|
1528 |
0700: BCF 03.5 |
|
|
1529 |
0701: MOVWF 34 |
|
|
1530 |
0702: CALL 202 |
|
|
1531 |
.................... MSB=i2c_read(1); |
|
|
1532 |
0703: MOVLW 01 |
|
|
1533 |
0704: MOVWF 77 |
|
|
1534 |
0705: CALL 24C |
|
|
1535 |
0706: MOVF 78,W |
|
|
1536 |
0707: MOVWF 2F |
|
|
1537 |
.................... LSB=i2c_read(0); |
|
|
1538 |
0708: CLRF 77 |
|
|
1539 |
0709: CALL 24C |
|
|
1540 |
070A: MOVF 78,W |
|
|
1541 |
070B: MOVWF 30 |
|
|
1542 |
.................... i2c_stop(); |
|
|
1543 |
070C: BCF 20.4 |
|
|
1544 |
070D: MOVF 20,W |
|
|
1545 |
070E: BSF 03.5 |
|
|
1546 |
070F: MOVWF 07 |
|
|
1547 |
0710: NOP |
|
|
1548 |
0711: BCF 03.5 |
|
|
1549 |
0712: BSF 20.3 |
|
|
1550 |
0713: MOVF 20,W |
|
|
1551 |
0714: BSF 03.5 |
|
|
1552 |
0715: MOVWF 07 |
|
|
1553 |
0716: BCF 03.5 |
|
|
1554 |
0717: BTFSS 07.3 |
|
|
1555 |
0718: GOTO 717 |
|
|
1556 |
0719: NOP |
|
|
1557 |
071A: GOTO 71B |
|
|
1558 |
071B: NOP |
|
|
1559 |
071C: BSF 20.4 |
|
|
1560 |
071D: MOVF 20,W |
|
|
1561 |
071E: BSF 03.5 |
|
|
1562 |
071F: MOVWF 07 |
|
|
1563 |
0720: NOP |
|
|
1564 |
.................... |
|
|
1565 |
.................... data = MAKE16(MSB,LSB); |
|
|
1566 |
0721: BCF 03.5 |
|
|
1567 |
0722: MOVF 2F,W |
|
|
1568 |
0723: MOVWF 32 |
|
|
1569 |
0724: MOVF 30,W |
|
|
1570 |
0725: MOVWF 31 |
|
|
1571 |
.................... |
|
|
1572 |
.................... return (data * 0.00390625 ); |
|
|
1573 |
0726: MOVF 32,W |
|
|
1574 |
0727: MOVWF 34 |
|
|
1575 |
0728: MOVF 31,W |
|
|
1576 |
0729: MOVWF 33 |
|
|
1577 |
072A: MOVF 34,W |
|
|
1578 |
072B: MOVWF 36 |
|
|
1579 |
072C: MOVF 33,W |
|
|
1580 |
072D: MOVWF 35 |
|
|
1581 |
* |
|
|
1582 |
0752: MOVF 7A,W |
|
|
1583 |
0753: MOVWF 3F |
|
|
1584 |
0754: MOVF 79,W |
|
|
1585 |
0755: MOVWF 3E |
|
|
1586 |
0756: MOVF 78,W |
|
|
1587 |
0757: MOVWF 3D |
|
|
1588 |
0758: MOVF 77,W |
|
|
1589 |
0759: MOVWF 3C |
|
|
1590 |
075A: CLRF 43 |
|
|
1591 |
075B: CLRF 42 |
|
|
1592 |
075C: CLRF 41 |
|
|
1593 |
075D: MOVLW 77 |
|
|
1594 |
075E: MOVWF 40 |
|
|
1595 |
075F: CALL 378 |
|
|
1596 |
.................... |
|
|
1597 |
.................... } |
|
|
1598 |
0760: BSF 0A.3 |
|
|
1599 |
0761: BCF 0A.4 |
|
|
1600 |
0762: GOTO 2FA (RETURN) |
|
|
1601 |
.................... |
|
|
1602 |
.................... |
|
|
1603 |
.................... |
|
|
1604 |
.................... |
|
|
1605 |
.................... void main() |
|
|
1606 |
.................... { |
|
|
1607 |
* |
|
|
1608 |
0A28: CLRF 04 |
|
|
1609 |
0A29: BCF 03.7 |
|
|
1610 |
0A2A: MOVLW 1F |
|
|
1611 |
0A2B: ANDWF 03,F |
|
|
1612 |
0A2C: MOVLW 71 |
|
|
1613 |
0A2D: BSF 03.5 |
|
|
1614 |
0A2E: MOVWF 0F |
|
|
1615 |
0A2F: MOVF 0F,W |
|
|
1616 |
0A30: BSF 03.6 |
|
|
1617 |
0A31: BCF 07.3 |
|
|
1618 |
0A32: MOVLW 0C |
|
|
1619 |
0A33: BCF 03.6 |
|
|
1620 |
0A34: MOVWF 19 |
|
|
1621 |
0A35: MOVLW A2 |
|
|
1622 |
0A36: MOVWF 18 |
|
|
1623 |
0A37: MOVLW 90 |
|
|
1624 |
0A38: BCF 03.5 |
|
|
1625 |
0A39: MOVWF 18 |
|
|
1626 |
0A3A: BSF 03.5 |
|
|
1627 |
0A3B: BSF 03.6 |
|
|
1628 |
0A3C: MOVF 09,W |
|
|
1629 |
0A3D: ANDLW C0 |
|
|
1630 |
0A3E: MOVWF 09 |
|
|
1631 |
0A3F: BCF 03.6 |
|
|
1632 |
0A40: BCF 1F.4 |
|
|
1633 |
0A41: BCF 1F.5 |
|
|
1634 |
0A42: MOVLW 00 |
|
|
1635 |
0A43: BSF 03.6 |
|
|
1636 |
0A44: MOVWF 08 |
|
|
1637 |
0A45: BCF 03.5 |
|
|
1638 |
0A46: CLRF 07 |
|
|
1639 |
0A47: CLRF 08 |
|
|
1640 |
0A48: CLRF 09 |
|
|
1641 |
* |
|
|
1642 |
0A4C: CLRF 2E |
|
|
1643 |
0A4D: CLRF 2D |
|
|
1644 |
.................... float temp1, temp2, humidity; |
|
|
1645 |
.................... int16 i=0; |
|
|
1646 |
.................... |
|
|
1647 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
1648 |
0A4E: BSF 03.5 |
|
|
1649 |
0A4F: BSF 03.6 |
|
|
1650 |
0A50: MOVF 09,W |
|
|
1651 |
0A51: ANDLW C0 |
|
|
1652 |
0A52: MOVWF 09 |
|
|
1653 |
0A53: BCF 03.6 |
|
|
1654 |
0A54: BCF 1F.4 |
|
|
1655 |
0A55: BCF 1F.5 |
|
|
1656 |
0A56: MOVLW 00 |
|
|
1657 |
0A57: BSF 03.6 |
|
|
1658 |
0A58: MOVWF 08 |
|
|
1659 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
|
|
1660 |
0A59: BCF 03.5 |
|
|
1661 |
0A5A: BCF 03.6 |
|
|
1662 |
0A5B: BCF 1F.6 |
|
|
1663 |
0A5C: BCF 1F.7 |
|
|
1664 |
0A5D: BSF 03.5 |
|
|
1665 |
0A5E: BSF 1F.7 |
|
|
1666 |
0A5F: BCF 03.5 |
|
|
1667 |
0A60: BSF 1F.0 |
|
|
1668 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
1669 |
0A61: BCF 14.5 |
|
|
1670 |
0A62: BCF 20.5 |
|
|
1671 |
0A63: MOVF 20,W |
|
|
1672 |
0A64: BSF 03.5 |
|
|
1673 |
0A65: MOVWF 07 |
|
|
1674 |
0A66: BCF 03.5 |
|
|
1675 |
0A67: BSF 20.4 |
|
|
1676 |
0A68: MOVF 20,W |
|
|
1677 |
0A69: BSF 03.5 |
|
|
1678 |
0A6A: MOVWF 07 |
|
|
1679 |
0A6B: BCF 03.5 |
|
|
1680 |
0A6C: BCF 20.3 |
|
|
1681 |
0A6D: MOVF 20,W |
|
|
1682 |
0A6E: BSF 03.5 |
|
|
1683 |
0A6F: MOVWF 07 |
|
|
1684 |
0A70: MOVLW 01 |
|
|
1685 |
0A71: BCF 03.5 |
|
|
1686 |
0A72: MOVWF 14 |
|
|
1687 |
0A73: MOVLW 00 |
|
|
1688 |
0A74: BSF 03.5 |
|
|
1689 |
0A75: MOVWF 14 |
|
|
1690 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
1691 |
0A76: MOVF 01,W |
|
|
1692 |
0A77: ANDLW C7 |
|
|
1693 |
0A78: IORLW 08 |
|
|
1694 |
0A79: MOVWF 01 |
|
|
1695 |
.................... setup_timer_1(T1_DISABLED); |
|
|
1696 |
0A7A: BCF 03.5 |
|
|
1697 |
0A7B: CLRF 10 |
|
|
1698 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
1699 |
0A7C: MOVLW 00 |
|
|
1700 |
0A7D: MOVWF 78 |
|
|
1701 |
0A7E: MOVWF 12 |
|
|
1702 |
0A7F: MOVLW 00 |
|
|
1703 |
0A80: BSF 03.5 |
|
|
1704 |
0A81: MOVWF 12 |
|
|
1705 |
.................... setup_ccp1(CCP_OFF); |
|
|
1706 |
0A82: BCF 03.5 |
|
|
1707 |
0A83: BSF 20.2 |
|
|
1708 |
0A84: MOVF 20,W |
|
|
1709 |
0A85: BSF 03.5 |
|
|
1710 |
0A86: MOVWF 07 |
|
|
1711 |
0A87: BCF 03.5 |
|
|
1712 |
0A88: CLRF 17 |
|
|
1713 |
0A89: BSF 03.5 |
|
|
1714 |
0A8A: CLRF 1B |
|
|
1715 |
0A8B: CLRF 1C |
|
|
1716 |
0A8C: MOVLW 01 |
|
|
1717 |
0A8D: MOVWF 1D |
|
|
1718 |
.................... setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard |
|
|
1719 |
0A8E: BCF 03.5 |
|
|
1720 |
0A8F: BSF 03.6 |
|
|
1721 |
0A90: CLRF 07 |
|
|
1722 |
0A91: CLRF 08 |
|
|
1723 |
0A92: CLRF 09 |
|
|
1724 |
.................... setup_oscillator(OSC_8MHZ); |
|
|
1725 |
0A93: MOVLW 71 |
|
|
1726 |
0A94: BSF 03.5 |
|
|
1727 |
0A95: BCF 03.6 |
|
|
1728 |
0A96: MOVWF 0F |
|
|
1729 |
0A97: MOVF 0F,W |
|
|
1730 |
.................... |
|
|
1731 |
.................... |
|
|
1732 |
.................... printf("GeoMet01A\r\n",); |
|
|
1733 |
0A98: MOVLW 0C |
|
|
1734 |
0A99: BCF 03.5 |
|
|
1735 |
0A9A: BSF 03.6 |
|
|
1736 |
0A9B: MOVWF 0D |
|
|
1737 |
0A9C: MOVLW 00 |
|
|
1738 |
0A9D: MOVWF 0F |
|
|
1739 |
0A9E: BCF 0A.3 |
|
|
1740 |
0A9F: BCF 03.6 |
|
|
1741 |
0AA0: CALL 030 |
|
|
1742 |
0AA1: BSF 0A.3 |
|
|
1743 |
.................... printf("(c) Kaklik 2013\r\n"); |
|
|
1744 |
0AA2: MOVLW 12 |
|
|
1745 |
0AA3: BSF 03.6 |
|
|
1746 |
0AA4: MOVWF 0D |
|
|
1747 |
0AA5: MOVLW 00 |
|
|
1748 |
0AA6: MOVWF 0F |
|
|
1749 |
0AA7: BCF 0A.3 |
|
|
1750 |
0AA8: BCF 03.6 |
|
|
1751 |
0AA9: CALL 030 |
|
|
1752 |
0AAA: BSF 0A.3 |
|
|
1753 |
.................... printf("www.mlab.cz\r\n"); |
|
|
1754 |
0AAB: MOVLW 1B |
|
|
1755 |
0AAC: BSF 03.6 |
|
|
1756 |
0AAD: MOVWF 0D |
|
|
1757 |
0AAE: MOVLW 00 |
|
|
1758 |
0AAF: MOVWF 0F |
|
|
1759 |
0AB0: BCF 0A.3 |
|
|
1760 |
0AB1: BCF 03.6 |
|
|
1761 |
0AB2: CALL 030 |
|
|
1762 |
0AB3: BSF 0A.3 |
|
|
1763 |
.................... |
|
|
1764 |
.................... lcd_init(); |
|
|
1765 |
0AB4: BCF 0A.3 |
|
|
1766 |
0AB5: CALL 145 |
|
|
1767 |
0AB6: BSF 0A.3 |
|
|
1768 |
.................... lcd_putc("(c) Kaklik 2013"); |
|
|
1769 |
0AB7: MOVLW 22 |
|
|
1770 |
0AB8: BSF 03.6 |
|
|
1771 |
0AB9: MOVWF 0D |
|
|
1772 |
0ABA: MOVLW 00 |
|
|
1773 |
0ABB: MOVWF 0F |
|
|
1774 |
0ABC: BCF 0A.3 |
|
|
1775 |
0ABD: BCF 03.6 |
|
|
1776 |
0ABE: CALL 1BC |
|
|
1777 |
0ABF: BSF 0A.3 |
|
|
1778 |
.................... lcd_gotoxy(3,2); |
|
|
1779 |
0AC0: MOVLW 03 |
|
|
1780 |
0AC1: MOVWF 3D |
|
|
1781 |
0AC2: MOVLW 02 |
|
|
1782 |
0AC3: MOVWF 3E |
|
|
1783 |
0AC4: BCF 0A.3 |
|
|
1784 |
0AC5: CALL 17D |
|
|
1785 |
0AC6: BSF 0A.3 |
|
|
1786 |
.................... lcd_putc("www.mlab.cz"); |
|
|
1787 |
0AC7: MOVLW 2A |
|
|
1788 |
0AC8: BSF 03.6 |
|
|
1789 |
0AC9: MOVWF 0D |
|
|
1790 |
0ACA: MOVLW 00 |
|
|
1791 |
0ACB: MOVWF 0F |
|
|
1792 |
0ACC: BCF 0A.3 |
|
|
1793 |
0ACD: BCF 03.6 |
|
|
1794 |
0ACE: CALL 1BC |
|
|
1795 |
0ACF: BSF 0A.3 |
|
|
1796 |
.................... Delay_ms(2000); |
|
|
1797 |
0AD0: MOVLW 08 |
|
|
1798 |
0AD1: MOVWF 2F |
|
|
1799 |
0AD2: MOVLW FA |
|
|
1800 |
0AD3: MOVWF 3D |
|
|
1801 |
0AD4: BCF 0A.3 |
|
|
1802 |
0AD5: CALL 078 |
|
|
1803 |
0AD6: BSF 0A.3 |
|
|
1804 |
0AD7: DECFSZ 2F,F |
|
|
1805 |
0AD8: GOTO 2D2 |
|
|
1806 |
.................... lcd_init(); |
|
|
1807 |
0AD9: BCF 0A.3 |
|
|
1808 |
0ADA: CALL 145 |
|
|
1809 |
0ADB: BSF 0A.3 |
|
|
1810 |
.................... |
|
|
1811 |
.................... while (TRUE) |
|
|
1812 |
.................... { |
|
|
1813 |
.................... lcd_gotoxy(1,1); |
|
|
1814 |
0ADC: MOVLW 01 |
|
|
1815 |
0ADD: MOVWF 3D |
|
|
1816 |
0ADE: MOVWF 3E |
|
|
1817 |
0ADF: BCF 0A.3 |
|
|
1818 |
0AE0: CALL 17D |
|
|
1819 |
0AE1: BSF 0A.3 |
|
|
1820 |
.................... temp1 = SHT25_get_temp(); |
|
|
1821 |
0AE2: BCF 0A.3 |
|
|
1822 |
0AE3: GOTO 52E |
|
|
1823 |
0AE4: BSF 0A.3 |
|
|
1824 |
0AE5: MOVF 7A,W |
|
|
1825 |
0AE6: MOVWF 24 |
|
|
1826 |
0AE7: MOVF 79,W |
|
|
1827 |
0AE8: MOVWF 23 |
|
|
1828 |
0AE9: MOVF 78,W |
|
|
1829 |
0AEA: MOVWF 22 |
|
|
1830 |
0AEB: MOVF 77,W |
|
|
1831 |
0AEC: MOVWF 21 |
|
|
1832 |
.................... humidity = SHT25_get_hum(); |
|
|
1833 |
0AED: BCF 0A.3 |
|
|
1834 |
0AEE: GOTO 5FD |
|
|
1835 |
0AEF: BSF 0A.3 |
|
|
1836 |
0AF0: MOVF 7A,W |
|
|
1837 |
0AF1: MOVWF 2C |
|
|
1838 |
0AF2: MOVF 79,W |
|
|
1839 |
0AF3: MOVWF 2B |
|
|
1840 |
0AF4: MOVF 78,W |
|
|
1841 |
0AF5: MOVWF 2A |
|
|
1842 |
0AF6: MOVF 77,W |
|
|
1843 |
0AF7: MOVWF 29 |
|
|
1844 |
.................... temp2= LTS01_get_temp(); |
|
|
1845 |
0AF8: BCF 0A.3 |
|
|
1846 |
0AF9: GOTO 6B3 |
|
|
1847 |
0AFA: BSF 0A.3 |
|
|
1848 |
0AFB: MOVF 7A,W |
|
|
1849 |
0AFC: MOVWF 28 |
|
|
1850 |
0AFD: MOVF 79,W |
|
|
1851 |
0AFE: MOVWF 27 |
|
|
1852 |
0AFF: MOVF 78,W |
|
|
1853 |
0B00: MOVWF 26 |
|
|
1854 |
0B01: MOVF 77,W |
|
|
1855 |
0B02: MOVWF 25 |
|
|
1856 |
.................... |
|
|
1857 |
.................... printf(lcd_putc,"%f C %f \%% \r\n",temp1, humidity); |
|
|
1858 |
0B03: MOVLW 89 |
|
|
1859 |
0B04: MOVWF 04 |
|
|
1860 |
0B05: MOVF 24,W |
|
|
1861 |
0B06: MOVWF 32 |
|
|
1862 |
0B07: MOVF 23,W |
|
|
1863 |
0B08: MOVWF 31 |
|
|
1864 |
0B09: MOVF 22,W |
|
|
1865 |
0B0A: MOVWF 30 |
|
|
1866 |
0B0B: MOVF 21,W |
|
|
1867 |
0B0C: MOVWF 2F |
|
|
1868 |
0B0D: MOVLW 02 |
|
|
1869 |
0B0E: MOVWF 33 |
|
|
1870 |
0B0F: CALL 000 |
|
|
1871 |
0B10: MOVLW 20 |
|
|
1872 |
0B11: MOVWF 3C |
|
|
1873 |
0B12: BCF 0A.3 |
|
|
1874 |
0B13: CALL 18F |
|
|
1875 |
0B14: BSF 0A.3 |
|
|
1876 |
0B15: MOVLW 43 |
|
|
1877 |
0B16: MOVWF 3C |
|
|
1878 |
0B17: BCF 0A.3 |
|
|
1879 |
0B18: CALL 18F |
|
|
1880 |
0B19: BSF 0A.3 |
|
|
1881 |
0B1A: MOVLW 20 |
|
|
1882 |
0B1B: MOVWF 3C |
|
|
1883 |
0B1C: BCF 0A.3 |
|
|
1884 |
0B1D: CALL 18F |
|
|
1885 |
0B1E: BSF 0A.3 |
|
|
1886 |
0B1F: MOVLW 89 |
|
|
1887 |
0B20: MOVWF 04 |
|
|
1888 |
0B21: MOVF 2C,W |
|
|
1889 |
0B22: MOVWF 32 |
|
|
1890 |
0B23: MOVF 2B,W |
|
|
1891 |
0B24: MOVWF 31 |
|
|
1892 |
0B25: MOVF 2A,W |
|
|
1893 |
0B26: MOVWF 30 |
|
|
1894 |
0B27: MOVF 29,W |
|
|
1895 |
0B28: MOVWF 2F |
|
|
1896 |
0B29: MOVLW 02 |
|
|
1897 |
0B2A: MOVWF 33 |
|
|
1898 |
0B2B: CALL 000 |
|
|
1899 |
0B2C: MOVLW 20 |
|
|
1900 |
0B2D: MOVWF 3C |
|
|
1901 |
0B2E: BCF 0A.3 |
|
|
1902 |
0B2F: CALL 18F |
|
|
1903 |
0B30: BSF 0A.3 |
|
|
1904 |
0B31: MOVLW 25 |
|
|
1905 |
0B32: MOVWF 3C |
|
|
1906 |
0B33: BCF 0A.3 |
|
|
1907 |
0B34: CALL 18F |
|
|
1908 |
0B35: BSF 0A.3 |
|
|
1909 |
0B36: MOVLW 20 |
|
|
1910 |
0B37: MOVWF 3C |
|
|
1911 |
0B38: BCF 0A.3 |
|
|
1912 |
0B39: CALL 18F |
|
|
1913 |
0B3A: BSF 0A.3 |
|
|
1914 |
0B3B: MOVLW 0D |
|
|
1915 |
0B3C: MOVWF 3C |
|
|
1916 |
0B3D: BCF 0A.3 |
|
|
1917 |
0B3E: CALL 18F |
|
|
1918 |
0B3F: BSF 0A.3 |
|
|
1919 |
0B40: MOVLW 0A |
|
|
1920 |
0B41: MOVWF 3C |
|
|
1921 |
0B42: BCF 0A.3 |
|
|
1922 |
0B43: CALL 18F |
|
|
1923 |
0B44: BSF 0A.3 |
|
|
1924 |
.................... lcd_gotoxy(1,2); |
|
|
1925 |
0B45: MOVLW 01 |
|
|
1926 |
0B46: MOVWF 3D |
|
|
1927 |
0B47: MOVLW 02 |
|
|
1928 |
0B48: MOVWF 3E |
|
|
1929 |
0B49: BCF 0A.3 |
|
|
1930 |
0B4A: CALL 17D |
|
|
1931 |
0B4B: BSF 0A.3 |
|
|
1932 |
.................... printf(lcd_putc," %f C",temp2); |
|
|
1933 |
0B4C: MOVLW 20 |
|
|
1934 |
0B4D: MOVWF 3C |
|
|
1935 |
0B4E: BCF 0A.3 |
|
|
1936 |
0B4F: CALL 18F |
|
|
1937 |
0B50: BSF 0A.3 |
|
|
1938 |
0B51: MOVLW 89 |
|
|
1939 |
0B52: MOVWF 04 |
|
|
1940 |
0B53: MOVF 28,W |
|
|
1941 |
0B54: MOVWF 32 |
|
|
1942 |
0B55: MOVF 27,W |
|
|
1943 |
0B56: MOVWF 31 |
|
|
1944 |
0B57: MOVF 26,W |
|
|
1945 |
0B58: MOVWF 30 |
|
|
1946 |
0B59: MOVF 25,W |
|
|
1947 |
0B5A: MOVWF 2F |
|
|
1948 |
0B5B: MOVLW 02 |
|
|
1949 |
0B5C: MOVWF 33 |
|
|
1950 |
0B5D: CALL 000 |
|
|
1951 |
0B5E: MOVLW 20 |
|
|
1952 |
0B5F: MOVWF 3C |
|
|
1953 |
0B60: BCF 0A.3 |
|
|
1954 |
0B61: CALL 18F |
|
|
1955 |
0B62: BSF 0A.3 |
|
|
1956 |
0B63: MOVLW 43 |
|
|
1957 |
0B64: MOVWF 3C |
|
|
1958 |
0B65: BCF 0A.3 |
|
|
1959 |
0B66: CALL 18F |
|
|
1960 |
0B67: BSF 0A.3 |
|
|
1961 |
.................... printf("%ld %f %f %f \r\n",i, temp1, humidity, temp2); |
|
|
1962 |
0B68: MOVLW 10 |
|
|
1963 |
0B69: MOVWF 04 |
|
|
1964 |
0B6A: MOVF 2E,W |
|
|
1965 |
0B6B: MOVWF 30 |
|
|
1966 |
0B6C: MOVF 2D,W |
|
|
1967 |
0B6D: MOVWF 2F |
|
|
1968 |
0B6E: GOTO 0DA |
|
|
1969 |
0B6F: MOVLW 20 |
|
|
1970 |
0B70: BTFSS 0C.4 |
|
|
1971 |
0B71: GOTO 370 |
|
|
1972 |
0B72: MOVWF 19 |
|
|
1973 |
0B73: MOVLW 89 |
|
|
1974 |
0B74: MOVWF 04 |
|
|
1975 |
0B75: MOVF 24,W |
|
|
1976 |
0B76: MOVWF 32 |
|
|
1977 |
0B77: MOVF 23,W |
|
|
1978 |
0B78: MOVWF 31 |
|
|
1979 |
0B79: MOVF 22,W |
|
|
1980 |
0B7A: MOVWF 30 |
|
|
1981 |
0B7B: MOVF 21,W |
|
|
1982 |
0B7C: MOVWF 2F |
|
|
1983 |
0B7D: MOVLW 02 |
|
|
1984 |
0B7E: MOVWF 33 |
|
|
1985 |
0B7F: CALL 152 |
|
|
1986 |
0B80: MOVLW 20 |
|
|
1987 |
0B81: BTFSS 0C.4 |
|
|
1988 |
0B82: GOTO 381 |
|
|
1989 |
0B83: MOVWF 19 |
|
|
1990 |
0B84: MOVLW 89 |
|
|
1991 |
0B85: MOVWF 04 |
|
|
1992 |
0B86: MOVF 2C,W |
|
|
1993 |
0B87: MOVWF 32 |
|
|
1994 |
0B88: MOVF 2B,W |
|
|
1995 |
0B89: MOVWF 31 |
|
|
1996 |
0B8A: MOVF 2A,W |
|
|
1997 |
0B8B: MOVWF 30 |
|
|
1998 |
0B8C: MOVF 29,W |
|
|
1999 |
0B8D: MOVWF 2F |
|
|
2000 |
0B8E: MOVLW 02 |
|
|
2001 |
0B8F: MOVWF 33 |
|
|
2002 |
0B90: CALL 152 |
|
|
2003 |
0B91: MOVLW 20 |
|
|
2004 |
0B92: BTFSS 0C.4 |
|
|
2005 |
0B93: GOTO 392 |
|
|
2006 |
0B94: MOVWF 19 |
|
|
2007 |
0B95: MOVLW 89 |
|
|
2008 |
0B96: MOVWF 04 |
|
|
2009 |
0B97: MOVF 28,W |
|
|
2010 |
0B98: MOVWF 32 |
|
|
2011 |
0B99: MOVF 27,W |
|
|
2012 |
0B9A: MOVWF 31 |
|
|
2013 |
0B9B: MOVF 26,W |
|
|
2014 |
0B9C: MOVWF 30 |
|
|
2015 |
0B9D: MOVF 25,W |
|
|
2016 |
0B9E: MOVWF 2F |
|
|
2017 |
0B9F: MOVLW 02 |
|
|
2018 |
0BA0: MOVWF 33 |
|
|
2019 |
0BA1: CALL 152 |
|
|
2020 |
0BA2: MOVLW 20 |
|
|
2021 |
0BA3: BTFSS 0C.4 |
|
|
2022 |
0BA4: GOTO 3A3 |
|
|
2023 |
0BA5: MOVWF 19 |
|
|
2024 |
0BA6: MOVLW 0D |
|
|
2025 |
0BA7: BTFSS 0C.4 |
|
|
2026 |
0BA8: GOTO 3A7 |
|
|
2027 |
0BA9: MOVWF 19 |
|
|
2028 |
0BAA: MOVLW 0A |
|
|
2029 |
0BAB: BTFSS 0C.4 |
|
|
2030 |
0BAC: GOTO 3AB |
|
|
2031 |
0BAD: MOVWF 19 |
|
|
2032 |
.................... i++; |
|
|
2033 |
0BAE: INCF 2D,F |
|
|
2034 |
0BAF: BTFSC 03.2 |
|
|
2035 |
0BB0: INCF 2E,F |
|
|
2036 |
.................... Delay_ms(100); |
|
|
2037 |
0BB1: MOVLW 64 |
|
|
2038 |
0BB2: MOVWF 3D |
|
|
2039 |
0BB3: BCF 0A.3 |
|
|
2040 |
0BB4: CALL 078 |
|
|
2041 |
0BB5: BSF 0A.3 |
|
|
2042 |
.................... } |
|
|
2043 |
0BB6: GOTO 2DC |
|
|
2044 |
.................... |
|
|
2045 |
.................... } |
|
|
2046 |
0BB7: SLEEP |
|
|
2047 |
|
|
|
2048 |
Configuration Fuses: |
|
|
2049 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
2050 |
Word 2: 3FFF NOWRT BORV40 |