📄 dal_bus.lst
字号:
VALUE
M if (cycles > (255*(256*3 + 6) + 2 + 3))
M messg "ERROR : Too long a wait for the WAIT macro at present!!"
M exitm
M endif
M
M ; messg Info - calculated number of cycles = #v(cycles)
M
M
M if (cycles > ((255*3)+5))
M
M movlw ((cycles-5)/(256*3+6))
M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
M endif
M
M if ((cycles > 8 ) && (cycles < (255*3 + 5)))
M
M movlw ((cycles-5)/3)
M call shortdelay
M
M ifndef INCSHORTDELAY
M #define INCSHORTDELAY
M endif
M
M exitm
M endif
M
M if (cycles < 8)
M while ( cycles > 1 )
M
M goto $+1 ;two cycle nop
M
M cycles -=2
M endw
M endif
M
M if (cycles > 0)
0023 0000 M nop
M
M endif
M exitm
0024 1800 00073 btfsc DScommbuff, 0
0025 1605 00074 bsf DALLAS_BUS ;end of low pulse if bit was a 1
00075 Wait 58 Microsec,0 ; (Tslot + Trec) - Tlow1
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
003A M variable cycles = ((58 * D'1000') / instruct_time_ns) ;required delay in
MPASM 03.80 Released DAL_BUS.ASM 11-20-2005 18:21:08 PAGE 15
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M ;100ths of instructions
M
M if (cycles < (0) )
M messg NOTE - negative delay time with 0 cycles (no code)
M
M exitm
M else
003A M variable cycles = (cycles - (0))
M endif
M
M if (cycles == 0)
M messg "WARNING - delay time less than 1 instructions"
M
M nop
M exitm
M endif
M
M if (cycles > (255*(256*3 + 6) + 2 + 3))
M messg "ERROR : Too long a wait for the WAIT macro at present!!"
M exitm
M endif
M
M ; messg Info - calculated number of cycles = #v(cycles)
M
M
M if (cycles > ((255*3)+5))
M
M movlw ((cycles-5)/(256*3+6))
M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
M endif
M
M if ((cycles > 8 ) && (cycles < (255*3 + 5)))
M
0026 3011 M movlw ((cycles-5)/3)
0027 2??? M call shortdelay
M
M ifndef INCSHORTDELAY
M #define INCSHORTDELAY
M endif
M
M exitm
0028 1605 00076 bsf DALLAS_BUS ;end of low pulse if 0 (1 no change)
00077 Wait 1 Microsec,4 ; Trec
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
0001 M variable cycles = ((1 * D'1000') / instruct_time_ns) ;required delay in
MPASM 03.80 Released DAL_BUS.ASM 11-20-2005 18:21:08 PAGE 16
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M ;100ths of instructions
M
M if (cycles < (4) )
Message[301]: MESSAGE: (NOTE - negative delay time with 4 cycles (no code))
M messg NOTE - negative delay time with 4 cycles (no code)
M
M exitm
0029 0C?? 00078 rrf DScommbuff, F
002A 0B?? 00079 decfsz count, F
002B 2??? 00080 goto DSWriteLoop
002C 0008 00081 return
00082
00083 ;****************************************************************************
00084 ;*
00085 ;* Read bit from the Dallas bus - puts it is bit 0 of DScommbuff
00086 ;* TO DO - best of three reads, to guard against noise
00087 ;*
00088 ;****************************************************************************
00089
002D 1605 00090 DSReadBit bsf DALLAS_BUS ;just in case it isn't
002E 0000 00091 nop
002F 1205 00092 bcf DALLAS_BUS ;start/sync edge
00093 Wait 2 Microsec,0 ; Tlowr
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
0002 M variable cycles = ((2 * D'1000') / instruct_time_ns) ;required delay in
M ;100ths of instructions
M
M if (cycles < (0) )
M messg NOTE - negative delay time with 0 cycles (no code)
M
M exitm
M else
0002 M variable cycles = (cycles - (0))
M endif
M
M if (cycles == 0)
M messg "WARNING - delay time less than 1 instructions"
M
M nop
M exitm
M endif
M
M if (cycles > (255*(256*3 + 6) + 2 + 3))
M messg "ERROR : Too long a wait for the WAIT macro at present!!"
M exitm
M endif
M
M ; messg Info - calculated number of cycles = #v(cycles)
M
M
M if (cycles > ((255*3)+5))
MPASM 03.80 Released DAL_BUS.ASM 11-20-2005 18:21:08 PAGE 17
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M
M movlw ((cycles-5)/(256*3+6))
M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
M endif
M
M if ((cycles > 8 ) && (cycles < (255*3 + 5)))
M
M movlw ((cycles-5)/3)
M call shortdelay
M
M ifndef INCSHORTDELAY
M #define INCSHORTDELAY
M endif
M
M exitm
M endif
M
M if (cycles < 8)
M while ( cycles > 1 )
M
0030 2??? M goto $+1 ;two cycle nop
M
00000000 M cycles -=2
M endw
M endif
M
M if (cycles > 0)
M nop
M
M endif
M exitm
0031 1605 00094 bsf DALLAS_BUS ;end of sync low pulse
00095 Wait 12 Microsec, 2 ; Trdv - 2 cycles
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
000C M variable cycles = ((12 * D'1000') / instruct_time_ns) ;required delay in
M ;100ths of instructions
M
M if (cycles < (2) )
M messg NOTE - negative delay time with 2 cycles (no code)
M
M exitm
M else
000A M variable cycles = (cycles - (2))
M endif
M
MPASM 03.80 Released DAL_BUS.ASM 11-20-2005 18:21:08 PAGE 18
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M if (cycles == 0)
M messg "WARNING - delay time less than 1 instructions"
M
M nop
M exitm
M endif
M
M if (cycles > (255*(256*3 + 6) + 2 + 3))
M messg "ERROR : Too long a wait for the WAIT macro at present!!"
M exitm
M endif
M
M ; messg Info - calculated number of cycles = #v(cycles)
M
M
M if (cycles > ((255*3)+5))
M
M movlw ((cycles-5)/(256*3+6))
M call longdelay
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -