⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dal_bus.lst

📁 转载别人ds18b20proteus作品希望对proteus library里没有ds18b20的xdjm们有用!
💻 LST
📖 第 1 页 / 共 5 页
字号:
                          M  
                          M  ifndef INCLONGDELAY
                          M   #define INCLONGDELAY
                          M  endif
                          M 
                          M  exitm
                          M  endif
                          M 
                          M  if ((cycles > 8 ) && (cycles < (255*3 + 5)))
                          M                 
0032   3001               M                 movlw   ((cycles-5)/3)        
0033   2???               M                 call    shortdelay
                          M  
                          M  ifndef INCSHORTDELAY
                          M   #define INCSHORTDELAY
                          M  endif
                          M 
                          M  exitm
0034   1400           00096                 bsf     DScommbuff,0
0035   1E05           00097                 btfss   DALLAS_BUS
0036   1000           00098                 bcf     DScommbuff, 0
                      00099                 Wait    47 Microsec, 0
                          M  radix dec
  03E8                    M  variable instruct_time_ns =  (( 1 Seconds ) / (Clock_Freq / 4 ))
  0000                    M  local cycles
  002F                    M  variable cycles = ((47 * 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
  002F                    M  variable cycles = (cycles - (0))
MPASM 03.80 Released                              DAL_BUS.ASM   11-20-2005  18:21:08         PAGE 19


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                          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                 
0037   300E               M                 movlw   ((cycles-5)/3)        
0038   2???               M                 call    shortdelay
                          M  
                          M  ifndef INCSHORTDELAY
                          M   #define INCSHORTDELAY
                          M  endif
                          M 
                          M  exitm
0039   0008           00100                 return
                      00101 
                      00102 ;****************************************************************************
                      00103 ;*
                      00104 ;*   Read byte from the Dallas bus, and update CRC
                      00105 ;* TO DO -  best of three reads, to guard against noise
                      00106 ;*
                      00107 ;****************************************************************************
                      00108 
003A   1605           00109 DSReadByte      bsf     DALLAS_BUS      ;just in case it isn't
003B   3008           00110                 movlw   0x08            ;byte is 8 bits
003C   00??           00111                 movwf   count
                      00112 
003D   1205           00113 DSReadLoop      bcf     DALLAS_BUS      ;start/sync edge
MPASM 03.80 Released                              DAL_BUS.ASM   11-20-2005  18:21:08         PAGE 20


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00114                 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))
                          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
MPASM 03.80 Released                              DAL_BUS.ASM   11-20-2005  18:21:08         PAGE 21


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                          M 
                          M  if (cycles < 8)
                          M  while  ( cycles > 1 )
                          M                 
003E   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
003F   1605           00115                 bsf     DALLAS_BUS      ;end of sync low pulse
                      00116                 Wait    12 Microsec, 3  ; 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 < (3)          )
                          M         messg NOTE - negative delay time with 3          cycles (no code)
                          M                
                          M                 exitm
                          M  else
  0009                    M  variable cycles = (cycles - (3))
                          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
MPASM 03.80 Released                              DAL_BUS.ASM   11-20-2005  18:21:08         PAGE 22


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                          M  endif
                          M 
                          M  exitm
                          M  endif
                          M 
                          M  if ((cycles > 8 ) && (cycles < (255*3 + 5)))
                          M                 
0040   3001               M                 movlw   ((cycles-5)/3)        
0041   2???               M                 call    shortdelay
                          M  
                          M  ifndef INCSHORTDELAY
                          M   #define INCSHORTDELAY
                          M  endif
                          M 
                          M  exitm
0042   1003           00117                 bcf     STATUS, C
0043   0103           00118                 clrw
0044   1E05           00119                 btfss   DALLAS_BUS
0045   2???           00120                  goto   DSread0
0046   3001           00121                 movlw   b'00000001'
0047   1403           00122                 bsf     STATUS, C
0048                  00123 DSread0
0048   0C??           00124                 rrf     DScommbuff, F
                      00125 ;now for the calculating the CRC
0049   1003           00126                 bcf     STATUS, C
004A   06??           00127                 xorwf   DSCRC, W
004B   3901           00128                 andlw   b'00000001'
004C   1903           00129                 btfsc   STATUS, Z   ;changed from btfss 080298****
004D   2???           00130                  goto   DSCRCin0
004E   3018           00131                 movlw   0x18
004F   06??           00132                 xorwf   DSCRC, F
0050   1403           00133                 bsf     STATUS, C   ;added here 080298*****
                      00134 
0051   0C??           00135 DSCRCin0        rrf     DSCRC, F
                      00136                 Wait    47 Microsec, 12
                          M  radix dec
  03E8                    M  variable instruct_time_ns =  (( 1 Seconds ) / (Clock_Freq / 4 ))
  0000                    M  local cy

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -