Problem with comparison.
/Modules/Sensors/SHT25V01A/SW/PIC16F887/main.lst |
---|
0,0 → 1,1301 |
CCS PCM C Compiler, Version 4.106, 47914 14-IV-13 13:34 |
Filename: Z:\home\kaklik\MLAB\Modules\Sensors\SHT25V01A\SW\PIC16F887\main.lst |
ROM used: 2319 words (28%) |
Largest free fragment is 2048 |
RAM used: 11 (3%) at main() level |
37 (10%) worst case |
Stack: 2 locations |
* |
0000: MOVLW 08 |
0001: MOVWF 0A |
0002: GOTO 000 |
0003: NOP |
.................... #include "main.h" |
.................... #include <16F887.h> |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
.................... #device PIC16F887 |
.................... #list |
.................... |
.................... #device adc=8 |
.................... |
.................... #FUSES NOWDT //No Watch Dog Timer |
.................... #FUSES INTRC_IO //Internal RC Osc |
.................... #FUSES NOPUT //No Power Up Timer |
.................... #FUSES MCLR //Master Clear pin enabled |
.................... #FUSES NOPROTECT //Code not protected from reading |
.................... #FUSES NOCPD //No EE protection |
.................... #FUSES NOBROWNOUT //No brownout reset |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
.................... #FUSES NODEBUG //No Debug mode for ICD |
.................... #FUSES NOWRT //Program memory not write protected |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
.................... |
.................... #use delay(clock=8000000) |
* |
0123: MOVLW 27 |
0124: MOVWF 04 |
0125: BCF 03.7 |
0126: MOVF 00,W |
0127: BTFSC 03.2 |
0128: GOTO 136 |
0129: MOVLW 02 |
012A: MOVWF 78 |
012B: CLRF 77 |
012C: DECFSZ 77,F |
012D: GOTO 12C |
012E: DECFSZ 78,F |
012F: GOTO 12B |
0130: MOVLW 97 |
0131: MOVWF 77 |
0132: DECFSZ 77,F |
0133: GOTO 132 |
0134: DECFSZ 00,F |
0135: GOTO 129 |
0136: RETURN |
.................... |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
* |
0037: MOVLW 08 |
0038: MOVWF 78 |
0039: NOP |
003A: BCF 07.3 |
003B: BCF 20.3 |
003C: MOVF 20,W |
003D: BSF 03.5 |
003E: MOVWF 07 |
003F: NOP |
0040: BCF 03.5 |
0041: RLF 27,F |
0042: BCF 07.4 |
0043: BTFSS 03.0 |
0044: GOTO 04B |
0045: BSF 20.4 |
0046: MOVF 20,W |
0047: BSF 03.5 |
0048: MOVWF 07 |
0049: GOTO 04F |
004A: BCF 03.5 |
004B: BCF 20.4 |
004C: MOVF 20,W |
004D: BSF 03.5 |
004E: MOVWF 07 |
004F: NOP |
0050: BCF 03.5 |
0051: BSF 20.3 |
0052: MOVF 20,W |
0053: BSF 03.5 |
0054: MOVWF 07 |
0055: BCF 03.5 |
0056: BTFSS 07.3 |
0057: GOTO 056 |
0058: DECFSZ 78,F |
0059: GOTO 039 |
005A: NOP |
005B: BCF 07.3 |
005C: BCF 20.3 |
005D: MOVF 20,W |
005E: BSF 03.5 |
005F: MOVWF 07 |
0060: NOP |
0061: BCF 03.5 |
0062: BSF 20.4 |
0063: MOVF 20,W |
0064: BSF 03.5 |
0065: MOVWF 07 |
0066: NOP |
0067: NOP |
0068: BCF 03.5 |
0069: BSF 20.3 |
006A: MOVF 20,W |
006B: BSF 03.5 |
006C: MOVWF 07 |
006D: BCF 03.5 |
006E: BTFSS 07.3 |
006F: GOTO 06E |
0070: CLRF 78 |
0071: NOP |
0072: BTFSC 07.4 |
0073: BSF 78.0 |
0074: BCF 07.3 |
0075: BCF 20.3 |
0076: MOVF 20,W |
0077: BSF 03.5 |
0078: MOVWF 07 |
0079: BCF 03.5 |
007A: BCF 07.4 |
007B: BCF 20.4 |
007C: MOVF 20,W |
007D: BSF 03.5 |
007E: MOVWF 07 |
007F: BCF 03.5 |
0080: RETURN |
* |
0137: MOVLW 08 |
0138: MOVWF 28 |
0139: MOVF 77,W |
013A: MOVWF 29 |
013B: BSF 20.4 |
013C: MOVF 20,W |
013D: BSF 03.5 |
013E: MOVWF 07 |
013F: NOP |
0140: BCF 03.5 |
0141: BSF 20.3 |
0142: MOVF 20,W |
0143: BSF 03.5 |
0144: MOVWF 07 |
0145: BCF 03.5 |
0146: BTFSS 07.3 |
0147: GOTO 146 |
0148: BTFSC 07.4 |
0149: BSF 03.0 |
014A: BTFSS 07.4 |
014B: BCF 03.0 |
014C: RLF 78,F |
014D: NOP |
014E: BCF 20.3 |
014F: MOVF 20,W |
0150: BSF 03.5 |
0151: MOVWF 07 |
0152: BCF 03.5 |
0153: BCF 07.3 |
0154: DECFSZ 28,F |
0155: GOTO 13B |
0156: BSF 20.4 |
0157: MOVF 20,W |
0158: BSF 03.5 |
0159: MOVWF 07 |
015A: NOP |
015B: BCF 03.5 |
015C: BCF 07.4 |
015D: MOVF 29,W |
015E: BTFSC 03.2 |
015F: GOTO 165 |
0160: BCF 20.4 |
0161: MOVF 20,W |
0162: BSF 03.5 |
0163: MOVWF 07 |
0164: BCF 03.5 |
0165: NOP |
0166: BSF 20.3 |
0167: MOVF 20,W |
0168: BSF 03.5 |
0169: MOVWF 07 |
016A: BCF 03.5 |
016B: BTFSS 07.3 |
016C: GOTO 16B |
016D: NOP |
016E: BCF 07.3 |
016F: BCF 20.3 |
0170: MOVF 20,W |
0171: BSF 03.5 |
0172: MOVWF 07 |
0173: NOP |
0174: BCF 03.5 |
0175: BCF 07.4 |
0176: BCF 20.4 |
0177: MOVF 20,W |
0178: BSF 03.5 |
0179: MOVWF 07 |
017A: BCF 03.5 |
017B: RETURN |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8) //rcv TXD xmit RXD |
* |
00B9: BSF 03.5 |
00BA: BCF 06.7 |
00BB: BCF 03.5 |
00BC: BCF 06.7 |
00BD: MOVLW 08 |
00BE: MOVWF 78 |
00BF: GOTO 0C0 |
00C0: NOP |
00C1: BSF 78.7 |
00C2: GOTO 0D1 |
00C3: BCF 78.7 |
00C4: RRF 33,F |
00C5: BTFSC 03.0 |
00C6: BSF 06.7 |
00C7: BTFSS 03.0 |
00C8: BCF 06.7 |
00C9: BSF 78.6 |
00CA: GOTO 0D1 |
00CB: BCF 78.6 |
00CC: DECFSZ 78,F |
00CD: GOTO 0C4 |
00CE: GOTO 0CF |
00CF: NOP |
00D0: BSF 06.7 |
00D1: MOVLW 3F |
00D2: MOVWF 04 |
00D3: DECFSZ 04,F |
00D4: GOTO 0D3 |
00D5: NOP |
00D6: BTFSC 78.7 |
00D7: GOTO 0C3 |
00D8: BTFSC 78.6 |
00D9: GOTO 0CB |
00DA: RETURN |
.................... |
.................... |
.................... |
.................... void SHT25_soft_reset() |
.................... { |
.................... i2c_start(); // Start condition |
* |
0081: BSF 20.4 |
0082: MOVF 20,W |
0083: BSF 03.5 |
0084: MOVWF 07 |
0085: NOP |
0086: BCF 03.5 |
0087: BSF 20.3 |
0088: MOVF 20,W |
0089: BSF 03.5 |
008A: MOVWF 07 |
008B: NOP |
008C: BCF 03.5 |
008D: BCF 07.4 |
008E: BCF 20.4 |
008F: MOVF 20,W |
0090: BSF 03.5 |
0091: MOVWF 07 |
0092: NOP |
0093: BCF 03.5 |
0094: BCF 07.3 |
0095: BCF 20.3 |
0096: MOVF 20,W |
0097: BSF 03.5 |
0098: MOVWF 07 |
.................... i2c_write(0x80); // Device address |
0099: MOVLW 80 |
009A: BCF 03.5 |
009B: MOVWF 27 |
009C: CALL 037 |
.................... i2c_write(0xFE); // Device command |
009D: MOVLW FE |
009E: MOVWF 27 |
009F: CALL 037 |
.................... i2c_stop(); // Stop condition |
00A0: BCF 20.4 |
00A1: MOVF 20,W |
00A2: BSF 03.5 |
00A3: MOVWF 07 |
00A4: NOP |
00A5: BCF 03.5 |
00A6: BSF 20.3 |
00A7: MOVF 20,W |
00A8: BSF 03.5 |
00A9: MOVWF 07 |
00AA: BCF 03.5 |
00AB: BTFSS 07.3 |
00AC: GOTO 0AB |
00AD: NOP |
00AE: GOTO 0AF |
00AF: NOP |
00B0: BSF 20.4 |
00B1: MOVF 20,W |
00B2: BSF 03.5 |
00B3: MOVWF 07 |
00B4: NOP |
.................... } |
00B5: BCF 03.5 |
00B6: BSF 0A.3 |
00B7: BCF 0A.4 |
00B8: GOTO 066 (RETURN) |
.................... |
.................... #define SHT25_HEATER_ON 0x04 |
.................... #define SHT25_HEATER_OFF 0x00 |
.................... #define SHT25_OTP_reload_off 0x02 |
.................... #define SHT25_RH12_T14 0x00 |
.................... #define SHT25_RH8_T12 0x01 |
.................... #define SHT25_RH10_T13 0x80 |
.................... #define SHT25_RH11_T11 0x81 |
.................... |
.................... #define SHT25_ADDR 0x80 |
.................... |
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value |
.................... { |
.................... unsigned int8 reg; |
.................... |
.................... i2c_start(); // Start condition |
* |
017C: BSF 20.4 |
017D: MOVF 20,W |
017E: BSF 03.5 |
017F: MOVWF 07 |
0180: NOP |
0181: BCF 03.5 |
0182: BSF 20.3 |
0183: MOVF 20,W |
0184: BSF 03.5 |
0185: MOVWF 07 |
0186: NOP |
0187: BCF 03.5 |
0188: BCF 07.4 |
0189: BCF 20.4 |
018A: MOVF 20,W |
018B: BSF 03.5 |
018C: MOVWF 07 |
018D: NOP |
018E: BCF 03.5 |
018F: BCF 07.3 |
0190: BCF 20.3 |
0191: MOVF 20,W |
0192: BSF 03.5 |
0193: MOVWF 07 |
.................... i2c_write(SHT25_ADDR); // Device address |
0194: MOVLW 80 |
0195: BCF 03.5 |
0196: MOVWF 27 |
0197: CALL 037 |
.................... i2c_write(0xE7); // Device command |
0198: MOVLW E7 |
0199: MOVWF 27 |
019A: CALL 037 |
.................... |
.................... i2c_start(); // Start condition |
019B: BSF 20.4 |
019C: MOVF 20,W |
019D: BSF 03.5 |
019E: MOVWF 07 |
019F: NOP |
01A0: BCF 03.5 |
01A1: BSF 20.3 |
01A2: MOVF 20,W |
01A3: BSF 03.5 |
01A4: MOVWF 07 |
01A5: NOP |
01A6: BCF 03.5 |
01A7: BTFSS 07.3 |
01A8: GOTO 1A7 |
01A9: BCF 07.4 |
01AA: BCF 20.4 |
01AB: MOVF 20,W |
01AC: BSF 03.5 |
01AD: MOVWF 07 |
01AE: NOP |
01AF: BCF 03.5 |
01B0: BCF 07.3 |
01B1: BCF 20.3 |
01B2: MOVF 20,W |
01B3: BSF 03.5 |
01B4: MOVWF 07 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
01B5: MOVLW 81 |
01B6: BCF 03.5 |
01B7: MOVWF 27 |
01B8: CALL 037 |
.................... reg=i2c_read(0); // Read status actual status register |
01B9: CLRF 77 |
01BA: CALL 137 |
01BB: MOVF 78,W |
01BC: MOVWF 23 |
.................... |
.................... reg = (reg & 0x3A) | setup_reg; |
01BD: MOVF 23,W |
01BE: ANDLW 3A |
01BF: IORWF 22,W |
01C0: MOVWF 23 |
.................... |
.................... i2c_start(); // Start condition |
01C1: BSF 20.4 |
01C2: MOVF 20,W |
01C3: BSF 03.5 |
01C4: MOVWF 07 |
01C5: NOP |
01C6: BCF 03.5 |
01C7: BSF 20.3 |
01C8: MOVF 20,W |
01C9: BSF 03.5 |
01CA: MOVWF 07 |
01CB: NOP |
01CC: BCF 03.5 |
01CD: BTFSS 07.3 |
01CE: GOTO 1CD |
01CF: BCF 07.4 |
01D0: BCF 20.4 |
01D1: MOVF 20,W |
01D2: BSF 03.5 |
01D3: MOVWF 07 |
01D4: NOP |
01D5: BCF 03.5 |
01D6: BCF 07.3 |
01D7: BCF 20.3 |
01D8: MOVF 20,W |
01D9: BSF 03.5 |
01DA: MOVWF 07 |
.................... i2c_write(SHT25_ADDR); // Device address |
01DB: MOVLW 80 |
01DC: BCF 03.5 |
01DD: MOVWF 27 |
01DE: CALL 037 |
.................... i2c_write(0xE7); // Write to status register |
01DF: MOVLW E7 |
01E0: MOVWF 27 |
01E1: CALL 037 |
.................... i2c_write(reg); // Device command |
01E2: MOVF 23,W |
01E3: MOVWF 27 |
01E4: CALL 037 |
.................... i2c_stop(); // Stop condition |
01E5: BCF 20.4 |
01E6: MOVF 20,W |
01E7: BSF 03.5 |
01E8: MOVWF 07 |
01E9: NOP |
01EA: BCF 03.5 |
01EB: BSF 20.3 |
01EC: MOVF 20,W |
01ED: BSF 03.5 |
01EE: MOVWF 07 |
01EF: BCF 03.5 |
01F0: BTFSS 07.3 |
01F1: GOTO 1F0 |
01F2: NOP |
01F3: GOTO 1F4 |
01F4: NOP |
01F5: BSF 20.4 |
01F6: MOVF 20,W |
01F7: BSF 03.5 |
01F8: MOVWF 07 |
01F9: NOP |
.................... |
.................... return (reg); |
01FA: BCF 03.5 |
01FB: MOVF 23,W |
01FC: MOVWF 78 |
.................... } |
01FD: RETURN |
.................... |
.................... |
.................... float SHT25_get_temp() |
.................... { |
.................... unsigned int8 MSB, LSB, Check; |
.................... unsigned int16 data; |
.................... |
.................... i2c_start(); |
* |
050B: BSF 20.4 |
050C: MOVF 20,W |
050D: BSF 03.5 |
050E: MOVWF 07 |
050F: NOP |
0510: BCF 03.5 |
0511: BSF 20.3 |
0512: MOVF 20,W |
0513: BSF 03.5 |
0514: MOVWF 07 |
0515: NOP |
0516: BCF 03.5 |
0517: BCF 07.4 |
0518: BCF 20.4 |
0519: MOVF 20,W |
051A: BSF 03.5 |
051B: MOVWF 07 |
051C: NOP |
051D: BCF 03.5 |
051E: BCF 07.3 |
051F: BCF 20.3 |
0520: MOVF 20,W |
0521: BSF 03.5 |
0522: MOVWF 07 |
.................... I2C_Write(SHT25_ADDR); |
0523: MOVLW 80 |
0524: BCF 03.5 |
0525: MOVWF 27 |
0526: CALL 037 |
.................... I2C_write(0xE3); |
0527: MOVLW E3 |
0528: MOVWF 27 |
0529: CALL 037 |
.................... i2c_stop(); |
052A: BCF 20.4 |
052B: MOVF 20,W |
052C: BSF 03.5 |
052D: MOVWF 07 |
052E: NOP |
052F: BCF 03.5 |
0530: BSF 20.3 |
0531: MOVF 20,W |
0532: BSF 03.5 |
0533: MOVWF 07 |
0534: BCF 03.5 |
0535: BTFSS 07.3 |
0536: GOTO 535 |
0537: NOP |
0538: GOTO 539 |
0539: NOP |
053A: BSF 20.4 |
053B: MOVF 20,W |
053C: BSF 03.5 |
053D: MOVWF 07 |
053E: NOP |
.................... |
.................... delay_ms(100); |
053F: MOVLW 64 |
0540: BCF 03.5 |
0541: MOVWF 27 |
0542: CALL 123 |
.................... |
.................... i2c_start(); |
0543: BSF 20.4 |
0544: MOVF 20,W |
0545: BSF 03.5 |
0546: MOVWF 07 |
0547: NOP |
0548: BCF 03.5 |
0549: BSF 20.3 |
054A: MOVF 20,W |
054B: BSF 03.5 |
054C: MOVWF 07 |
054D: NOP |
054E: BCF 03.5 |
054F: BCF 07.4 |
0550: BCF 20.4 |
0551: MOVF 20,W |
0552: BSF 03.5 |
0553: MOVWF 07 |
0554: NOP |
0555: BCF 03.5 |
0556: BCF 07.3 |
0557: BCF 20.3 |
0558: MOVF 20,W |
0559: BSF 03.5 |
055A: MOVWF 07 |
.................... I2C_Write(SHT25_ADDR+1); |
055B: MOVLW 81 |
055C: BCF 03.5 |
055D: MOVWF 27 |
055E: CALL 037 |
.................... MSB=i2c_read(1); |
055F: MOVLW 01 |
0560: MOVWF 77 |
0561: CALL 137 |
0562: MOVF 78,W |
0563: MOVWF 22 |
.................... LSB=i2c_read(1); |
0564: MOVLW 01 |
0565: MOVWF 77 |
0566: CALL 137 |
0567: MOVF 78,W |
0568: MOVWF 23 |
.................... Check=i2c_read(0); |
0569: CLRF 77 |
056A: CALL 137 |
056B: MOVF 78,W |
056C: MOVWF 24 |
.................... i2c_stop(); |
056D: BCF 20.4 |
056E: MOVF 20,W |
056F: BSF 03.5 |
0570: MOVWF 07 |
0571: NOP |
0572: BCF 03.5 |
0573: BSF 20.3 |
0574: MOVF 20,W |
0575: BSF 03.5 |
0576: MOVWF 07 |
0577: BCF 03.5 |
0578: BTFSS 07.3 |
0579: GOTO 578 |
057A: NOP |
057B: GOTO 57C |
057C: NOP |
057D: BSF 20.4 |
057E: MOVF 20,W |
057F: BSF 03.5 |
0580: MOVWF 07 |
0581: NOP |
.................... |
.................... LSB = LSB >> 2; // trow out status bits |
0582: BCF 03.5 |
0583: RRF 23,F |
0584: RRF 23,F |
0585: MOVLW 3F |
0586: ANDWF 23,F |
.................... |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
0587: CLRF 28 |
0588: MOVF 22,W |
0589: MOVWF 27 |
058A: MOVWF 28 |
058B: CLRF 27 |
058C: SWAPF 23,W |
058D: MOVWF 77 |
058E: MOVLW F0 |
058F: ANDWF 77,F |
0590: MOVF 77,W |
0591: ADDWF 27,W |
0592: MOVWF 25 |
0593: MOVF 28,W |
0594: MOVWF 26 |
0595: BTFSC 03.0 |
0596: INCF 26,F |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
0597: MOVF 26,W |
0598: MOVWF 28 |
0599: MOVF 25,W |
059A: MOVWF 27 |
059B: CALL 26E |
059C: MOVF 77,W |
059D: MOVWF 27 |
059E: MOVF 78,W |
059F: MOVWF 28 |
05A0: MOVF 79,W |
05A1: MOVWF 29 |
05A2: MOVF 7A,W |
05A3: MOVWF 2A |
05A4: MOVWF 2E |
05A5: MOVF 79,W |
05A6: MOVWF 2D |
05A7: MOVF 78,W |
05A8: MOVWF 2C |
05A9: MOVF 77,W |
05AA: MOVWF 2B |
05AB: CLRF 32 |
05AC: MOVLW FF |
05AD: MOVWF 31 |
05AE: MOVLW 7F |
05AF: MOVWF 30 |
05B0: MOVLW 8E |
05B1: MOVWF 2F |
05B2: CALL 28B |
05B3: MOVLW 52 |
05B4: MOVWF 36 |
05B5: MOVLW B8 |
05B6: MOVWF 35 |
05B7: MOVLW 2F |
05B8: MOVWF 34 |
05B9: MOVLW 86 |
05BA: MOVWF 33 |
05BB: MOVF 7A,W |
05BC: MOVWF 3A |
05BD: MOVF 79,W |
05BE: MOVWF 39 |
05BF: MOVF 78,W |
05C0: MOVWF 38 |
05C1: MOVF 77,W |
05C2: MOVWF 37 |
05C3: CALL 355 |
05C4: BCF 03.1 |
05C5: MOVLW 66 |
05C6: MOVWF 2A |
05C7: MOVWF 29 |
05C8: MOVLW BB |
05C9: MOVWF 28 |
05CA: MOVLW 84 |
05CB: MOVWF 27 |
05CC: MOVF 7A,W |
05CD: MOVWF 2E |
05CE: MOVF 79,W |
05CF: MOVWF 2D |
05D0: MOVF 78,W |
05D1: MOVWF 2C |
05D2: MOVF 77,W |
05D3: MOVWF 2B |
05D4: CALL 3CA |
.................... } |
05D5: BSF 0A.3 |
05D6: BCF 0A.4 |
05D7: GOTO 0DB (RETURN) |
.................... |
.................... float SHT25_get_hum() |
.................... { |
.................... unsigned int8 MSB, LSB, Check; |
.................... unsigned int16 data; |
.................... |
.................... i2c_start(); //RH |
* |
0701: BSF 20.4 |
0702: MOVF 20,W |
0703: BSF 03.5 |
0704: MOVWF 07 |
0705: NOP |
0706: BCF 03.5 |
0707: BSF 20.3 |
0708: MOVF 20,W |
0709: BSF 03.5 |
070A: MOVWF 07 |
070B: NOP |
070C: BCF 03.5 |
070D: BCF 07.4 |
070E: BCF 20.4 |
070F: MOVF 20,W |
0710: BSF 03.5 |
0711: MOVWF 07 |
0712: NOP |
0713: BCF 03.5 |
0714: BCF 07.3 |
0715: BCF 20.3 |
0716: MOVF 20,W |
0717: BSF 03.5 |
0718: MOVWF 07 |
.................... I2C_Write(SHT25_ADDR); |
0719: MOVLW 80 |
071A: BCF 03.5 |
071B: MOVWF 27 |
071C: CALL 037 |
.................... I2C_write(0xE5); |
071D: MOVLW E5 |
071E: MOVWF 27 |
071F: CALL 037 |
.................... // i2c_stop(); |
.................... |
.................... delay_ms(100); |
0720: MOVLW 64 |
0721: MOVWF 27 |
0722: CALL 123 |
.................... |
.................... i2c_start(); |
0723: BSF 20.4 |
0724: MOVF 20,W |
0725: BSF 03.5 |
0726: MOVWF 07 |
0727: NOP |
0728: BCF 03.5 |
0729: BSF 20.3 |
072A: MOVF 20,W |
072B: BSF 03.5 |
072C: MOVWF 07 |
072D: NOP |
072E: BCF 03.5 |
072F: BTFSS 07.3 |
0730: GOTO 72F |
0731: BCF 07.4 |
0732: BCF 20.4 |
0733: MOVF 20,W |
0734: BSF 03.5 |
0735: MOVWF 07 |
0736: NOP |
0737: BCF 03.5 |
0738: BCF 07.3 |
0739: BCF 20.3 |
073A: MOVF 20,W |
073B: BSF 03.5 |
073C: MOVWF 07 |
.................... I2C_Write(SHT25_ADDR+1); |
073D: MOVLW 81 |
073E: BCF 03.5 |
073F: MOVWF 27 |
0740: CALL 037 |
.................... MSB=i2c_read(1); |
0741: MOVLW 01 |
0742: MOVWF 77 |
0743: CALL 137 |
0744: MOVF 78,W |
0745: MOVWF 22 |
.................... LSB=i2c_read(1); |
0746: MOVLW 01 |
0747: MOVWF 77 |
0748: CALL 137 |
0749: MOVF 78,W |
074A: MOVWF 23 |
.................... Check=i2c_read(0); |
074B: CLRF 77 |
074C: CALL 137 |
074D: MOVF 78,W |
074E: MOVWF 24 |
.................... i2c_stop(); |
074F: BCF 20.4 |
0750: MOVF 20,W |
0751: BSF 03.5 |
0752: MOVWF 07 |
0753: NOP |
0754: BCF 03.5 |
0755: BSF 20.3 |
0756: MOVF 20,W |
0757: BSF 03.5 |
0758: MOVWF 07 |
0759: BCF 03.5 |
075A: BTFSS 07.3 |
075B: GOTO 75A |
075C: NOP |
075D: GOTO 75E |
075E: NOP |
075F: BSF 20.4 |
0760: MOVF 20,W |
0761: BSF 03.5 |
0762: MOVWF 07 |
0763: NOP |
.................... |
.................... // printf("%X %X %X\r\n",MSB, LSB, Check); |
.................... |
.................... LSB = LSB >> 2; // trow out status bits |
0764: BCF 03.5 |
0765: RRF 23,F |
0766: RRF 23,F |
0767: MOVLW 3F |
0768: ANDWF 23,F |
.................... |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
0769: CLRF 28 |
076A: MOVF 22,W |
076B: MOVWF 27 |
076C: MOVWF 28 |
076D: CLRF 27 |
076E: SWAPF 23,W |
076F: MOVWF 77 |
0770: MOVLW F0 |
0771: ANDWF 77,F |
0772: MOVF 77,W |
0773: ADDWF 27,W |
0774: MOVWF 25 |
0775: MOVF 28,W |
0776: MOVWF 26 |
0777: BTFSC 03.0 |
0778: INCF 26,F |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
0779: MOVF 26,W |
077A: MOVWF 28 |
077B: MOVF 25,W |
077C: MOVWF 27 |
077D: CALL 26E |
077E: MOVF 77,W |
077F: MOVWF 27 |
0780: MOVF 78,W |
0781: MOVWF 28 |
0782: MOVF 79,W |
0783: MOVWF 29 |
0784: MOVF 7A,W |
0785: MOVWF 2A |
0786: MOVWF 2E |
0787: MOVF 79,W |
0788: MOVWF 2D |
0789: MOVF 78,W |
078A: MOVWF 2C |
078B: MOVF 77,W |
078C: MOVWF 2B |
078D: CLRF 32 |
078E: MOVLW FF |
078F: MOVWF 31 |
0790: MOVLW 7F |
0791: MOVWF 30 |
0792: MOVLW 8E |
0793: MOVWF 2F |
0794: CALL 28B |
0795: CLRF 36 |
0796: CLRF 35 |
0797: MOVLW 7A |
0798: MOVWF 34 |
0799: MOVLW 85 |
079A: MOVWF 33 |
079B: MOVF 7A,W |
079C: MOVWF 3A |
079D: MOVF 79,W |
079E: MOVWF 39 |
079F: MOVF 78,W |
07A0: MOVWF 38 |
07A1: MOVF 77,W |
07A2: MOVWF 37 |
07A3: CALL 355 |
07A4: BCF 03.1 |
07A5: CLRF 2A |
07A6: CLRF 29 |
07A7: MOVLW C0 |
07A8: MOVWF 28 |
07A9: MOVLW 81 |
07AA: MOVWF 27 |
07AB: MOVF 7A,W |
07AC: MOVWF 2E |
07AD: MOVF 79,W |
07AE: MOVWF 2D |
07AF: MOVF 78,W |
07B0: MOVWF 2C |
07B1: MOVF 77,W |
07B2: MOVWF 2B |
07B3: CALL 3CA |
.................... } |
07B4: BSF 0A.3 |
07B5: BCF 0A.4 |
07B6: GOTO 119 (RETURN) |
.................... |
.................... |
.................... void main() |
.................... { |
* |
0036: DATA 00,00 |
* |
0800: CLRF 04 |
0801: BCF 03.7 |
0802: MOVLW 1F |
0803: ANDWF 03,F |
0804: MOVLW 71 |
0805: BSF 03.5 |
0806: MOVWF 0F |
0807: MOVF 0F,W |
0808: BCF 06.7 |
0809: BCF 03.5 |
080A: BSF 06.7 |
080B: BSF 03.5 |
080C: BSF 03.6 |
080D: MOVF 09,W |
080E: ANDLW C0 |
080F: MOVWF 09 |
0810: BCF 03.6 |
0811: BCF 1F.4 |
0812: BCF 1F.5 |
0813: MOVLW 00 |
0814: BSF 03.6 |
0815: MOVWF 08 |
0816: BCF 03.5 |
0817: CLRF 07 |
0818: CLRF 08 |
0819: CLRF 09 |
* |
081D: CLRF 21 |
.................... unsigned int8 i=0; |
.................... |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
081E: BSF 03.5 |
081F: BSF 03.6 |
0820: MOVF 09,W |
0821: ANDLW C0 |
0822: MOVWF 09 |
0823: BCF 03.6 |
0824: BCF 1F.4 |
0825: BCF 1F.5 |
0826: MOVLW 00 |
0827: BSF 03.6 |
0828: MOVWF 08 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
0829: BCF 03.5 |
082A: BCF 03.6 |
082B: BCF 1F.6 |
082C: BCF 1F.7 |
082D: BSF 03.5 |
082E: BCF 1F.7 |
082F: BCF 03.5 |
0830: BSF 1F.0 |
.................... setup_spi(SPI_SS_DISABLED); |
0831: BCF 14.5 |
0832: BCF 20.5 |
0833: MOVF 20,W |
0834: BSF 03.5 |
0835: MOVWF 07 |
0836: BCF 03.5 |
0837: BSF 20.4 |
0838: MOVF 20,W |
0839: BSF 03.5 |
083A: MOVWF 07 |
083B: BCF 03.5 |
083C: BCF 20.3 |
083D: MOVF 20,W |
083E: BSF 03.5 |
083F: MOVWF 07 |
0840: MOVLW 01 |
0841: BCF 03.5 |
0842: MOVWF 14 |
0843: MOVLW 00 |
0844: BSF 03.5 |
0845: MOVWF 14 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
0846: MOVF 01,W |
0847: ANDLW C7 |
0848: IORLW 08 |
0849: MOVWF 01 |
.................... setup_timer_1(T1_DISABLED); |
084A: BCF 03.5 |
084B: CLRF 10 |
.................... setup_timer_2(T2_DISABLED,0,1); |
084C: MOVLW 00 |
084D: MOVWF 78 |
084E: MOVWF 12 |
084F: MOVLW 00 |
0850: BSF 03.5 |
0851: MOVWF 12 |
.................... setup_ccp1(CCP_OFF); |
0852: BCF 03.5 |
0853: BSF 20.2 |
0854: MOVF 20,W |
0855: BSF 03.5 |
0856: MOVWF 07 |
0857: BCF 03.5 |
0858: CLRF 17 |
0859: BSF 03.5 |
085A: CLRF 1B |
085B: CLRF 1C |
085C: MOVLW 01 |
085D: MOVWF 1D |
.................... setup_comparator(NC_NC_NC_NC); |
085E: BCF 03.5 |
085F: BSF 03.6 |
0860: CLRF 07 |
0861: CLRF 08 |
0862: CLRF 09 |
.................... |
.................... SHT25_soft_reset(); |
0863: BCF 0A.3 |
0864: BCF 03.6 |
0865: GOTO 081 |
0866: BSF 0A.3 |
.................... printf("SHT25 humidity and temperature sensor example \r\n",); |
0867: MOVLW 04 |
0868: BSF 03.6 |
0869: MOVWF 0D |
086A: MOVLW 00 |
086B: MOVWF 0F |
086C: BCF 0A.3 |
086D: BCF 03.6 |
086E: GOTO 0DB |
086F: BSF 0A.3 |
.................... delay_ms (500); |
0870: MOVLW 02 |
0871: MOVWF 22 |
0872: MOVLW FA |
0873: MOVWF 27 |
0874: BCF 0A.3 |
0875: CALL 123 |
0876: BSF 0A.3 |
0877: DECFSZ 22,F |
0878: GOTO 072 |
.................... |
.................... while(TRUE) |
.................... { |
.................... if (i<10) |
0879: MOVF 21,W |
087A: SUBLW 09 |
087B: BTFSS 03.0 |
087C: GOTO 0A6 |
.................... printf("setup: %X \r\n",SHT25_setup(SHT25_RH12_T14 | SHT25_HEATER_OFF)); |
087D: CLRF 22 |
087E: BCF 0A.3 |
087F: CALL 17C |
0880: BSF 0A.3 |
0881: MOVF 78,W |
0882: MOVWF 22 |
0883: MOVLW 1D |
0884: BSF 03.6 |
0885: MOVWF 0D |
0886: MOVLW 00 |
0887: MOVWF 0F |
0888: BCF 03.0 |
0889: MOVLW 07 |
088A: BCF 03.6 |
088B: MOVWF 26 |
088C: BCF 0A.3 |
088D: CALL 1FE |
088E: BSF 0A.3 |
088F: MOVF 22,W |
0890: MOVWF 23 |
0891: MOVLW 37 |
0892: MOVWF 24 |
0893: BCF 0A.3 |
0894: CALL 24D |
0895: BSF 0A.3 |
0896: MOVLW 20 |
0897: MOVWF 33 |
0898: BCF 0A.3 |
0899: CALL 0B9 |
089A: BSF 0A.3 |
089B: MOVLW 0D |
089C: MOVWF 33 |
089D: BCF 0A.3 |
089E: CALL 0B9 |
089F: BSF 0A.3 |
08A0: MOVLW 0A |
08A1: MOVWF 33 |
08A2: BCF 0A.3 |
08A3: CALL 0B9 |
08A4: BSF 0A.3 |
.................... else |
08A5: GOTO 0D0 |
.................... { |
.................... printf("setup: %X \r\n",SHT25_setup(SHT25_RH12_T14 | SHT25_HEATER_ON)); |
08A6: MOVLW 04 |
08A7: MOVWF 22 |
08A8: BCF 0A.3 |
08A9: CALL 17C |
08AA: BSF 0A.3 |
08AB: MOVF 78,W |
08AC: MOVWF 22 |
08AD: MOVLW 24 |
08AE: BSF 03.6 |
08AF: MOVWF 0D |
08B0: MOVLW 00 |
08B1: MOVWF 0F |
08B2: BCF 03.0 |
08B3: MOVLW 07 |
08B4: BCF 03.6 |
08B5: MOVWF 26 |
08B6: BCF 0A.3 |
08B7: CALL 1FE |
08B8: BSF 0A.3 |
08B9: MOVF 22,W |
08BA: MOVWF 23 |
08BB: MOVLW 37 |
08BC: MOVWF 24 |
08BD: BCF 0A.3 |
08BE: CALL 24D |
08BF: BSF 0A.3 |
08C0: MOVLW 20 |
08C1: MOVWF 33 |
08C2: BCF 0A.3 |
08C3: CALL 0B9 |
08C4: BSF 0A.3 |
08C5: MOVLW 0D |
08C6: MOVWF 33 |
08C7: BCF 0A.3 |
08C8: CALL 0B9 |
08C9: BSF 0A.3 |
08CA: MOVLW 0A |
08CB: MOVWF 33 |
08CC: BCF 0A.3 |
08CD: CALL 0B9 |
08CE: BSF 0A.3 |
.................... i = 0; |
08CF: CLRF 21 |
.................... } |
.................... delay_ms (500); |
08D0: MOVLW 02 |
08D1: MOVWF 22 |
08D2: MOVLW FA |
08D3: MOVWF 27 |
08D4: BCF 0A.3 |
08D5: CALL 123 |
08D6: BSF 0A.3 |
08D7: DECFSZ 22,F |
08D8: GOTO 0D2 |
.................... printf("Temp: %f \r\n",SHT25_get_temp()); |
08D9: BCF 0A.3 |
08DA: GOTO 50B |
08DB: BSF 0A.3 |
08DC: MOVF 77,W |
08DD: MOVWF 22 |
08DE: MOVF 78,W |
08DF: MOVWF 23 |
08E0: MOVF 79,W |
08E1: MOVWF 24 |
08E2: MOVF 7A,W |
08E3: MOVWF 25 |
08E4: MOVLW 2B |
08E5: BSF 03.6 |
08E6: MOVWF 0D |
08E7: MOVLW 00 |
08E8: MOVWF 0F |
08E9: BCF 03.0 |
08EA: MOVLW 06 |
08EB: BCF 03.6 |
08EC: MOVWF 26 |
08ED: BCF 0A.3 |
08EE: CALL 1FE |
08EF: BSF 0A.3 |
08F0: MOVLW 89 |
08F1: MOVWF 04 |
08F2: MOVF 25,W |
08F3: MOVWF 29 |
08F4: MOVF 24,W |
08F5: MOVWF 28 |
08F6: MOVF 23,W |
08F7: MOVWF 27 |
08F8: MOVF 22,W |
08F9: MOVWF 26 |
08FA: MOVLW 02 |
08FB: MOVWF 2A |
08FC: BCF 0A.3 |
08FD: CALL 61A |
08FE: BSF 0A.3 |
08FF: MOVLW 20 |
0900: MOVWF 33 |
0901: BCF 0A.3 |
0902: CALL 0B9 |
0903: BSF 0A.3 |
0904: MOVLW 0D |
0905: MOVWF 33 |
0906: BCF 0A.3 |
0907: CALL 0B9 |
0908: BSF 0A.3 |
0909: MOVLW 0A |
090A: MOVWF 33 |
090B: BCF 0A.3 |
090C: CALL 0B9 |
090D: BSF 0A.3 |
.................... delay_ms (500); |
090E: MOVLW 02 |
090F: MOVWF 22 |
0910: MOVLW FA |
0911: MOVWF 27 |
0912: BCF 0A.3 |
0913: CALL 123 |
0914: BSF 0A.3 |
0915: DECFSZ 22,F |
0916: GOTO 110 |
.................... printf("Hum: %f \r\n",SHT25_get_hum()); |
0917: BCF 0A.3 |
0918: GOTO 701 |
0919: BSF 0A.3 |
091A: MOVF 77,W |
091B: MOVWF 22 |
091C: MOVF 78,W |
091D: MOVWF 23 |
091E: MOVF 79,W |
091F: MOVWF 24 |
0920: MOVF 7A,W |
0921: MOVWF 25 |
0922: MOVLW 31 |
0923: BSF 03.6 |
0924: MOVWF 0D |
0925: MOVLW 00 |
0926: MOVWF 0F |
0927: BCF 03.0 |
0928: MOVLW 05 |
0929: BCF 03.6 |
092A: MOVWF 26 |
092B: BCF 0A.3 |
092C: CALL 1FE |
092D: BSF 0A.3 |
092E: MOVLW 89 |
092F: MOVWF 04 |
0930: MOVF 25,W |
0931: MOVWF 29 |
0932: MOVF 24,W |
0933: MOVWF 28 |
0934: MOVF 23,W |
0935: MOVWF 27 |
0936: MOVF 22,W |
0937: MOVWF 26 |
0938: MOVLW 02 |
0939: MOVWF 2A |
093A: BCF 0A.3 |
093B: CALL 61A |
093C: BSF 0A.3 |
093D: MOVLW 20 |
093E: MOVWF 33 |
093F: BCF 0A.3 |
0940: CALL 0B9 |
0941: BSF 0A.3 |
0942: MOVLW 0D |
0943: MOVWF 33 |
0944: BCF 0A.3 |
0945: CALL 0B9 |
0946: BSF 0A.3 |
0947: MOVLW 0A |
0948: MOVWF 33 |
0949: BCF 0A.3 |
094A: CALL 0B9 |
094B: BSF 0A.3 |
.................... delay_ms (1000); |
094C: MOVLW 04 |
094D: MOVWF 22 |
094E: MOVLW FA |
094F: MOVWF 27 |
0950: BCF 0A.3 |
0951: CALL 123 |
0952: BSF 0A.3 |
0953: DECFSZ 22,F |
0954: GOTO 14E |
.................... i++; |
0955: INCF 21,F |
.................... } |
0956: GOTO 079 |
.................... } |
.................... |
0957: SLEEP |
Configuration Fuses: |
Word 1: 2CF4 INTRC_IO NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
Word 2: 3FFF NOWRT BORV40 |