1 Disassembly Listing for uart test
3 /home/justin/MPLABXProjects/uart test.X/dist/XC8_12F1840/production/uart_test.X.production.cof
6 --- /home/justin/MPLABXProjects/uart test.X/user.c ----------------------------------------------------
7 1: /******************************************************************************/
8 2: /* Files to Include */
9 3: /******************************************************************************/
12 6: #include <xc.h> /* XC8 General Include File */
13 7: #elif defined(HI_TECH_C)
14 8: #include <htc.h> /* HiTech General Include File */
17 11: #include <stdint.h> /* For uint8_t definition */
18 12: #include <stdbool.h> /* For true/false definition */
20 14: #include "system.h"
23 17: /******************************************************************************/
24 18: /* User Functions */
25 19: /******************************************************************************/
27 21: /* <Initialize variables in user.h and insert code for user algorithms.> */
29 23: void InitApp(void)
31 25: /* TODO Initialize User Ports/Peripherals/Project here */
33 27: /* configure 4MHz mode */
34 28: OSCCONbits.SPLLEN = 0;
36 0BCF 1399 BCF T1GCON, 0x7
37 29: OSCCONbits.IRCF = 0b1101;
38 0BD0 0819 MOVF T1GCON, W
41 0BD3 0099 MOVWF T1GCON
42 30: OSCCONbits.SCS = 0b00;
44 0BD5 0599 ANDWF T1GCON, F
46 32: /* Enabling transmitter 26.1.1.1 page 259 - TX/CK I/O pin */
47 33: TXSTAbits.TXEN = 1;
49 0BD7 169E BSF CPSCON0, 0x5
50 34: TXSTAbits.SYNC = 0;
51 0BD8 121E BCF CPSCON0, 0x4
52 35: RCSTAbits.SPEN = 1;
53 0BD9 179D BSF 0x1D, 0x7
54 36: /* Enabling receiver 26.1.2 page 262 - RX/DT I/O pin */
55 37: RCSTAbits.CREN = 1;
56 0BDA 161D BSF 0x1D, 0x4
58 39: /* 4MHz clock, 19k2 baud */
59 40: TXSTAbits.BRGH = 0;
60 0BDB 111E BCF CPSCON0, 0x2
61 41: BAUDCONbits.BRG16 = 1;
62 0BDC 159F BSF CPSCON1, 0x3
67 44: /* Select pins 4&5 as the uart - page 102 */
68 45: APFCONbits.RXDTSEL = 1; /* RX/DT on RA5 */
70 0BE0 179D BSF 0x1D, 0x7
71 46: APFCONbits.TXCKSEL = 1; /* TX/CK on RA4 */
72 0BE1 151D BSF 0x1D, 0x2
73 47: TRISAbits.TRISA5 = 1; /* RA5 as input */
75 0BE3 168C BSF PORTA, 0x5
76 48: TRISAbits.TRISA4 = 0; /* RA4 as output */
77 0BE4 120C BCF PORTA, 0x4
79 50: ANSELA = 0; /* no analog */
84 53: /* enable weak pullups, clear them all */
88 55: //WPUAbits.WPUA0 = 0x00000100; // RA0 pullup for 1-wire bus
89 56: OPTION_REGbits.nWPUEN = 1;
91 0BEA 1795 BSF TMR0, 0x7
93 58: /* Enable interrupts */
94 59: INTCONbits.GIE = 1;
95 0BEB 178B BSF INTCON, 0x7
96 60: INTCONbits.PEIE = 1;
97 0BEC 170B BSF INTCON, 0x6
99 62: /* enable uart receiver interupt */
100 63: PIE1bits.RCIE = 1;
101 0BED 1691 BSF PIR1, 0x5
105 --- /home/justin/MPLABXProjects/uart test.X/system.c --------------------------------------------------
106 1: /******************************************************************************/
107 2: /* Files to Include */
108 3: /******************************************************************************/
111 6: #include <xc.h> /* XC8 General Include File */
112 7: #elif defined(HI_TECH_C)
113 8: #include <htc.h> /* HiTech General Include File */
116 11: #include <stdint.h> /* For uint8_t definition */
117 12: #include <stdbool.h> /* For true/false definition */
119 14: #include "system.h"
121 16: /* Refer to the device datasheet for information about available
122 17: oscillator configurations and to compiler documentation for macro details. */
123 18: void ConfigureOscillator(void)
126 21: /*If the PIC12 device has an OSCCAL value, the HiTech Compiler provides
127 22: a macro called _READ_OSCCAL_DATA which can be loaded using this: */
129 24: /* TODO Configure OSCCAL if the device has an OSCCAL register */
133 28: OSCCAL=_READ_OSCCAL_DATA(); /* _READ_OSCCAL_DATA macro unloads cal memory */
137 32: /*Not all PIC12 devices require this.
139 34: /* TODO Add clock switching code if appropriate. */
141 36: /* Typical actions in this function are to tweak the oscillator tuning
142 37: register, select new clock sources, and to wait until new clock sources
143 38: are stable before resuming execution of the main project. */
147 --- /home/justin/MPLABXProjects/uart test.X/onewire.c -------------------------------------------------
148 1: /* Dallas 1-Wire bus routines */
151 4: #include <xc.h> /* XC8 General Include File */
152 5: #elif defined(HI_TECH_C)
153 6: #include <htc.h> /* HiTech General Include File */
156 9: #include <stdint.h> /* For uint8_t definition */
157 10: #include <stdbool.h> /* For true/false definition */
159 12: #include "system.h"
160 13: #include "user.h"
161 14: #include "onewire.h"
163 16: // fast way, macros
164 17: #define OWLOW { PORTAbits.RA2 = 0; TRISAbits.TRISA2 = 0; }
165 18: #define OWHIGH { PORTAbits.RA2 = 1; TRISAbits.TRISA2 = 0; }
166 19: #define OWTRI { TRISAbits.TRISA2 = 1; }
167 20: #define OWREAD (PORTAbits.RA2)
170 23: // slow way, causes a function call
171 24: inline void drive_OW_low(void)
173 26: PORTAbits.RA2 = 0;
175 0B2E 110C BCF PORTA, 0x2
176 27: TRISAbits.TRISA2 = 0;
178 0B30 110C BCF PORTA, 0x2
182 30: inline void drive_OW_high(void)
184 32: PORTAbits.RA2 = 1;
186 0B29 150C BSF PORTA, 0x2
187 33: TRISAbits.TRISA2 = 0;
189 0B2B 110C BCF PORTA, 0x2
193 36: inline void float_OW(void)
195 38: TRISAbits.TRISA2 = 1;
197 04FE 150C BSF PORTA, 0x2
201 41: inline bool read_OW(void)
203 43: TRISAbits.TRISA2 = 1;
205 0B33 150C BSF PORTA, 0x2
206 44: return PORTAbits.RA2;
208 0B35 0C0C RRF PORTA, W
209 0B36 0C89 RRF WREG, F
216 48: /* start the 1-Wire bus
219 51: void OW_start(void)
221 53: //drive_OW_high();
229 57: /* reset the bus, test for presence signal */
230 58: bool OW_reset(void)
232 60: bool presence = 0;
233 0C37 01F5 CLRF presence
235 62: OWLOW; //drive_OW_low();
237 0C39 110C BCF PORTA, 0x2
239 0C3B 110C BCF PORTA, 0x2
243 0C3E 0BF4 DECFSZ i, F
248 0C42 0BF4 DECFSZ i, F
250 65: OWTRI; //float_OW(); // let it float high
252 0C45 150C BSF PORTA, 0x2
256 0C48 0BF4 DECFSZ i, F
258 67: presence = OWREAD; //read_OW(); // now sample
261 0C4C 190C BTFSC PORTA, 0x2
263 0C4E 00F5 MOVWF presence
267 0C51 0BF4 DECFSZ i, F
273 0C56 0BF4 DECFSZ i, F
277 71: return ! presence;
278 0C59 0875 MOVF presence, W
281 0C5C 1903 BTFSC STATUS, 0x2
287 74: void OW_write_bit(bool val)
289 76: #if 0 // Maxim dev note 2420
292 79: if (val) float_OW();
298 0B5C 00F5 MOVWF presence
300 0B5E 110C BCF PORTA, 0x2
302 0B60 110C BCF PORTA, 0x2
307 87: // NOP(); // doc one for other delays
309 0B63 0875 MOVF presence, W
310 0B64 1D03 BTFSS STATUS, 0x2
314 0B68 150C BSF PORTA, 0x2
319 0B6C 0BF4 DECFSZ i, F
324 0B70 150C BSF PORTA, 0x2
333 96: bool OW_read_bit()
336 99: #if 0 /* Maxim dev note 2420 */
341 104: val = read_OW();
346 0B75 110C BCF PORTA, 0x2
348 0B77 110C BCF PORTA, 0x2
362 0B7E 150C BSF PORTA, 0x2
370 119: val = read_OW();
376 0B87 00F5 MOVWF presence
380 0B8A 0BF4 DECFSZ i, F
386 0B8D 0875 MOVF presence, W
391 126: void OW_write_byte(unsigned char byte)
395 128: for (char i=8; i!=0; i--)
401 0B97 1D03 BTFSS STATUS, 0x2
410 0BA8 1D03 BTFSS STATUS, 0x2
416 130: OW_write_bit( byte & 0x01 );
423 0BA2 1003 BCF STATUS, 0x0
430 135: unsigned char OW_read_byte(void)
432 137: unsigned char byte = 0;
435 138: for (char i=8; i!=0; i--)
441 0C18 1D03 BTFSS STATUS, 0x2
451 0C2F 1D03 BTFSS STATUS, 0x2
458 0C1E 1003 BCF STATUS, 0x0
460 141: if (OW_read_bit())
465 0C24 1903 BTFSC STATUS, 0x2
481 148: static const unsigned char dscrc_table[] = {
482 149: 0, 94,188,226, 97, 63,221,131,194,156,126, 32,163,253, 31, 65,
483 150: 157,195, 33,127,252,162, 64, 30, 95, 1,227,189, 62, 96,130,220,
484 151: 35,125,159,193, 66, 28,254,160,225,191, 93, 3,128,222, 60, 98,
485 152: 190,224, 2, 92,223,129, 99, 61,124, 34,192,158, 29, 67,161,255,
486 153: 70, 24,250,164, 39,121,155,197,132,218, 56,102,229,187, 89, 7,
487 154: 219,133,103, 57,186,228, 6, 88, 25, 71,165,251,120, 38,196,154,
488 155: 101, 59,217,135, 4, 90,184,230,167,249, 27, 69,198,152,122, 36,
489 156: 248,166, 68, 26,153,199, 37,123, 58,100,134,216, 91, 5,231,185,
490 157: 140,210, 48,110,237,179, 81, 15, 78, 16,242,172, 47,113,147,205,
491 158: 17, 79,173,243,112, 46,204,146,211,141,111, 49,178,236, 14, 80,
492 159: 175,241, 19, 77,206,144,114, 44,109, 51,209,143, 12, 82,176,238,
493 160: 50,108,142,208, 83, 13,239,177,240,174, 76, 18,145,207, 45,115,
494 161: 202,148,118, 40,171,245, 23, 73, 8, 86,180,234,105, 55,213,139,
495 162: 87, 9,235,181, 54,104,138,212,149,203, 41,119,244,170, 72, 22,
496 163: 233,183, 85, 11,136,214, 52,106, 43,117,151,201, 74, 20,246,168,
497 164: 116, 42,200,150, 21, 75,169,247,182,232, 10, 84,215,137,107, 53
500 167: unsigned char romid[8];
501 168: char LastDiscrepancy = 0;
502 169: char LastFamilyDiscrepancy = 0;
503 170: char LastDeviceFlag = false;
504 171: unsigned char crc8;
506 173: static unsigned char docrc8(unsigned char value)
508 04ED 00F5 MOVWF presence
509 175: crc8 = dscrc_table[crc8 ^ value];
511 04EF 082B MOVF crc8, W
512 04F0 0675 XORWF presence, W
514 04F2 0084 MOVWF FSR0L
516 04F4 1803 BTFSC STATUS, 0x0
518 04F6 0085 MOVWF FSR0H
519 04F7 0800 MOVF INDF0, W
528 179: /* enumerate the devices */
529 180: bool OW_search()
531 182: char id_bit_number = 1;
533 0F0D 01BE CLRF id_bit_number
534 0F0E 0ABE INCF id_bit_number, F
535 183: char last_zero = 0;
536 0F0F 01BC CLRF last_zero
537 184: char rom_byte_number = 0;
538 0F10 01C0 CLRF rom_byte_number
539 185: char search_result = 0;
540 0F11 01BA CLRF search_result
541 186: unsigned char rom_byte_mask = 1;
542 0F12 01BF CLRF rom_byte_mask
543 0F13 0ABF INCF rom_byte_mask, F
544 187: unsigned char search_direction;
549 191: // do not interrupt us
555 194: // if the last call was not the last one
556 195: if (!LastDeviceFlag) {
558 0F19 08A8 MOVF LastDeviceFlag, F
559 0F1A 1D03 BTFSS STATUS, 0x2
563 196: if (!OW_reset())
568 0F22 1D03 BTFSS STATUS, 0x2
573 198: msg_write("Reset said nothing there.\r\n");
577 0F29 00F5 MOVWF presence
581 199: // reset the search
582 200: LastDiscrepancy = 0;
584 0F2E 01A9 CLRF LastDiscrepancy
585 201: LastDeviceFlag = 0;
586 0F2F 01A8 CLRF LastDeviceFlag
587 202: LastFamilyDiscrepancy = 0;
588 0F30 01AA CLRF LastFamilyDiscrepancy
599 207: // issue the search command
600 208: OW_write_byte(0xF0);
606 210: // loop to do the search
608 212: // read a bit and its complement
609 213: bool id_bit = OW_read_bit();
616 0F41 00BB MOVWF id_bit
621 215: bool cmp_id_bit = OW_read_bit();
628 0F4B 00B9 MOVWF cmp_id_bit
630 217: // check for no devices on bus
631 218: if (id_bit && cmp_id_bit) {
632 0F4C 083B MOVF id_bit, W
633 0F4D 1D03 BTFSS STATUS, 0x2
636 0F50 0839 MOVF cmp_id_bit, W
637 0F51 1D03 BTFSS STATUS, 0x2
645 222: if (id_bit != cmp_id_bit) {
646 0F56 083B MOVF id_bit, W
647 0F57 0639 XORWF cmp_id_bit, W
648 0F58 1903 BTFSC STATUS, 0x2
652 223: // all devices have a 0 here, or they all have a 1
653 224: search_direction = id_bit;
654 0F5C 083B MOVF id_bit, W
657 0F5F 00BD MOVWF search_direction
660 226: // both bits zero, so both 0 and 1 exist
662 228: // if this discrepancy is before the Last Discrepancy
663 229: // on a previous next then pick the same as last time
664 230: if (id_bit_number < LastDiscrepancy) {
665 0F61 0829 MOVF LastDiscrepancy, W
666 0F62 023E SUBWF id_bit_number, W
667 0F63 1803 BTFSC STATUS, 0x0
671 231: search_direction = ((romid[rom_byte_number] & rom_byte_mask) > 0);
672 0F67 0840 MOVF rom_byte_number, W
674 0F69 0086 MOVWF FSR1L
676 0F6B 0801 MOVF INDF1, W
677 0F6C 053F ANDWF rom_byte_mask, W
679 0F6E 1D03 BTFSS STATUS, 0x2
683 0F72 00BD MOVWF search_direction
686 233: // if equal to last pick 1, if not then pick 0
687 234: search_direction = (id_bit_number == LastDiscrepancy);
688 0F74 083E MOVF id_bit_number, W
689 0F75 0629 XORWF LastDiscrepancy, W
691 0F77 1903 BTFSC STATUS, 0x2
695 0F7B 00BD MOVWF search_direction
699 237: // if 0 was picked then record its position in LastZero
700 238: if (search_direction == 0)
701 0F7D 08BD MOVF search_direction, F
702 0F7E 1D03 BTFSS STATUS, 0x2
707 240: last_zero = id_bit_number;
708 0F82 083E MOVF id_bit_number, W
711 0F85 00BC MOVWF last_zero
712 241: // check for last discrepancy in family
713 242: if (last_zero < 9)
715 0F87 023C SUBWF last_zero, W
716 0F88 1803 BTFSC STATUS, 0x0
720 243: LastFamilyDiscrepancy = last_zero;
721 0F8C 083C MOVF last_zero, W
724 0F8F 00AA MOVWF LastFamilyDiscrepancy
730 247: // set or clear the bit in the ROM byte rom_byte_number
731 248: // with mask rom_byte_mask
732 249: if (search_direction == 1)
733 0F92 083D MOVF search_direction, W
735 0F94 1D03 BTFSS STATUS, 0x2
739 250: romid[rom_byte_number] |= rom_byte_mask;
740 0F98 083F MOVF rom_byte_mask, W
742 0F9A 0840 MOVF rom_byte_number, W
744 0F9C 0086 MOVWF FSR1L
747 0F9F 0481 IORWF INDF1, F
750 252: romid[rom_byte_number] &= ~rom_byte_mask;
751 0FA1 093F COMF rom_byte_mask, W
753 0FA3 0840 MOVF rom_byte_number, W
755 0FA5 0086 MOVWF FSR1L
758 0FA8 0581 ANDWF INDF1, F
761 254: // serial number search direction write bit
762 255: OW_write_bit(search_direction);
763 0FAA 083D MOVF search_direction, W
768 257: // increment the byte counter id_bit_number
769 258: // and shift the mask rom_byte_mask
770 259: id_bit_number++;
775 0FB2 07BE ADDWF id_bit_number, F
776 260: rom_byte_mask <<= 1;
777 0FB3 1003 BCF STATUS, 0x0
778 0FB4 0DBF RLF rom_byte_mask, F
780 262: // if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask
781 263: if (rom_byte_mask == 0)
782 0FB5 08BF MOVF rom_byte_mask, F
783 0FB6 1D03 BTFSS STATUS, 0x2
788 265: docrc8(romid[rom_byte_number]); // accumulate the CRC
789 0FBA 0840 MOVF rom_byte_number, W
791 0FBC 0086 MOVWF FSR1L
793 0FBE 0801 MOVF INDF1, W
797 266: rom_byte_number++;
802 0FC6 07C0 ADDWF rom_byte_number, F
803 267: rom_byte_mask = 1;
804 0FC7 01BF CLRF rom_byte_mask
805 0FC8 0ABF INCF rom_byte_mask, F
808 269: } while (rom_byte_number < 8); // loop until all rom bytes 0-7
810 0FCB 0240 SUBWF rom_byte_number, W
811 0FCC 1C03 BTFSS STATUS, 0x0
817 270: } // end of not-last-device
819 272: // if the search was succesful then
820 273: if (!(id_bit_number < 65 || crc8 != 0))
822 0FD3 023E SUBWF id_bit_number, W
823 0FD4 1C03 BTFSS STATUS, 0x0
827 0FD8 08AB MOVF crc8, F
828 0FD9 1D03 BTFSS STATUS, 0x2
833 275: // search successful
834 276: LastDiscrepancy = last_zero;
835 0FDD 083C MOVF last_zero, W
838 0FE0 00A9 MOVWF LastDiscrepancy
840 278: // check for last device
841 279: if (LastDiscrepancy == 0)
842 0FE1 08A9 MOVF LastDiscrepancy, F
843 0FE2 1D03 BTFSS STATUS, 0x2
847 280: LastDeviceFlag = true;
848 0FE6 01A8 CLRF LastDeviceFlag
849 0FE7 0AA8 INCF LastDeviceFlag, F
851 282: search_result = true;
852 0FE8 01BA CLRF search_result
853 0FE9 0ABA INCF search_result, F
857 285: if (!search_result || !romid[0])
858 0FEB 083A MOVF search_result, W
859 0FEC 1D03 BTFSS STATUS, 0x2
862 0FEF 08A0 MOVF romid, F
863 0FF0 1D03 BTFSS STATUS, 0x2
868 287: LastDiscrepancy = 0;
869 0FF4 01A9 CLRF LastDiscrepancy
870 288: LastDeviceFlag = false;
871 0FF5 01A8 CLRF LastDeviceFlag
872 289: LastFamilyDiscrepancy = 0;
873 0FF6 01AA CLRF LastFamilyDiscrepancy
874 290: search_result = false;
875 0FF7 01BA CLRF search_result
883 294: return search_result;
885 0FFD 083A MOVF search_result, W
890 298: void OW_search_init()
892 300: LastDiscrepancy = 0;
894 0C8D 01A9 CLRF LastDiscrepancy
895 301: LastDeviceFlag = false;
896 0C8E 01A8 CLRF LastDeviceFlag
897 302: LastFamilyDiscrepancy = 0;
898 0C8F 01AA CLRF LastFamilyDiscrepancy
900 304: for (int j=0; j<8; j++) romid[j]=0;
902 0C91 01F5 CLRF presence
903 0C92 0875 MOVF presence, W
907 0C96 027F SUBWF 0x7F, W
908 0C97 1D03 BTFSS STATUS, 0x2
912 0C9B 1C03 BTFSS STATUS, 0x0
920 0CA3 0086 MOVWF FSR1L
926 0CA9 3DF5 ADDWFC presence, F
927 0CAA 0875 MOVF presence, W
931 0CAE 027F SUBWF 0x7F, W
932 0CAF 1D03 BTFSS STATUS, 0x2
936 0CB3 1C03 BTFSS STATUS, 0x0
945 308: /* ask the (lone) device for its Serial number */
946 309: void OW_identify()
956 313: // read ROM command
957 314: OW_write_byte(0x33);
962 315: for (int j=0; j<8; j++)
964 0D9D 01B9 CLRF cmp_id_bit
965 0D9E 01BA CLRF search_result
966 0D9F 083A MOVF search_result, W
970 0DA3 027F SUBWF 0x7F, W
971 0DA4 1D03 BTFSS STATUS, 0x2
974 0DA7 0239 SUBWF cmp_id_bit, W
975 0DA8 1C03 BTFSS STATUS, 0x0
982 0DBA 07B9 ADDWF cmp_id_bit, F
984 0DBC 3DBA ADDWFC search_result, F
985 0DBD 083A MOVF search_result, W
989 0DC1 027F SUBWF 0x7F, W
990 0DC2 1D03 BTFSS STATUS, 0x2
993 0DC5 0239 SUBWF cmp_id_bit, W
994 0DC6 1C03 BTFSS STATUS, 0x0
999 316: romid[j] = OW_read_byte();
1001 0DAF 2411 CALL 0x411
1005 0DB3 0839 MOVF cmp_id_bit, W
1006 0DB4 3E20 ADDLW 0x20
1007 0DB5 0086 MOVWF FSR1L
1008 0DB6 0187 CLRF FSR1H
1009 0DB7 0838 MOVF bt, W
1010 0DB8 0081 MOVWF INDF1
1013 0DCC 2320 CALL 0x320
1018 320: /* is anyone parasite powered ? */
1019 321: bool OW_parasite(void)
1023 0BAF 2322 CALL 0x322
1027 0BB2 2437 CALL 0x437
1029 325: OW_write_byte(0xCC); // skip the rom command
1030 0BB4 30CC MOVLW 0xCC
1032 0BB6 2390 CALL 0x390
1034 326: OW_write_byte(0xB4); // are you parasite powered ?
1035 0BB8 30B4 MOVLW 0xB4
1037 0BBA 2390 CALL 0x390
1039 327: bool no = OW_read_bit();
1041 0BBD 2374 CALL 0x374
1045 0BC1 0838 MOVF bt, W
1046 0BC2 00B9 MOVWF cmp_id_bit
1049 0BC4 2320 CALL 0x320
1053 0BC7 0839 MOVF cmp_id_bit, W
1056 0BCA 1903 BTFSC STATUS, 0x2
1058 0BCC 2BCD GOTO 0x3CD
1062 332: /* select a specific device,
1063 333: * if family==0 select all devices (skip rom)
1065 335: static void OW_select_id(void)
1067 337: if (romid[0] == 0) {
1069 0CEA 08A0 MOVF romid, F
1070 0CEB 1D03 BTFSS STATUS, 0x2
1071 0CEC 2CEE GOTO 0x4EE
1072 0CED 2CEF GOTO 0x4EF
1073 0CEE 2CF4 GOTO 0x4F4
1074 338: OW_write_byte(0xCC); // all devices for now
1075 0CEF 30CC MOVLW 0xCC
1077 0CF1 2390 CALL 0x390
1080 0CF3 2D19 GOTO 0x519
1081 340: OW_write_byte(0x55); // match rom
1082 0CF4 3055 MOVLW 0x55
1084 0CF6 2390 CALL 0x390
1086 341: for (int8_t j=0; j<8; j++) {
1088 0CF9 01B9 CLRF cmp_id_bit
1089 0CFA 0839 MOVF cmp_id_bit, W
1090 0CFB 3A80 XORLW 0x80
1091 0CFC 3E78 ADDLW 0x78
1092 0CFD 1C03 BTFSS STATUS, 0x0
1093 0CFE 2D00 GOTO 0x500
1094 0CFF 2D01 GOTO 0x501
1095 0D00 2D03 GOTO 0x503
1096 0D01 2D19 GOTO 0x519
1097 0D02 2D19 GOTO 0x519
1101 0D0E 0838 MOVF bt, W
1102 0D0F 07B9 ADDWF cmp_id_bit, F
1103 0D10 0839 MOVF cmp_id_bit, W
1104 0D11 3A80 XORLW 0x80
1105 0D12 3E78 ADDLW 0x78
1106 0D13 1C03 BTFSS STATUS, 0x0
1107 0D14 2D16 GOTO 0x516
1108 0D15 2D17 GOTO 0x517
1109 0D16 2D03 GOTO 0x503
1110 0D17 2D19 GOTO 0x519
1111 0D18 2D19 GOTO 0x519
1112 342: OW_write_byte(romid[j]);
1113 0D03 0839 MOVF cmp_id_bit, W
1114 0D04 3E20 ADDLW 0x20
1115 0D05 0086 MOVWF FSR1L
1116 0D06 0187 CLRF FSR1H
1117 0D07 0801 MOVF INDF1, W
1119 0D09 2390 CALL 0x390
1127 348: /* read a memory block eg scratchpad 0xBE */
1128 349: void OW_read_block(uint8_t code, uint8_t * data, uint8_t len)
1131 0D1B 00BF MOVWF rom_byte_mask
1134 0D1D 2322 CALL 0x322
1138 0D20 2437 CALL 0x437
1140 353: OW_select_id();
1142 0D23 24E9 CALL 0x4E9
1144 354: OW_write_byte(code);
1146 0D26 083F MOVF rom_byte_mask, W
1148 0D28 2390 CALL 0x390
1150 355: for (int8_t j=0; j<len; j++)
1152 0D2B 01C0 CLRF rom_byte_number
1153 0D2C 2D3F GOTO 0x53F
1155 0D3B 00BC MOVWF last_zero
1156 0D3C 083C MOVF last_zero, W
1157 0D3D 07C0 ADDWF rom_byte_number, F
1158 0D3E 2D3F GOTO 0x53F
1159 0D3F 0840 MOVF rom_byte_number, W
1160 0D40 00BC MOVWF last_zero
1161 0D41 01BD CLRF search_direction
1162 0D42 1BBC BTFSC last_zero, 0x7
1163 0D43 03BD DECF search_direction, F
1164 0D44 083D MOVF search_direction, W
1165 0D45 3A80 XORLW 0x80
1166 0D46 00BE MOVWF id_bit_number
1167 0D47 3080 MOVLW 0x80
1168 0D48 023E SUBWF id_bit_number, W
1169 0D49 1D03 BTFSS STATUS, 0x2
1170 0D4A 2D4D GOTO 0x54D
1171 0D4B 083B MOVF id_bit, W
1172 0D4C 023C SUBWF last_zero, W
1173 0D4D 1C03 BTFSS STATUS, 0x0
1174 0D4E 2D50 GOTO 0x550
1175 0D4F 2D51 GOTO 0x551
1176 0D50 2D2D GOTO 0x52D
1177 0D51 2D52 GOTO 0x552
1178 356: data[j] = OW_read_byte();
1180 0D2E 2411 CALL 0x411
1183 0D31 00BC MOVWF last_zero
1184 0D32 0840 MOVF rom_byte_number, W
1185 0D33 073A ADDWF search_result, W
1186 0D34 00BD MOVWF search_direction
1187 0D35 083D MOVF search_direction, W
1188 0D36 0086 MOVWF FSR1L
1189 0D37 0187 CLRF FSR1H
1190 0D38 083C MOVF last_zero, W
1191 0D39 0081 MOVWF INDF1
1194 0D53 2320 CALL 0x320
1199 360: /* write a memory block to device, eg scratchpad 0x4E */
1200 361: void OW_write_block(uint8_t code, uint8_t * data, uint8_t len)
1204 365: OW_select_id();
1205 366: OW_write_byte(code);
1206 367: for (int8_t j=0; j<len; j++) {
1207 368: OW_write_byte(data[j]);
1213 374: // perform temperature conversion
1214 375: void OW_convert()
1216 377: // first see if anyone is parasitic
1217 378: bool para = OW_parasite();
1219 0EA1 23AE CALL 0x3AE
1222 0EA4 00BA MOVWF search_result
1223 0EA5 083A MOVF search_result, W
1224 0EA6 00BD MOVWF search_direction
1228 0EA8 2322 CALL 0x322
1230 381: OW_reset(); // all command start with reset
1232 0EAB 2437 CALL 0x437
1234 382: OW_select_id();
1236 0EAE 24E9 CALL 0x4E9
1238 383: //OW_write_byte(0xCC); // all devices
1239 384: OW_write_byte(0x44); // convert
1240 0EB0 3044 MOVLW 0x44
1242 0EB2 2390 CALL 0x390
1246 0EB5 083D MOVF search_direction, W
1247 0EB6 1D03 BTFSS STATUS, 0x2
1248 0EB7 2EB9 GOTO 0x6B9
1249 0EB8 2EF6 GOTO 0x6F6
1250 386: // hard high for 750mS
1252 0EB9 150C BSF PORTA, 0x2
1254 0EBB 110C BCF PORTA, 0x2
1255 388: DelayUs(250000);
1258 0EBE 00BC MOVWF last_zero
1259 0EBF 3045 MOVLW 0x45
1260 0EC0 00BB MOVWF id_bit
1261 0EC1 30A9 MOVLW 0xA9
1262 0EC2 00BA MOVWF search_result
1263 0EC3 0BBA DECFSZ search_result, F
1264 0EC4 2EC3 GOTO 0x6C3
1265 0EC5 0BBB DECFSZ id_bit, F
1266 0EC6 2EC3 GOTO 0x6C3
1267 0EC7 0BBC DECFSZ last_zero, F
1268 0EC8 2EC3 GOTO 0x6C3
1269 0EC9 2ECA GOTO 0x6CA
1270 389: DelayUs(250000);
1273 0ECC 00BC MOVWF last_zero
1274 0ECD 3045 MOVLW 0x45
1275 0ECE 00BB MOVWF id_bit
1276 0ECF 30A9 MOVLW 0xA9
1277 0ED0 00BA MOVWF search_result
1278 0ED1 0BBA DECFSZ search_result, F
1279 0ED2 2ED1 GOTO 0x6D1
1280 0ED3 0BBB DECFSZ id_bit, F
1281 0ED4 2ED1 GOTO 0x6D1
1282 0ED5 0BBC DECFSZ last_zero, F
1283 0ED6 2ED1 GOTO 0x6D1
1284 0ED7 2ED8 GOTO 0x6D8
1285 390: DelayUs(250000);
1288 0EDA 00BC MOVWF last_zero
1289 0EDB 3045 MOVLW 0x45
1290 0EDC 00BB MOVWF id_bit
1291 0EDD 30A9 MOVLW 0xA9
1292 0EDE 00BA MOVWF search_result
1293 0EDF 0BBA DECFSZ search_result, F
1294 0EE0 2EDF GOTO 0x6DF
1295 0EE1 0BBB DECFSZ id_bit, F
1296 0EE2 2EDF GOTO 0x6DF
1297 0EE3 0BBC DECFSZ last_zero, F
1298 0EE4 2EDF GOTO 0x6DF
1299 0EE5 2EE6 GOTO 0x6E6
1300 391: DelayUs(250000);
1303 0EE8 00BC MOVWF last_zero
1304 0EE9 3045 MOVLW 0x45
1305 0EEA 00BB MOVWF id_bit
1306 0EEB 30A9 MOVLW 0xA9
1307 0EEC 00BA MOVWF search_result
1308 0EED 0BBA DECFSZ search_result, F
1309 0EEE 2EED GOTO 0x6ED
1310 0EEF 0BBB DECFSZ id_bit, F
1311 0EF0 2EED GOTO 0x6ED
1312 0EF1 0BBC DECFSZ last_zero, F
1313 0EF2 2EED GOTO 0x6ED
1314 0EF3 2EF4 GOTO 0x6F4
1316 0EF4 2F08 GOTO 0x708
1317 0EF5 2EF6 GOTO 0x6F6
1318 393: // keep polling until its done
1319 394: // device will reply with 0 'pull low' whilst convert in progress
1322 0EF6 30F9 MOVLW 0xF9
1324 0EF8 00BA MOVWF search_result
1326 0EFA 0BBA DECFSZ search_result, F
1327 0EFB 2EF9 GOTO 0x6F9
1328 0EFC 2EFD GOTO 0x6FD
1330 397: } while (!OW_read_bit());
1332 0EFF 2374 CALL 0x374
1335 0F02 1903 BTFSC STATUS, 0x2
1336 0F03 2F05 GOTO 0x705
1337 0F04 2F06 GOTO 0x706
1338 0F05 2EF6 GOTO 0x6F6
1339 0F06 2F08 GOTO 0x708
1340 0F07 2F08 GOTO 0x708
1344 0F09 2320 CALL 0x320
1349 402: /* Available commands :-
1350 403: * 33h - read rom (sends 8 bytes)
1351 404: * 55h - match rom (reads 8 bytes)
1352 405: * F0h - search rom (enumeration mode)
1353 406: * ECh - alarm search
1354 407: * CC - skip rom command
1356 409: * followed by....
1357 410: * 44h - convert temperature
1358 411: * 48h - copy scratchpad -> eeprom
1359 412: * 4Eh - write scratchpad (send 3 bytes )
1360 413: * BEh - read scratchpad ( 8 bytes + crc)
1361 414: * B8h - recall EEPROM -> scratchpad
1362 415: * B4h - read power supply (read 1 bit)
1364 --- /home/justin/MPLABXProjects/uart test.X/main.c ----------------------------------------------------
1365 1: /******************************************************************************/
1366 2: /* Files to Include */
1367 3: /******************************************************************************/
1369 5: #if defined(__XC)
1370 6: #include <xc.h> /* XC8 General Include File */
1371 7: #elif defined(HI_TECH_C)
1372 8: #include <htc.h> /* HiTech General Include File */
1375 11: #include <stdio.h>
1377 13: #include <stdint.h> /* For uint8_t definition */
1378 14: #include <stdbool.h> /* For true/false definition */
1380 16: #include "system.h" /* System funct/params, like osc/peripheral config */
1381 17: #include "user.h" /* User funct/params, such as InitApp */
1383 19: #include "onewire.h" /* 1-wire bus functions */
1385 21: /******************************************************************************/
1386 22: /* User Global Variable Declaration */
1387 23: /******************************************************************************/
1389 25: /* i.e. uint8_t <variable_name>; */
1391 27: char outbuff[100];
1392 28: char * outp = 0;
1393 29: uint8_t outlen = 0;
1395 31: char inbuff[10];
1396 32: uint8_t inlen = 0;
1398 34: /******************************************************************************/
1399 35: /* Main Program */
1400 36: /******************************************************************************/
1404 40: const char * banner = "\r\n\n\nPIC 1-Wire Bridge system. Press 'H' for help.\r\n";
1408 44: prompt[0] = 'c';
1409 002A 3063 MOVLW 0x63
1411 002C 00C1 MOVWF 0x41
1412 002D 0841 MOVF 0x41, W
1413 002E 00AC MOVWF prompt
1414 45: prompt[1] = 'm';
1415 002F 306D MOVLW 0x6D
1416 0030 00C1 MOVWF 0x41
1417 0031 0841 MOVF 0x41, W
1418 0032 00AD MOVWF 0x2D
1419 46: prompt[2] = 'd';
1420 0033 3064 MOVLW 0x64
1421 0034 00C1 MOVWF 0x41
1422 0035 0841 MOVF 0x41, W
1423 0036 00AE MOVWF 0x2E
1424 47: prompt[3] = ' ';
1425 0037 3020 MOVLW 0x20
1426 0038 00C1 MOVWF 0x41
1427 0039 0841 MOVF 0x41, W
1428 003A 00AF MOVWF 0x2F
1429 48: prompt[4] = '?';
1430 003B 303F MOVLW 0x3F
1431 003C 00C1 MOVWF 0x41
1432 003D 0841 MOVF 0x41, W
1433 003E 00B0 MOVWF 0x30
1434 49: prompt[5] = '?';
1435 003F 303F MOVLW 0x3F
1436 0040 00C1 MOVWF 0x41
1437 0041 0841 MOVF 0x41, W
1438 0042 00B1 MOVWF 0x31
1439 50: prompt[6] = '>';
1440 0043 303E MOVLW 0x3E
1441 0044 00C1 MOVWF 0x41
1442 0045 0841 MOVF 0x41, W
1443 0046 00B2 MOVWF 0x32
1444 51: prompt[7] = ' ';
1445 0047 3020 MOVLW 0x20
1446 0048 00C1 MOVWF 0x41
1447 0049 0841 MOVF 0x41, W
1448 004A 00B3 MOVWF 0x33
1452 54: bool usermode = false;
1456 56: /* Configure the oscillator for the device */
1457 57: ConfigureOscillator();
1459 004F 231F CALL 0x31F
1462 59: /* Initialize I/O and Peripherals for application */
1465 0052 23CE CALL 0x3CE
1470 0055 2324 CALL 0x324
1472 63: msg_write(banner);
1474 0058 0844 MOVF 0x44, W
1475 0059 01F5 CLRF presence
1476 005A 07F5 ADDWF presence, F
1477 005B 0843 MOVF banner, W
1479 005D 07F4 ADDWF i, F
1481 005F 2613 CALL 0x613
1484 64: //msg_write(prompt);
1489 68: if (TRISAbits.TRISA2 == 1) {
1491 0063 1D0C BTFSS PORTA, 0x2
1495 69: prompt[4] = 'i';
1496 0067 3069 MOVLW 0x69
1498 0069 00C1 MOVWF 0x41
1499 006A 0841 MOVF 0x41, W
1500 006B 00B0 MOVWF 0x30
1501 70: prompt[5] = PORTAbits.RA2 ? '1':'0';
1502 006C 190C BTFSC PORTA, 0x2
1506 0070 3030 MOVLW 0x30
1508 0072 00B4 MOVWF 0x34
1512 0076 3031 MOVLW 0x31
1514 0078 00B4 MOVWF 0x34
1517 007B 0834 MOVF 0x34, W
1519 007D 00C1 MOVWF 0x41
1520 007E 0841 MOVF 0x41, W
1521 007F 00B1 MOVWF 0x31
1524 72: prompt[4] = 'o';
1525 0081 306F MOVLW 0x6F
1527 0083 00C1 MOVWF 0x41
1528 0084 0841 MOVF 0x41, W
1529 0085 00B0 MOVWF 0x30
1530 73: prompt[5] = PORTAbits.RA2 ? '1':'0';
1531 0086 190C BTFSC PORTA, 0x2
1535 008A 3030 MOVLW 0x30
1541 0090 3031 MOVLW 0x31
1548 0097 00C1 MOVWF 0x41
1549 0098 0841 MOVF 0x41, W
1550 0099 00B1 MOVWF 0x31
1554 76: if (!msg_empty()) continue;
1556 009C 2344 CALL 0x344
1559 009F 1D03 BTFSS STATUS, 0x2
1566 78: if (!msg_recvready()) continue;
1568 00A6 233A CALL 0x33A
1571 00A9 1D03 BTFSS STATUS, 0x2
1578 80: char cmd = msg_recv();
1580 00B0 2556 CALL 0x556
1583 00B3 00C1 MOVWF 0x41
1584 00B4 0841 MOVF 0x41, W
1586 00B6 00CB MOVWF 0x4B
1588 82: if (cmd == '\r' || cmd == '\n') {
1589 00B7 084B MOVF 0x4B, W
1591 00B9 1903 BTFSC STATUS, 0x2
1595 00BD 084B MOVF 0x4B, W
1597 00BF 1D03 BTFSS STATUS, 0x2
1602 83: if (usermode) msg_write("\r\n");
1603 00C4 084C MOVF 0x4C, W
1604 00C5 1D03 BTFSS STATUS, 0x2
1606 00C7 2CDC GOTO 0x4DC
1607 00C8 3059 MOVLW 0x59
1609 00CA 3086 MOVLW 0x86
1610 00CB 00F5 MOVWF presence
1612 00CD 2613 CALL 0x613
1614 00CF 2CDC GOTO 0x4DC
1616 00D0 2CDC GOTO 0x4DC
1617 85: if (cmd == 'h' || cmd == 'H') {
1619 00D2 084B MOVF 0x4B, W
1620 00D3 3A68 XORLW 0x68
1621 00D4 1903 BTFSC STATUS, 0x2
1625 00D8 084B MOVF 0x4B, W
1626 00D9 3A48 XORLW 0x48
1627 00DA 1D03 BTFSS STATUS, 0x2
1630 00DD 2951 GOTO 0x151
1632 86: msg_write(banner);
1634 00E0 0844 MOVF 0x44, W
1635 00E1 01F5 CLRF presence
1636 00E2 07F5 ADDWF presence, F
1637 00E3 0843 MOVF banner, W
1639 00E5 07F4 ADDWF i, F
1641 00E7 2613 CALL 0x613
1643 87: msg_write("\nHelp:\r\n");
1644 00E9 3070 MOVLW 0x70
1646 00EB 3088 MOVLW 0x88
1647 00EC 00F5 MOVWF presence
1649 00EE 2613 CALL 0x613
1651 88: while (!msg_empty());
1655 00F3 2344 CALL 0x344
1658 00F6 1903 BTFSC STATUS, 0x2
1663 89: msg_write("E - Enumerate the Bus\r\n");
1664 00FB 30E2 MOVLW 0xE2
1666 00FD 3087 MOVLW 0x87
1667 00FE 00F5 MOVWF presence
1669 0100 2613 CALL 0x613
1671 90: msg_write("R - Reset Bus\r\n");
1672 0102 303F MOVLW 0x3F
1674 0104 3088 MOVLW 0x88
1675 0105 00F5 MOVWF presence
1677 0107 2613 CALL 0x613
1679 91: while (!msg_empty());
1680 0109 290B GOTO 0x10B
1681 010A 290B GOTO 0x10B
1683 010C 2344 CALL 0x344
1686 010F 1903 BTFSC STATUS, 0x2
1687 0110 2912 GOTO 0x112
1688 0111 2913 GOTO 0x113
1689 0112 290B GOTO 0x10B
1690 0113 2914 GOTO 0x114
1691 92: msg_write("0,1,3 - bus to Low, High, Tristate\r\n");
1692 0114 3082 MOVLW 0x82
1694 0116 3086 MOVLW 0x86
1695 0117 00F5 MOVWF presence
1697 0119 2613 CALL 0x613
1699 93: msg_write("I - Read (one) Device ID\r\n");
1700 011B 3064 MOVLW 0x64
1702 011D 3087 MOVLW 0x87
1703 011E 00F5 MOVWF presence
1705 0120 2613 CALL 0x613
1707 94: while (!msg_empty());
1708 0122 2924 GOTO 0x124
1709 0123 2924 GOTO 0x124
1711 0125 2344 CALL 0x344
1714 0128 1903 BTFSC STATUS, 0x2
1715 0129 292B GOTO 0x12B
1716 012A 292C GOTO 0x12C
1717 012B 2924 GOTO 0x124
1718 012C 292D GOTO 0x12D
1719 95: msg_write("P - Any device parasitic powered?\r\n");
1720 012D 30A7 MOVLW 0xA7
1722 012F 3086 MOVLW 0x86
1723 0130 00F5 MOVWF presence
1725 0132 2613 CALL 0x613
1727 96: msg_write("S - Read scratchpad memory\r\n");
1728 0134 302B MOVLW 0x2B
1730 0136 3087 MOVLW 0x87
1731 0137 00F5 MOVWF presence
1733 0139 2613 CALL 0x613
1735 97: while (!msg_empty());
1736 013B 293D GOTO 0x13D
1737 013C 293D GOTO 0x13D
1739 013E 2344 CALL 0x344
1742 0141 1903 BTFSC STATUS, 0x2
1743 0142 2944 GOTO 0x144
1744 0143 2945 GOTO 0x145
1745 0144 293D GOTO 0x13D
1746 0145 2946 GOTO 0x146
1747 98: msg_write("T - read temperature of all devices\r\n");
1748 0146 305C MOVLW 0x5C
1750 0148 3086 MOVLW 0x86
1751 0149 00F5 MOVWF presence
1753 014B 2613 CALL 0x613
1755 99: usermode = true;
1758 014F 0ACC INCF 0x4C, F
1760 0150 2CDC GOTO 0x4DC
1761 101: if (cmd == 'r' || cmd == 'R') {
1762 0151 084B MOVF 0x4B, W
1763 0152 3A72 XORLW 0x72
1764 0153 1903 BTFSC STATUS, 0x2
1765 0154 2956 GOTO 0x156
1766 0155 2957 GOTO 0x157
1767 0156 295E GOTO 0x15E
1768 0157 084B MOVF 0x4B, W
1769 0158 3A52 XORLW 0x52
1770 0159 1D03 BTFSS STATUS, 0x2
1771 015A 295C GOTO 0x15C
1772 015B 295D GOTO 0x15D
1773 015C 298F GOTO 0x18F
1774 015D 295E GOTO 0x15E
1777 015F 2322 CALL 0x322
1779 103: bool present = OW_reset();
1781 0162 2437 CALL 0x437
1784 0165 00C1 MOVWF 0x41
1785 0166 0841 MOVF 0x41, W
1787 0168 00B2 MOVWF 0x32
1790 016A 2320 CALL 0x320
1792 105: if (usermode) msg_write("\r");
1794 016D 084C MOVF 0x4C, W
1795 016E 1D03 BTFSS STATUS, 0x2
1796 016F 2971 GOTO 0x171
1797 0170 2979 GOTO 0x179
1798 0171 30B2 MOVLW 0xB2
1800 0173 3088 MOVLW 0x88
1801 0174 00F5 MOVWF presence
1803 0176 2613 CALL 0x613
1805 0178 2979 GOTO 0x179
1808 017A 0832 MOVF 0x32, W
1809 017B 1D03 BTFSS STATUS, 0x2
1810 017C 297E GOTO 0x17E
1811 017D 2986 GOTO 0x186
1812 107: msg_write("RESET Device detected.\r\n");
1813 017E 307F MOVLW 0x7F
1815 0180 3087 MOVLW 0x87
1816 0181 00F5 MOVWF presence
1818 0183 2613 CALL 0x613
1820 0185 2CDC GOTO 0x4DC
1822 109: msg_write("RESET No Devices detected.\r\n");
1825 0188 3087 MOVLW 0x87
1826 0189 00F5 MOVWF presence
1828 018B 2613 CALL 0x613
1830 018D 2CDC GOTO 0x4DC
1832 018E 2CDC GOTO 0x4DC
1833 111: if (cmd == 'e' || cmd == 'E')
1835 0190 084B MOVF 0x4B, W
1836 0191 3A65 XORLW 0x65
1837 0192 1903 BTFSC STATUS, 0x2
1838 0193 2995 GOTO 0x195
1839 0194 2996 GOTO 0x196
1840 0195 299C GOTO 0x19C
1841 0196 084B MOVF 0x4B, W
1842 0197 3A45 XORLW 0x45
1843 0198 1D03 BTFSS STATUS, 0x2
1844 0199 299B GOTO 0x19B
1845 019A 299C GOTO 0x19C
1846 019B 2A25 GOTO 0x225
1848 113: char count = 0;
1850 114: if (usermode) msg_write("\r");
1851 019D 084C MOVF 0x4C, W
1852 019E 1D03 BTFSS STATUS, 0x2
1853 019F 29A1 GOTO 0x1A1
1854 01A0 29A9 GOTO 0x1A9
1855 01A1 30B2 MOVLW 0xB2
1857 01A3 3088 MOVLW 0x88
1858 01A4 00F5 MOVWF presence
1860 01A6 2613 CALL 0x613
1862 01A8 29A9 GOTO 0x1A9
1863 115: OW_search_init();
1865 01AA 248C CALL 0x48C
1867 116: while (OW_search())
1868 01AC 2A00 GOTO 0x200
1870 0201 270C CALL 0x70C
1873 0204 1D03 BTFSS STATUS, 0x2
1874 0205 2A07 GOTO 0x207
1875 0206 2A08 GOTO 0x208
1876 0207 29AD GOTO 0x1AD
1877 0208 2A09 GOTO 0x209
1880 119: if (usermode) msg_write("ENUM ");
1882 01AE 084C MOVF 0x4C, W
1883 01AF 1D03 BTFSS STATUS, 0x2
1884 01B0 29B2 GOTO 0x1B2
1885 01B1 29BA GOTO 0x1BA
1886 01B2 309D MOVLW 0x9D
1888 01B4 3088 MOVLW 0x88
1889 01B5 00F5 MOVWF presence
1891 01B7 2613 CALL 0x613
1893 01B9 29BA GOTO 0x1BA
1894 120: for (char j=0; j<8; j++) {
1898 01BD 0246 SUBWF 0x46, W
1899 01BE 1C03 BTFSS STATUS, 0x0
1900 01BF 29C1 GOTO 0x1C1
1901 01C0 29C2 GOTO 0x1C2
1902 01C1 29C4 GOTO 0x1C4
1903 01C2 29E5 GOTO 0x1E5
1904 01C3 29E5 GOTO 0x1E5
1907 01DA 00C1 MOVWF 0x41
1908 01DB 0841 MOVF 0x41, W
1910 01DD 07C6 ADDWF 0x46, F
1912 01DF 0246 SUBWF 0x46, W
1913 01E0 1C03 BTFSS STATUS, 0x0
1914 01E1 29E3 GOTO 0x1E3
1915 01E2 29E4 GOTO 0x1E4
1916 01E3 29C4 GOTO 0x1C4
1917 01E4 29E5 GOTO 0x1E5
1918 121: tohex(val, romid[j]);
1919 01C4 0846 MOVF 0x46, W
1920 01C5 3E20 ADDLW 0x20
1921 01C6 0086 MOVWF FSR1L
1922 01C7 0187 CLRF FSR1H
1923 01C8 0801 MOVF INDF1, W
1925 01CA 00C1 MOVWF 0x41
1926 01CB 0841 MOVF 0x41, W
1928 01CD 30B8 MOVLW 0xB8
1930 01CF 2659 CALL 0x659
1932 122: msg_write(val);
1933 01D1 30B8 MOVLW 0xB8
1936 01D4 00F5 MOVWF presence
1938 01D6 2613 CALL 0x613
1941 124: if (usermode) msg_write("\r\n"); else msg_write("\n");
1942 01E5 084C MOVF 0x4C, W
1943 01E6 1D03 BTFSS STATUS, 0x2
1944 01E7 29E9 GOTO 0x1E9
1945 01E8 29F1 GOTO 0x1F1
1946 01E9 3059 MOVLW 0x59
1948 01EB 3086 MOVLW 0x86
1949 01EC 00F5 MOVWF presence
1951 01EE 2613 CALL 0x613
1953 01F0 29F9 GOTO 0x1F9
1954 01F1 305A MOVLW 0x5A
1956 01F3 3086 MOVLW 0x86
1957 01F4 00F5 MOVWF presence
1959 01F6 2613 CALL 0x613
1961 01F8 29F9 GOTO 0x1F9
1965 01FB 00C1 MOVWF 0x41
1966 01FC 0841 MOVF 0x41, W
1968 01FE 07C1 ADDWF 0x41, F
1969 01FF 2A00 GOTO 0x200
1971 127: if (usermode) {
1973 020A 084C MOVF 0x4C, W
1974 020B 1D03 BTFSS STATUS, 0x2
1975 020C 2A0E GOTO 0x20E
1976 020D 2A1C GOTO 0x21C
1977 128: if (count==0) msg_write("ERROR No devices found\r\n");
1978 020E 08C1 MOVF 0x41, F
1979 020F 1D03 BTFSS STATUS, 0x2
1980 0210 2A12 GOTO 0x212
1981 0211 2A13 GOTO 0x213
1982 0212 2CDC GOTO 0x4DC
1983 0213 3098 MOVLW 0x98
1985 0215 3087 MOVLW 0x87
1986 0216 00F5 MOVWF presence
1988 0218 2613 CALL 0x613
1990 021A 2CDC GOTO 0x4DC
1992 021B 2CDC GOTO 0x4DC
1993 130: msg_write("END\n");
1994 021C 30A3 MOVLW 0xA3
1996 021E 3088 MOVLW 0x88
1997 021F 00F5 MOVWF presence
1999 0221 2613 CALL 0x613
2001 0223 2CDC GOTO 0x4DC
2004 0224 2CDC GOTO 0x4DC
2005 133: if (cmd == 'i' || cmd == 'I') {
2007 0226 084B MOVF 0x4B, W
2008 0227 3A69 XORLW 0x69
2009 0228 1903 BTFSC STATUS, 0x2
2010 0229 2A2B GOTO 0x22B
2011 022A 2A2C GOTO 0x22C
2012 022B 2A33 GOTO 0x233
2013 022C 084B MOVF 0x4B, W
2014 022D 3A49 XORLW 0x49
2015 022E 1D03 BTFSS STATUS, 0x2
2016 022F 2A31 GOTO 0x231
2017 0230 2A32 GOTO 0x232
2018 0231 2A83 GOTO 0x283
2019 0232 2A33 GOTO 0x233
2022 0234 2592 CALL 0x592
2025 136: if (usermode) msg_write("\rID ");
2027 0237 084C MOVF 0x4C, W
2028 0238 1D03 BTFSS STATUS, 0x2
2029 0239 2A3B GOTO 0x23B
2030 023A 2A43 GOTO 0x243
2031 023B 30AD MOVLW 0xAD
2033 023D 3088 MOVLW 0x88
2034 023E 00F5 MOVWF presence
2036 0240 2613 CALL 0x613
2038 0242 2A43 GOTO 0x243
2039 137: for (char j=0; j<8; j++) {
2043 0246 0247 SUBWF 0x47, W
2044 0247 1C03 BTFSS STATUS, 0x0
2045 0248 2A4A GOTO 0x24A
2046 0249 2A4B GOTO 0x24B
2047 024A 2A4D GOTO 0x24D
2048 024B 2A6E GOTO 0x26E
2049 024C 2A6E GOTO 0x26E
2052 0263 00C1 MOVWF 0x41
2053 0264 0841 MOVF 0x41, W
2055 0266 07C7 ADDWF 0x47, F
2057 0268 0247 SUBWF 0x47, W
2058 0269 1C03 BTFSS STATUS, 0x0
2059 026A 2A6C GOTO 0x26C
2060 026B 2A6D GOTO 0x26D
2061 026C 2A4D GOTO 0x24D
2062 026D 2A6E GOTO 0x26E
2063 138: tohex(val, romid[j]);
2064 024D 0847 MOVF 0x47, W
2065 024E 3E20 ADDLW 0x20
2066 024F 0086 MOVWF FSR1L
2067 0250 0187 CLRF FSR1H
2068 0251 0801 MOVF INDF1, W
2070 0253 00C1 MOVWF 0x41
2071 0254 0841 MOVF 0x41, W
2073 0256 30BB MOVLW 0xBB
2075 0258 2659 CALL 0x659
2077 139: msg_write(val);
2078 025A 30BB MOVLW 0xBB
2081 025D 00F5 MOVWF presence
2083 025F 2613 CALL 0x613
2086 141: if (usermode) msg_write("\r\n"); else msg_write("\n");
2087 026E 084C MOVF 0x4C, W
2088 026F 1D03 BTFSS STATUS, 0x2
2089 0270 2A72 GOTO 0x272
2090 0271 2A7A GOTO 0x27A
2091 0272 3059 MOVLW 0x59
2093 0274 3086 MOVLW 0x86
2094 0275 00F5 MOVWF presence
2096 0277 2613 CALL 0x613
2098 0279 2CDC GOTO 0x4DC
2099 027A 305A MOVLW 0x5A
2101 027C 3086 MOVLW 0x86
2102 027D 00F5 MOVWF presence
2104 027F 2613 CALL 0x613
2106 0281 2CDC GOTO 0x4DC
2108 0282 2CDC GOTO 0x4DC
2109 143: if (cmd == 'p' || cmd == 'P') {
2111 0284 084B MOVF 0x4B, W
2112 0285 3A70 XORLW 0x70
2113 0286 1903 BTFSC STATUS, 0x2
2114 0287 2A89 GOTO 0x289
2115 0288 2A8A GOTO 0x28A
2116 0289 2A91 GOTO 0x291
2117 028A 084B MOVF 0x4B, W
2118 028B 3A50 XORLW 0x50
2119 028C 1D03 BTFSS STATUS, 0x2
2120 028D 2A8F GOTO 0x28F
2121 028E 2A90 GOTO 0x290
2122 028F 2AD5 GOTO 0x2D5
2123 0290 2A91 GOTO 0x291
2124 144: if (usermode) msg_write("\r");
2125 0291 084C MOVF 0x4C, W
2126 0292 1D03 BTFSS STATUS, 0x2
2127 0293 2A95 GOTO 0x295
2128 0294 2A9D GOTO 0x29D
2129 0295 30B2 MOVLW 0xB2
2131 0297 3088 MOVLW 0x88
2132 0298 00F5 MOVWF presence
2134 029A 2613 CALL 0x613
2136 029C 2A9D GOTO 0x29D
2137 145: bool para = OW_parasite();
2139 029E 23AE CALL 0x3AE
2142 02A1 00C1 MOVWF 0x41
2143 02A2 0841 MOVF 0x41, W
2145 02A4 00C2 MOVWF 0x42
2146 146: if (usermode) {
2147 02A5 084C MOVF 0x4C, W
2148 02A6 1D03 BTFSS STATUS, 0x2
2149 02A7 2AA9 GOTO 0x2A9
2150 02A8 2ABE GOTO 0x2BE
2152 02A9 0842 MOVF 0x42, W
2153 02AA 1D03 BTFSS STATUS, 0x2
2154 02AB 2AAD GOTO 0x2AD
2155 02AC 2AB5 GOTO 0x2B5
2156 148: msg_write("PARA A Device is parasite powered\r\n");
2157 02AD 30CB MOVLW 0xCB
2159 02AF 3086 MOVLW 0x86
2160 02B0 00F5 MOVWF presence
2162 02B2 2613 CALL 0x613
2164 02B4 2CDC GOTO 0x4DC
2166 150: msg_write("PARA No Device is parasite powered.\r\n");
2167 02B5 3036 MOVLW 0x36
2169 02B7 3086 MOVLW 0x86
2170 02B8 00F5 MOVWF presence
2172 02BA 2613 CALL 0x613
2174 02BC 2CDC GOTO 0x4DC
2176 02BD 2CDC GOTO 0x4DC
2177 152: if (para) msg_write("PARA\n"); else msg_write("DIRECT\n");
2179 02BF 0842 MOVF 0x42, W
2180 02C0 1D03 BTFSS STATUS, 0x2
2181 02C1 2AC3 GOTO 0x2C3
2182 02C2 2ACB GOTO 0x2CB
2183 02C3 3091 MOVLW 0x91
2185 02C5 3088 MOVLW 0x88
2186 02C6 00F5 MOVWF presence
2188 02C8 2613 CALL 0x613
2190 02CA 2CDC GOTO 0x4DC
2191 02CB 3082 MOVLW 0x82
2193 02CD 3088 MOVLW 0x88
2194 02CE 00F5 MOVWF presence
2196 02D0 2613 CALL 0x613
2198 02D2 2CDC GOTO 0x4DC
2199 02D3 2CDC GOTO 0x4DC
2202 02D4 2CDC GOTO 0x4DC
2203 155: if (cmd == 's' || cmd =='S') {
2205 02D6 084B MOVF 0x4B, W
2206 02D7 3A73 XORLW 0x73
2207 02D8 1903 BTFSC STATUS, 0x2
2208 02D9 2ADB GOTO 0x2DB
2209 02DA 2ADC GOTO 0x2DC
2210 02DB 2AE2 GOTO 0x2E2
2211 02DC 084B MOVF 0x4B, W
2212 02DD 3A53 XORLW 0x53
2213 02DE 1D03 BTFSS STATUS, 0x2
2214 02DF 2AE1 GOTO 0x2E1
2215 02E0 2AE2 GOTO 0x2E2
2216 02E1 2B44 GOTO 0x344
2217 156: uint8_t scratch[9];
2218 157: romid[0] = 0; // select all devices
2220 02E3 01A0 CLRF romid
2221 158: OW_read_block(0xBE, scratch, 9);
2222 02E4 30A0 MOVLW 0xA0
2223 02E5 00C1 MOVWF 0x41
2224 02E6 0841 MOVF 0x41, W
2225 02E7 00BA MOVWF search_result
2227 02E9 00C2 MOVWF 0x42
2228 02EA 0842 MOVF 0x42, W
2229 02EB 00BB MOVWF id_bit
2230 02EC 30BE MOVLW 0xBE
2232 02EE 251A CALL 0x51A
2234 159: if (usermode) msg_write("\rSCRATCH");
2236 02F1 084C MOVF 0x4C, W
2237 02F2 1D03 BTFSS STATUS, 0x2
2238 02F3 2AF5 GOTO 0x2F5
2239 02F4 2AFD GOTO 0x2FD
2240 02F5 3079 MOVLW 0x79
2242 02F7 3088 MOVLW 0x88
2243 02F8 00F5 MOVWF presence
2245 02FA 2613 CALL 0x613
2247 02FC 2AFD GOTO 0x2FD
2248 160: for (char j=0; j<9; j++) {
2252 0300 0248 SUBWF 0x48, W
2253 0301 1C03 BTFSS STATUS, 0x0
2254 0302 2B04 GOTO 0x304
2255 0303 2B05 GOTO 0x305
2256 0304 2B07 GOTO 0x307
2257 0305 2B2F GOTO 0x32F
2258 0306 2B2F GOTO 0x32F
2261 0324 00C1 MOVWF 0x41
2262 0325 0841 MOVF 0x41, W
2264 0327 07C8 ADDWF 0x48, F
2266 0329 0248 SUBWF 0x48, W
2267 032A 1C03 BTFSS STATUS, 0x0
2268 032B 2B2D GOTO 0x32D
2269 032C 2B2E GOTO 0x32E
2270 032D 2B07 GOTO 0x307
2271 032E 2B2F GOTO 0x32F
2273 162: tohex(val, scratch[j]);
2274 0307 0848 MOVF 0x48, W
2275 0308 3EA0 ADDLW 0xA0
2276 0309 0086 MOVWF FSR1L
2277 030A 0187 CLRF FSR1H
2278 030B 0801 MOVF INDF1, W
2280 030D 00C1 MOVWF 0x41
2281 030E 0841 MOVF 0x41, W
2283 0310 30BE MOVLW 0xBE
2285 0312 2659 CALL 0x659
2287 163: msg_write(" ");
2288 0314 30B0 MOVLW 0xB0
2290 0316 3088 MOVLW 0x88
2291 0317 00F5 MOVWF presence
2293 0319 2613 CALL 0x613
2295 164: msg_write(val);
2296 031B 30BE MOVLW 0xBE
2299 031E 00F5 MOVWF presence
2301 0320 2613 CALL 0x613
2304 166: if (usermode) msg_write("\r\n"); else msg_write("\n");
2305 032F 084C MOVF 0x4C, W
2306 0330 1D03 BTFSS STATUS, 0x2
2307 0331 2B33 GOTO 0x333
2308 0332 2B3B GOTO 0x33B
2309 0333 3059 MOVLW 0x59
2311 0335 3086 MOVLW 0x86
2312 0336 00F5 MOVWF presence
2314 0338 2613 CALL 0x613
2316 033A 2CDC GOTO 0x4DC
2317 033B 305A MOVLW 0x5A
2319 033D 3086 MOVLW 0x86
2320 033E 00F5 MOVWF presence
2322 0340 2613 CALL 0x613
2324 0342 2CDC GOTO 0x4DC
2326 0343 2CDC GOTO 0x4DC
2327 168: if (cmd == 't' || cmd == 'T') {
2329 0345 084B MOVF 0x4B, W
2330 0346 3A74 XORLW 0x74
2331 0347 1903 BTFSC STATUS, 0x2
2332 0348 2B4A GOTO 0x34A
2333 0349 2B4B GOTO 0x34B
2334 034A 2B52 GOTO 0x352
2335 034B 084B MOVF 0x4B, W
2336 034C 3A54 XORLW 0x54
2337 034D 1D03 BTFSS STATUS, 0x2
2338 034E 2B50 GOTO 0x350
2339 034F 2B51 GOTO 0x351
2340 0350 2C10 GOTO 0x410
2341 0351 2B52 GOTO 0x352
2343 170: uint8_t scratch[9];
2345 172: // oddly, cant do a mass-convert with parasitic
2346 173: // they seem to all reset when you try
2348 175: // now step through every unit and read the value
2349 176: OW_search_init();
2351 0353 248C CALL 0x48C
2353 177: while (OW_search())
2354 0355 2BF8 GOTO 0x3F8
2356 03F9 270C CALL 0x70C
2359 03FC 1D03 BTFSS STATUS, 0x2
2360 03FD 2BFF GOTO 0x3FF
2361 03FE 2C00 GOTO 0x400
2362 03FF 2B56 GOTO 0x356
2363 0400 2C01 GOTO 0x401
2365 179: // ask device to do conversion
2368 0357 26A0 CALL 0x6A0
2371 182: // empty the scratch pad
2372 183: for (char j=0; j<9; j++) scratch[j]=0;
2376 035C 0249 SUBWF 0x49, W
2377 035D 1C03 BTFSS STATUS, 0x0
2378 035E 2B60 GOTO 0x360
2379 035F 2B61 GOTO 0x361
2380 0360 2B63 GOTO 0x363
2381 0361 2B75 GOTO 0x375
2382 0362 2B75 GOTO 0x375
2383 0363 0849 MOVF 0x49, W
2384 0364 3EA9 ADDLW 0xA9
2385 0365 0086 MOVWF FSR1L
2386 0366 0187 CLRF FSR1H
2387 0367 0181 CLRF INDF1
2390 036A 00C1 MOVWF 0x41
2391 036B 0841 MOVF 0x41, W
2393 036D 07C9 ADDWF 0x49, F
2395 036F 0249 SUBWF 0x49, W
2396 0370 1C03 BTFSS STATUS, 0x0
2397 0371 2B73 GOTO 0x373
2398 0372 2B74 GOTO 0x374
2399 0373 2B63 GOTO 0x363
2400 0374 2B75 GOTO 0x375
2402 185: // read this devices scratch pad
2403 186: OW_read_block(0xBE, scratch, 9);
2404 0375 30A9 MOVLW 0xA9
2406 0377 00C1 MOVWF 0x41
2407 0378 0841 MOVF 0x41, W
2408 0379 00BA MOVWF search_result
2410 037B 00C2 MOVWF 0x42
2411 037C 0842 MOVF 0x42, W
2412 037D 00BB MOVWF id_bit
2413 037E 30BE MOVLW 0xBE
2415 0380 251A CALL 0x51A
2418 188: // print rom id and temperature
2419 189: if (usermode) msg_write("\rTEMP ");
2421 0383 084C MOVF 0x4C, W
2422 0384 1D03 BTFSS STATUS, 0x2
2423 0385 2B87 GOTO 0x387
2424 0386 2B8F GOTO 0x38F
2425 0387 308A MOVLW 0x8A
2427 0389 3088 MOVLW 0x88
2428 038A 00F5 MOVWF presence
2430 038C 2613 CALL 0x613
2432 038E 2B8F GOTO 0x38F
2433 190: for (char j=0;j<8;j++) {
2437 0392 024A SUBWF 0x4A, W
2438 0393 1C03 BTFSS STATUS, 0x0
2439 0394 2B96 GOTO 0x396
2440 0395 2B97 GOTO 0x397
2441 0396 2B99 GOTO 0x399
2442 0397 2BBA GOTO 0x3BA
2443 0398 2BBA GOTO 0x3BA
2446 03AF 00C1 MOVWF 0x41
2447 03B0 0841 MOVF 0x41, W
2449 03B2 07CA ADDWF 0x4A, F
2451 03B4 024A SUBWF 0x4A, W
2452 03B5 1C03 BTFSS STATUS, 0x0
2453 03B6 2BB8 GOTO 0x3B8
2454 03B7 2BB9 GOTO 0x3B9
2455 03B8 2B99 GOTO 0x399
2456 03B9 2BBA GOTO 0x3BA
2457 191: tohex(val, romid[j]);
2458 0399 084A MOVF 0x4A, W
2459 039A 3E20 ADDLW 0x20
2460 039B 0086 MOVWF FSR1L
2461 039C 0187 CLRF FSR1H
2462 039D 0801 MOVF INDF1, W
2464 039F 00C1 MOVWF 0x41
2465 03A0 0841 MOVF 0x41, W
2467 03A2 30C3 MOVLW 0xC3
2469 03A4 2659 CALL 0x659
2471 192: msg_write(val);
2472 03A6 30C3 MOVLW 0xC3
2475 03A9 00F5 MOVWF presence
2477 03AB 2613 CALL 0x613
2480 194: msg_write(" ");
2481 03BA 30B0 MOVLW 0xB0
2483 03BC 3088 MOVLW 0x88
2484 03BD 00F5 MOVWF presence
2486 03BF 2613 CALL 0x613
2488 195: tohex(val, scratch[1]);
2490 03C2 082A MOVF LastFamilyDiscrepancy, W
2492 03C4 00C1 MOVWF 0x41
2493 03C5 0841 MOVF 0x41, W
2495 03C7 30C3 MOVLW 0xC3
2497 03C9 2659 CALL 0x659
2499 196: msg_write(val);
2500 03CB 30C3 MOVLW 0xC3
2503 03CE 00F5 MOVWF presence
2505 03D0 2613 CALL 0x613
2507 197: tohex(val, scratch[0]);
2509 03D3 0829 MOVF LastDiscrepancy, W
2511 03D5 00C1 MOVWF 0x41
2512 03D6 0841 MOVF 0x41, W
2514 03D8 30C3 MOVLW 0xC3
2516 03DA 2659 CALL 0x659
2518 198: msg_write(val);
2519 03DC 30C3 MOVLW 0xC3
2522 03DF 00F5 MOVWF presence
2524 03E1 2613 CALL 0x613
2526 199: if (usermode) msg_write("\r\n"); else msg_write("\n");
2528 03E4 084C MOVF 0x4C, W
2529 03E5 1D03 BTFSS STATUS, 0x2
2530 03E6 2BE8 GOTO 0x3E8
2531 03E7 2BF0 GOTO 0x3F0
2532 03E8 3059 MOVLW 0x59
2534 03EA 3086 MOVLW 0x86
2535 03EB 00F5 MOVWF presence
2537 03ED 2613 CALL 0x613
2539 03EF 2BF8 GOTO 0x3F8
2540 03F0 305A MOVLW 0x5A
2542 03F2 3086 MOVLW 0x86
2543 03F3 00F5 MOVWF presence
2545 03F5 2613 CALL 0x613
2547 03F7 2BF8 GOTO 0x3F8
2550 202: if (!usermode) msg_write("END\n");
2552 0402 08CC MOVF 0x4C, F
2553 0403 1D03 BTFSS STATUS, 0x2
2554 0404 2C06 GOTO 0x406
2555 0405 2C07 GOTO 0x407
2556 0406 2CDC GOTO 0x4DC
2557 0407 30A3 MOVLW 0xA3
2559 0409 3088 MOVLW 0x88
2560 040A 00F5 MOVWF presence
2562 040C 2613 CALL 0x613
2564 040E 2CDC GOTO 0x4DC
2567 040F 2CDC GOTO 0x4DC
2568 205: if (cmd == '0')
2570 0411 084B MOVF 0x4B, W
2571 0412 3A30 XORLW 0x30
2572 0413 1D03 BTFSS STATUS, 0x2
2573 0414 2C16 GOTO 0x416
2574 0415 2C17 GOTO 0x417
2575 0416 2C30 GOTO 0x430
2577 207: drive_OW_low();
2579 0418 232D CALL 0x32D
2583 041B 084C MOVF 0x4C, W
2584 041C 1D03 BTFSS STATUS, 0x2
2585 041D 2C1F GOTO 0x41F
2586 041E 2C27 GOTO 0x427
2587 209: msg_write("\rBUS 1-Wire set low\r\n");
2588 041F 3029 MOVLW 0x29
2590 0421 3088 MOVLW 0x88
2591 0422 00F5 MOVWF presence
2593 0424 2613 CALL 0x613
2595 0426 2CDC GOTO 0x4DC
2597 211: msg_write("LOW\n");
2598 0427 30A8 MOVLW 0xA8
2600 0429 3088 MOVLW 0x88
2601 042A 00F5 MOVWF presence
2603 042C 2613 CALL 0x613
2605 042E 2CDC GOTO 0x4DC
2607 042F 2CDC GOTO 0x4DC
2608 213: if (cmd == '1')
2610 0431 084B MOVF 0x4B, W
2611 0432 3A31 XORLW 0x31
2612 0433 1D03 BTFSS STATUS, 0x2
2613 0434 2C36 GOTO 0x436
2614 0435 2C37 GOTO 0x437
2615 0436 2C50 GOTO 0x450
2617 215: drive_OW_high();
2619 0438 2328 CALL 0x328
2623 043B 084C MOVF 0x4C, W
2624 043C 1D03 BTFSS STATUS, 0x2
2625 043D 2C3F GOTO 0x43F
2626 043E 2C47 GOTO 0x447
2627 217: msg_write("\rBUS 1-wire set high\r\n");
2628 043F 3012 MOVLW 0x12
2630 0441 3088 MOVLW 0x88
2631 0442 00F5 MOVWF presence
2633 0444 2613 CALL 0x613
2635 0446 2CDC GOTO 0x4DC
2637 219: msg_write("HIGH\n");
2638 0447 3097 MOVLW 0x97
2640 0449 3088 MOVLW 0x88
2641 044A 00F5 MOVWF presence
2643 044C 2613 CALL 0x613
2645 044E 2CDC GOTO 0x4DC
2647 044F 2CDC GOTO 0x4DC
2648 221: if (cmd == '3')
2650 0451 084B MOVF 0x4B, W
2651 0452 3A33 XORLW 0x33
2652 0453 1D03 BTFSS STATUS, 0x2
2653 0454 2C56 GOTO 0x456
2654 0455 2C57 GOTO 0x457
2655 0456 2C70 GOTO 0x470
2659 0458 24FD CALL 0x4FD
2663 045B 084C MOVF 0x4C, W
2664 045C 1D03 BTFSS STATUS, 0x2
2665 045D 2C5F GOTO 0x45F
2666 045E 2C67 GOTO 0x467
2667 225: msg_write("\rBUS 1-wire set to tri-state\r\n");
2668 045F 30EF MOVLW 0xEF
2670 0461 3086 MOVLW 0x86
2671 0462 00F5 MOVWF presence
2673 0464 2613 CALL 0x613
2675 0466 2CDC GOTO 0x4DC
2677 227: msg_write("TRISTATE\n");
2678 0467 3066 MOVLW 0x66
2680 0469 3088 MOVLW 0x88
2681 046A 00F5 MOVWF presence
2683 046C 2613 CALL 0x613
2685 046E 2CDC GOTO 0x4DC
2687 046F 2CDC GOTO 0x4DC
2688 229: if (cmd == '?')
2690 0471 084B MOVF 0x4B, W
2691 0472 3A3F XORLW 0x3F
2692 0473 1D03 BTFSS STATUS, 0x2
2693 0474 2C76 GOTO 0x476
2694 0475 2C77 GOTO 0x477
2695 0476 2CAF GOTO 0x4AF
2697 231: bool line = read_OW();
2699 0478 2332 CALL 0x332
2702 047B 00C1 MOVWF 0x41
2703 047C 0841 MOVF 0x41, W
2705 047E 00B3 MOVWF 0x33
2707 047F 0833 MOVF 0x33, W
2708 0480 1D03 BTFSS STATUS, 0x2
2709 0481 2C83 GOTO 0x483
2710 0482 2C98 GOTO 0x498
2711 233: if (usermode) msg_write("\rBUS HIGH\r\n");
2712 0483 084C MOVF 0x4C, W
2713 0484 1D03 BTFSS STATUS, 0x2
2714 0485 2C87 GOTO 0x487
2715 0486 2C8F GOTO 0x48F
2716 0487 304F MOVLW 0x4F
2718 0489 3088 MOVLW 0x88
2719 048A 00F5 MOVWF presence
2721 048C 2613 CALL 0x613
2723 048E 2CDC GOTO 0x4DC
2725 235: msg_write("HIGH\n");
2726 048F 3097 MOVLW 0x97
2728 0491 3088 MOVLW 0x88
2729 0492 00F5 MOVWF presence
2731 0494 2613 CALL 0x613
2733 0496 2CDC GOTO 0x4DC
2735 0497 2CDC GOTO 0x4DC
2736 237: if (usermode) msg_write("\rBUS LOW\r\n");
2738 0499 084C MOVF 0x4C, W
2739 049A 1D03 BTFSS STATUS, 0x2
2740 049B 2C9D GOTO 0x49D
2741 049C 2CA5 GOTO 0x4A5
2742 049D 305B MOVLW 0x5B
2744 049F 3088 MOVLW 0x88
2745 04A0 00F5 MOVWF presence
2747 04A2 2613 CALL 0x613
2749 04A4 2CDC GOTO 0x4DC
2750 238: else msg_write("LOW\n");
2751 04A5 30A8 MOVLW 0xA8
2753 04A7 3088 MOVLW 0x88
2754 04A8 00F5 MOVWF presence
2756 04AA 2613 CALL 0x613
2758 04AC 2CDC GOTO 0x4DC
2759 04AD 2CDC GOTO 0x4DC
2762 04AE 2CDC GOTO 0x4DC
2764 242: if (usermode) {
2766 04B0 084C MOVF 0x4C, W
2767 04B1 1D03 BTFSS STATUS, 0x2
2768 04B2 2CB4 GOTO 0x4B4
2769 04B3 2CBC GOTO 0x4BC
2770 243: msg_write("ERROR Press H for Help\n");
2771 04B4 30FA MOVLW 0xFA
2773 04B6 3087 MOVLW 0x87
2774 04B7 00F5 MOVWF presence
2776 04B9 2613 CALL 0x613
2779 04BB 2CDC GOTO 0x4DC
2780 245: msg_write("\rERROR Unknown command '");
2781 04BC 30B1 MOVLW 0xB1
2783 04BE 3087 MOVLW 0x87
2784 04BF 00F5 MOVWF presence
2786 04C1 2613 CALL 0x613
2788 246: msg_writebyte(cmd);
2790 04C4 084B MOVF 0x4B, W
2792 04C6 25CF CALL 0x5CF
2794 247: msg_write("' Press 'H' for help.\r\n");
2795 04C8 30CA MOVLW 0xCA
2797 04CA 3087 MOVLW 0x87
2798 04CB 00F5 MOVWF presence
2800 04CD 2613 CALL 0x613
2802 04CF 2CDC GOTO 0x4DC
2804 04D0 2CDC GOTO 0x4DC
2806 04D1 2CDC GOTO 0x4DC
2807 04D2 2CDC GOTO 0x4DC
2808 04D3 2CDC GOTO 0x4DC
2809 04D4 2CDC GOTO 0x4DC
2810 04D5 2CDC GOTO 0x4DC
2811 04D6 2CDC GOTO 0x4DC
2812 04D7 2CDC GOTO 0x4DC
2813 04D8 2CDC GOTO 0x4DC
2814 04D9 2CDC GOTO 0x4DC
2815 04DA 2CDC GOTO 0x4DC
2816 04DB 2CDC GOTO 0x4DC
2818 251: if (usermode) msg_write(prompt);
2820 04DD 084C MOVF 0x4C, W
2821 04DE 1D03 BTFSS STATUS, 0x2
2822 04DF 2CE1 GOTO 0x4E1
2824 04E1 302C MOVLW 0x2C
2827 04E4 00F5 MOVWF presence
2829 04E6 2613 CALL 0x613
2837 255: /* make a hex string from a value
2838 256: * expect 3 char array */
2839 257: void tohex(char val[], char i)
2843 259: char bt = i >> 4;
2847 0E5E 36B5 LSRF in, F
2848 0E5F 0B89 DECFSZ WREG, F
2849 0E60 2E5E GOTO 0x65E
2850 0E61 0835 MOVF in, W
2856 0E66 0238 SUBWF bt, W
2857 0E67 1C03 BTFSS STATUS, 0x0
2858 0E68 2E6A GOTO 0x66A
2859 0E69 2E6B GOTO 0x66B
2860 0E6A 2E74 GOTO 0x674
2861 261: val[0] = 'A' + (bt - 10);
2862 0E6B 0838 MOVF bt, W
2863 0E6C 3E37 ADDLW 0x37
2866 0E6F 0086 MOVWF FSR1L
2867 0E70 0187 CLRF FSR1H
2868 0E71 0835 MOVF in, W
2869 0E72 0081 MOVWF INDF1
2870 0E73 2E7D GOTO 0x67D
2872 263: val[0] = '0' + bt;
2873 0E74 0838 MOVF bt, W
2874 0E75 3E30 ADDLW 0x30
2877 0E78 0086 MOVWF FSR1L
2878 0E79 0187 CLRF FSR1H
2879 0E7A 0835 MOVF in, W
2880 0E7B 0081 MOVWF INDF1
2881 0E7C 2E7D GOTO 0x67D
2886 0E80 0835 MOVF in, W
2890 0E83 0238 SUBWF bt, W
2891 0E84 1C03 BTFSS STATUS, 0x0
2892 0E85 2E87 GOTO 0x687
2893 0E86 2E88 GOTO 0x688
2894 0E87 2E91 GOTO 0x691
2895 266: val[1] = 'A' + (bt - 10);
2896 0E88 0838 MOVF bt, W
2897 0E89 3E37 ADDLW 0x37
2900 0E8C 0086 MOVWF FSR1L
2901 0E8D 0187 CLRF FSR1H
2902 0E8E 0835 MOVF in, W
2903 0E8F 0081 MOVWF INDF1
2904 0E90 2E9A GOTO 0x69A
2906 268: val[1] = '0' + bt;
2907 0E91 0838 MOVF bt, W
2908 0E92 3E30 ADDLW 0x30
2911 0E95 0086 MOVWF FSR1L
2912 0E96 0187 CLRF FSR1H
2913 0E97 0835 MOVF in, W
2914 0E98 0081 MOVWF INDF1
2915 0E99 2E9A GOTO 0x69A
2919 0E9C 0086 MOVWF FSR1L
2920 0E9D 0187 CLRF FSR1H
2921 0E9E 0181 CLRF INDF1
2926 273: /* is the queue empty yet */
2927 274: bool msg_empty(void)
2929 276: if (outp == 0) return 1;
2930 0B44 0877 MOVF 0x77, W
2931 0B45 0476 IORWF outp, W
2932 0B46 1D03 BTFSS STATUS, 0x2
2933 0B47 2B49 GOTO 0x349
2934 0B48 2B4A GOTO 0x34A
2935 0B49 2B4D GOTO 0x34D
2937 0B4B 2B4F GOTO 0x34F
2938 0B4C 2B4F GOTO 0x34F
2941 0B4E 2B4F GOTO 0x34F
2945 280: /* new message in the queue */
2946 281: void msg_write(const char *msg)
2948 283: char * p = outbuff + outlen;
2949 0E13 0879 MOVF outlen, W
2950 0E14 3E8C ADDLW 0x8C
2954 0E18 3020 MOVLW 0x20
2955 0E19 3DB7 ADDWFC i, F
2956 284: while (outlen < sizeof(outbuff) && *msg != 0) {
2957 0E1A 2E34 GOTO 0x634
2958 0E34 3064 MOVLW 0x64
2959 0E35 0279 SUBWF outlen, W
2960 0E36 1803 BTFSC STATUS, 0x0
2961 0E37 2E39 GOTO 0x639
2962 0E38 2E3A GOTO 0x63A
2963 0E39 2E46 GOTO 0x646
2965 0E3B 0084 MOVWF FSR0L
2966 0E3C 0875 MOVF presence, W
2967 0E3D 0085 MOVWF FSR0H
2968 0E3E 0800 MOVF INDF0, W
2970 0E40 1D03 BTFSS STATUS, 0x2
2971 0E41 2E43 GOTO 0x643
2972 0E42 2E44 GOTO 0x644
2973 0E43 2E1B GOTO 0x61B
2974 0E44 2E46 GOTO 0x646
2975 0E45 2E46 GOTO 0x646
2976 285: *(p++) = *(msg++);
2978 0E1C 0084 MOVWF FSR0L
2979 0E1D 0875 MOVF presence, W
2980 0E1E 0085 MOVWF FSR0H
2981 0E1F 0800 MOVF INDF0, W
2984 0E22 0086 MOVWF FSR1L
2986 0E24 0087 MOVWF FSR1H
2987 0E25 0835 MOVF in, W
2988 0E26 0081 MOVWF INDF1
2990 0E28 07F4 ADDWF i, F
2992 0E2A 3DF5 ADDWFC presence, F
2994 0E2C 07B6 ADDWF p, F
2996 0E2E 3DB7 ADDWFC i, F
3000 0E31 0835 MOVF in, W
3001 0E32 07F9 ADDWF outlen, F
3002 0E33 2E34 GOTO 0x634
3006 0E47 0086 MOVWF FSR1L
3008 0E49 0087 MOVWF FSR1H
3009 0E4A 0181 CLRF INDF1
3010 289: if (outp == 0) {
3011 0E4B 0877 MOVF 0x77, W
3012 0E4C 0476 IORWF outp, W
3013 0E4D 1D03 BTFSS STATUS, 0x2
3014 0E4E 2E50 GOTO 0x650
3015 0E4F 2E51 GOTO 0x651
3016 0E50 2E58 GOTO 0x658
3017 290: outp = outbuff;
3018 0E51 308C MOVLW 0x8C
3019 0E52 00F6 MOVWF outp
3020 0E53 3020 MOVLW 0x20
3021 0E54 00F7 MOVWF 0x77
3022 291: PIE1bits.TXIE = 1;
3024 0E56 1611 BSF PIR1, 0x4
3025 0E57 2E58 GOTO 0x658
3030 295: void msg_writebyte(const char msg)
3033 297: if (outlen+1 >= (uint8_t)sizeof(outbuff)) return;
3034 0DD0 0879 MOVF outlen, W
3039 0DD5 1803 BTFSC STATUS, 0x0
3043 0DD9 3A80 XORLW 0x80
3044 0DDA 00FF MOVWF 0x7F
3045 0DDB 3080 MOVLW 0x80
3046 0DDC 027F SUBWF 0x7F, W
3047 0DDD 1D03 BTFSS STATUS, 0x2
3048 0DDE 2DE1 GOTO 0x5E1
3049 0DDF 3064 MOVLW 0x64
3050 0DE0 0235 SUBWF in, W
3051 0DE1 1C03 BTFSS STATUS, 0x0
3052 0DE2 2DE4 GOTO 0x5E4
3053 0DE3 2DE5 GOTO 0x5E5
3054 0DE4 2DE7 GOTO 0x5E7
3055 0DE5 2E12 GOTO 0x612
3056 0DE6 2E12 GOTO 0x612
3057 298: outbuff[outlen++] = msg;
3061 0DEA 0879 MOVF outlen, W
3062 0DEB 3E8C ADDLW 0x8C
3065 0DEE 3020 MOVLW 0x20
3066 0DEF 3DB7 ADDWFC i, F
3068 0DF1 0086 MOVWF FSR1L
3070 0DF3 0087 MOVWF FSR1H
3071 0DF4 0835 MOVF in, W
3072 0DF5 0081 MOVWF INDF1
3075 0DF8 0835 MOVF in, W
3076 0DF9 07F9 ADDWF outlen, F
3077 299: outbuff[outlen] = 0;
3078 0DFA 0879 MOVF outlen, W
3079 0DFB 3E8C ADDLW 0x8C
3082 0DFE 3020 MOVLW 0x20
3083 0DFF 3DB6 ADDWFC p, F
3084 0E00 0835 MOVF in, W
3085 0E01 0086 MOVWF FSR1L
3087 0E03 0087 MOVWF FSR1H
3088 0E04 0181 CLRF INDF1
3089 300: if (outp == 0) {
3090 0E05 0877 MOVF 0x77, W
3091 0E06 0476 IORWF outp, W
3092 0E07 1D03 BTFSS STATUS, 0x2
3093 0E08 2E0A GOTO 0x60A
3094 0E09 2E0B GOTO 0x60B
3095 0E0A 2E12 GOTO 0x612
3096 301: outp = outbuff;
3097 0E0B 308C MOVLW 0x8C
3098 0E0C 00F6 MOVWF outp
3099 0E0D 3020 MOVLW 0x20
3100 0E0E 00F7 MOVWF 0x77
3101 302: PIE1bits.TXIE = 1;
3103 0E10 1611 BSF PIR1, 0x4
3104 0E11 2E12 GOTO 0x612
3109 306: void putch(char data)
3111 308: msg_writebyte(data);
3114 311: /* called from interrupt routine to send next char */
3115 312: void msg_sendnext(void)
3117 314: /* we have finished, turn off the iterrupt */
3118 315: if (outp == 0 || *outp == 0) {
3119 0BEF 0877 MOVF 0x77, W
3120 0BF0 0476 IORWF outp, W
3121 0BF1 1903 BTFSC STATUS, 0x2
3122 0BF2 2BF4 GOTO 0x3F4
3123 0BF3 2BF5 GOTO 0x3F5
3124 0BF4 2BFE GOTO 0x3FE
3125 0BF5 0876 MOVF outp, W
3126 0BF6 0086 MOVWF FSR1L
3127 0BF7 0877 MOVF 0x77, W
3128 0BF8 0087 MOVWF FSR1H
3129 0BF9 0881 MOVF INDF1, F
3130 0BFA 1D03 BTFSS STATUS, 0x2
3131 0BFB 2BFD GOTO 0x3FD
3132 0BFC 2BFE GOTO 0x3FE
3133 0BFD 2C05 GOTO 0x405
3134 316: PIE1bits.TXIE = 0;
3136 0BFF 1211 BCF PIR1, 0x4
3141 0C02 01F9 CLRF outlen
3142 0C03 2C10 GOTO 0x410
3144 0C04 2C10 GOTO 0x410
3147 0C05 0876 MOVF outp, W
3148 0C06 0086 MOVWF FSR1L
3149 0C07 0877 MOVF 0x77, W
3150 0C08 0087 MOVWF FSR1H
3151 0C09 0801 MOVF INDF1, W
3153 0C0B 009A MOVWF TMR2
3156 0C0D 07F6 ADDWF outp, F
3158 0C0F 3DF7 ADDWFC 0x77, F
3162 325: /* called from interrupt routine to receive next byte */
3163 326: void msg_recvnext(void)
3165 328: while (PIR1bits.RCIF) {
3166 0C60 2C85 GOTO 0x485
3168 0C86 1A91 BTFSC PIR1, 0x5
3169 0C87 2C89 GOTO 0x489
3170 0C88 2C8A GOTO 0x48A
3171 0C89 2C61 GOTO 0x461
3172 0C8A 2C8B GOTO 0x48B
3173 329: bool err = RCSTAbits.FERR;
3176 0C63 191D BTFSC 0x1D, 0x2
3179 330: char new = RCREG;
3180 0C66 0819 MOVF T1GCON, W
3181 0C67 00F0 MOVWF 0x70
3182 0C68 0870 MOVF 0x70, W
3185 332: /* bad char, skip it */
3186 333: if (err) continue;
3187 0C6A 0871 MOVF err, W
3188 0C6B 1D03 BTFSS STATUS, 0x2
3189 0C6C 2C6E GOTO 0x46E
3190 0C6D 2C70 GOTO 0x470
3191 0C6E 2C85 GOTO 0x485
3192 0C6F 2C85 GOTO 0x485
3194 335: /* our input buffer has overflowed */
3195 336: if (inlen > sizeof(inbuff)) return;
3197 0C71 0278 SUBWF inlen, W
3198 0C72 1C03 BTFSS STATUS, 0x0
3199 0C73 2C75 GOTO 0x475
3200 0C74 2C76 GOTO 0x476
3201 0C75 2C78 GOTO 0x478
3202 0C76 2C8B GOTO 0x48B
3203 0C77 2C8B GOTO 0x48B
3205 338: /* keep this one */
3206 339: inbuff[inlen++] = new;
3207 0C78 0872 MOVF new, W
3208 0C79 00F0 MOVWF 0x70
3209 0C7A 0878 MOVF inlen, W
3210 0C7B 3ECD ADDLW 0xCD
3211 0C7C 0086 MOVWF FSR1L
3212 0C7D 0187 CLRF FSR1H
3213 0C7E 0870 MOVF 0x70, W
3214 0C7F 0081 MOVWF INDF1
3216 0C81 00F0 MOVWF 0x70
3217 0C82 0870 MOVF 0x70, W
3218 0C83 07F8 ADDWF inlen, F
3219 0C84 2C85 GOTO 0x485
3224 343: bool msg_recvready(void)
3226 345: if (inlen > 0) return 1;
3227 0B3A 0878 MOVF inlen, W
3228 0B3B 1D03 BTFSS STATUS, 0x2
3229 0B3C 2B3E GOTO 0x33E
3230 0B3D 2B41 GOTO 0x341
3232 0B3F 2B43 GOTO 0x343
3233 0B40 2B43 GOTO 0x343
3236 0B42 2B43 GOTO 0x343
3240 349: char msg_recv(void)
3242 351: if (inlen == 0) return 0;
3243 0D56 08F8 MOVF inlen, F
3244 0D57 1D03 BTFSS STATUS, 0x2
3245 0D58 2D5A GOTO 0x55A
3246 0D59 2D5B GOTO 0x55B
3247 0D5A 2D5E GOTO 0x55E
3249 0D5C 2D91 GOTO 0x591
3250 0D5D 2D91 GOTO 0x591
3252 353: /* record and disable the interupt */
3253 354: bool in = PIE1bits.RCIE;
3256 0D60 1A91 BTFSC PIR1, 0x5
3260 355: PIE1bits.RCIE = 0;
3262 0D65 1291 BCF PIR1, 0x5
3264 357: char new = inbuff[0];
3265 0D66 084D MOVF 0x4D, W
3272 0D6C 02F8 SUBWF inlen, F
3274 360: /* shuffle them down one */
3275 361: for (char i=0;i<inlen;i++)
3277 0D6E 2D81 GOTO 0x581
3281 0D7F 07B7 ADDWF i, F
3282 0D80 2D81 GOTO 0x581
3283 0D81 0878 MOVF inlen, W
3284 0D82 0237 SUBWF i, W
3285 0D83 1C03 BTFSS STATUS, 0x0
3286 0D84 2D86 GOTO 0x586
3287 0D85 2D87 GOTO 0x587
3288 0D86 2D6F GOTO 0x56F
3289 0D87 2D88 GOTO 0x588
3290 362: inbuff[i] = inbuff[i+1];
3293 0D71 3ECD ADDLW 0xCD
3294 0D72 0086 MOVWF FSR1L
3295 0D73 0187 CLRF FSR1H
3296 0D74 0801 MOVF INDF1, W
3299 0D77 3ECD ADDLW 0xCD
3300 0D78 0086 MOVWF FSR1L
3301 0D79 0187 CLRF FSR1H
3303 0D7B 0081 MOVWF INDF1
3305 364: /* restore the interupt */
3306 365: PIE1bits.RCIE = in;
3307 0D88 0835 MOVF in, W
3309 0D8A 1D03 BTFSS STATUS, 0x2
3310 0D8B 1691 BSF PIR1, 0x5
3311 0D8C 1903 BTFSC STATUS, 0x2
3312 0D8D 1291 BCF PIR1, 0x5
3316 0D90 2D91 GOTO 0x591
3321 370: void int_disable(void)
3323 372: INTCONbits.GIE = 0;
3324 0B22 138B BCF INTCON, 0x7
3328 375: void int_enable(void)
3330 377: INTCONbits.GIE = 1;
3331 0B20 178B BSF INTCON, 0x7
3334 --- /home/justin/MPLABXProjects/uart test.X/interrupts.c ----------------------------------------------
3335 1: /******************************************************************************/
3336 2: /*Files to Include */
3337 3: /******************************************************************************/
3339 5: #if defined(__XC)
3340 6: #include <xc.h> /* XC8 General Include File */
3341 7: #elif defined(HI_TECH_C)
3342 8: #include <htc.h> /* HiTech General Include File */
3345 11: #include <stdint.h> /* For uint8_t definition */
3346 12: #include <stdbool.h> /* For true/false definition */
3347 13: #include "user.h"
3349 15: /******************************************************************************/
3350 16: /* Interrupt Routines */
3351 17: /******************************************************************************/
3353 19: /* Baseline devices don't have interrupts. Unfortunately the baseline detection
3354 20: * macro is named _PIC12 */
3358 24: void interrupt isr(void)
3362 0006 087F MOVF 0x7F, W
3363 0007 00F3 MOVWF 0x73
3364 26: /* This code stub shows general interrupt handling. Note that these
3365 27: conditional statements are not handled within 3 seperate if blocks.
3366 28: Do not use a seperate if block for each interrupt flag to avoid run
3369 31: if (PIE1bits.TXIE && PIR1bits.TXIF)
3371 0009 1E11 BTFSS PIR1, 0x4
3376 000E 1E11 BTFSS PIR1, 0x4
3382 0013 23EF CALL 0x3EF
3386 34: if (PIE1bits.RCIE && PIR1bits.RCIF)
3388 0017 1E91 BTFSS PIR1, 0x5
3393 001C 1E91 BTFSS PIR1, 0x5
3399 0021 2460 CALL 0x460
3405 39: /* TODO Add interrupt routine code here. */
3407 41: /* Determine which flag generated the interrupt */
3408 42: if(<Interrupt Flag 1>)
3410 44: <Interrupt Flag 1=0>; /* Clear Interrupt Flag 1 */
3412 46: else if (<Interrupt Flag 2>)
3414 48: <Interrupt Flag 2=0>; /* Clear Interrupt Flag 2 */
3418 52: /* Unhandled interrupts */
3424 0024 0873 MOVF 0x73, W