========================== ============= _ 1Wire_1: T_1WIRE_1A, # 165; (500 - 4)/3=165delayT_1WIRE_1A, # 165; (500 - 4)/3=165delay
;-----------------------------------------------------------------------------_1Wire_2: clr T_1WIRE_2A, # 165; (500 - 4)/3=165delayT_1WIRE_2A, # 165; (500 - 4)/3=165delay
;------------------------------------------------------------------------------:fCOUNTER,A_Loop36:; 1 us.fCOUNTER, D_Loop36; 2 us.
;-----------------------------------------------------------------------------_delay: ;=770 * x + 1 x=(delay - 5)/770 ВРАХОВУЮЧИ виконан call і return.fCOUNTER2, AfCOUNTER, # 0_Loop94 :; 1 us.fCOUNTER, BD_Loop94; 2 us.fCOUNTER2, BD_Loop94; 2 us.
; ========================================= ============= _ Byte: fTEMP, AR2, # 8
; --------------------------- цикл: A, fTEMP type_dat, next2_1T_1WIRE_1; Обнуляємо вихід. 1 datnext2_2_1: clr T_1WIRE_2; Обнуляємо вихід. 2 dat_2: ACC.0, RB_Skip01
type_dat, next3_1T_1WIRE_1; Встановлюємо вихід. 1 datnext3_2_1: setb T_1WIRE_2; Встановлюємо вихід. 2 dat_2: _Skip01: AACC.7 type_dat, next4_1T_1WIRE_1, RB_Skip02next4_2_1: jnb T_1WIRE_2, RB_Skip02_2: ACC.7_Skip02: fTEMP, A
) A, # 14; (60 - 4)/3=18delaytype_dat, next5_1T_1WIRE_1next5_2_1: setb T_1WIRE_2_2: A, # 1 delay
. R2, RBLoop A, fTEMP;
; ========================================= =============
; Процедура оновлення CRC. Параметр в A._CRC: PUSH ACC; save accumulatorB; save the B registerACC; save bits to be shiftedB, # 8; set shift=8 bits; _LOOP: XRL A, CRC; calculate CRCA; move it to the carryA, CRC; get the last CRC valueZERO; skip if data=0A, # 18H; update the CRC value
;: RRC A; position the new CRCCRC, A; store the new CRCACC; get the remaining bitsA; position the next bitACC; save the remaining bitsB, CRC_LOOP; repeat for eight bitsACC; clean up the stackB; restore the B registerACC; restore the accumulator
; -------------------------------------------------------------------------------
Додаток 2. Hex-файл програми
: 10000000790175900075B000D282D283D284D285F6
: 10001000D286D287C2A0C2A1C2A220A3E5C28720F5
: 10002000A40F207F0ED27FB905030200330902001E
: 1000300033C27F20A50F207E0ED27EB901030200BD
: 100040004719020047C27EB90107C282D28302006B
: 1000500079B90209C283D282D284020079B9030934
: 10006000C284D283D285020079B90409C285D284C0
: 10007000D286020079C286D285D280D281D2011284
: 100080000089C201120089809130010612024202E9
: 10009000009512025174CC120274744412027474EA
: 1000A000001202671202671202671202673001062D
: 1000B0001202420200B912025174A512026074CCFD
: 1000C00012027474BE1202747401120260751B0075
: 1000D00074FF120274F5361202C074FF120274F536
: 1000E000371202C074FF1202741202C074FF1202AF
: 1000F000741202C074FF1202741202C074FF120262
: 10010000741202C074FF1202741202C074FF120251
: 10011000741202C074FF120274C3951B600A740A41
: 10012000120267C200020241D200E53654F0C4F563
: 1001300036E53775F010A425362001030201E7F8F3
: 10014000B9011D94115007D2A0C2A20201DA94068F
: 100150005007C2A2C2A00201DAD2A2C2A00201DAF2
: 10016000B9021D94135007D2A0C2A20201DA94056D
: 100170005007C2A0C2A20201DAD2A2C2A00201DAD2
: 10018000B9031D94125007D2A0C2A20201DA94044E
: 100190005007C2A2C2A00201DAD2A2C2A00201DAB2
: 1001A000B9041D94155007D2A0C2A20201DA94042A
: 1001B0005007C2A0C2A20201DAD2A2C2A00201DA92
: 1001C00094195007C2A2D2A00201DA94065007C2C5
: 1001D000A0C2A20201DAC2A0D2A2E875F00A84C4C9
: 1001E00025F0F590020241F8B9010E941E5005D297
: 1001F000A1020237C2A1020237B9020E943C500597
: 10020000D2A1020237C2A1020237B9030E942350D1
: 1002100005D2A1020241C2A1020237B9040E9446DE
: 100220005005D2A1020241C2A10202419428500508
: 10023000D2A1020237C2A1E875F00A84C425F0F504
: 10024000B022C28074A5120260D28074A51202602E
: 1002500022C28174A5120260D28174A51202...