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

📄 main.lst

📁 达拉斯 1-Wire 主机通信 这份资料展示了如何把 1-Wire 主机通信在应用到一个AVR系统中
💻 LST
📖 第 1 页 / 共 4 页
字号:
   \   00000040   C015                       RJMP    ??DS1820_ReadTemperature_1
    278              }
    279              // Match id again.
    280              OWI_MatchRom(id, bus);
   \                     ??DS1820_ReadTemperature_3:
   \   00000042   2F28                       MOV     R18,R24
   \   00000044   018D                       MOVW    R17 : R16,R27 : R26
   \   00000046   ........                   CALL    OWI_MatchRom
    281              // Send READ SCRATCHPAD command.
    282              OWI_SendByte(DS1820_READ_SCRATCHPAD, bus);
   \   0000004A   2F18                       MOV     R17,R24
   \   0000004C   EB0E                       LDI     R16,190
   \   0000004E   ........                   CALL    OWI_SendByte
    283              // Read only two first bytes (temperature low, temperature high)
    284              // and place them in the 16 bit temperature variable.
    285              temperature = OWI_ReceiveByte(bus);
   \   00000052   2F08                       MOV     R16,R24
   \   00000054   ........                   CALL    OWI_ReceiveByte
   \   00000058   E010                       LDI     R17,0
   \   0000005A   0128                       MOVW    R5 : R4,R17 : R16
    286              temperature |= (OWI_ReceiveByte(bus) << 8);
   \   0000005C   2F08                       MOV     R16,R24
   \   0000005E   ........                   CALL    OWI_ReceiveByte
   \   00000062   2F30                       MOV     R19,R16
   \   00000064   E020                       LDI     R18,0
   \   00000066   2A42                       OR      R4,R18
   \   00000068   2A53                       OR      R5,R19
    287              
    288              return temperature;
   \   0000006A   0182                       MOVW    R17 : R16,R5 : R4
   \                     ??DS1820_ReadTemperature_1:
   \   0000006C   E0E6                       LDI     R30,6
   \   0000006E   ........                   JMP     ?EPILOGUE_B6_L09
    289          }
    290          
    291          
    292          /*! \brief  Set the wiper position of a DS2890.
    293           *
    294           *  This function initializes the DS2890 by enabling the charge pump. It then
    295           *  changes the wiper position.
    296           *
    297           *  \param  position    The new wiper position.
    298           *
    299           *  \param  bus         The bus where the DS2890 is connected.
    300           *
    301           *  \param  id          The 64 bit identifier of the DS2890.
    302           */

   \                                 In segment CODE, align 2, keep-with-next
    303          void DS2890_SetWiperPosition(unsigned char position, unsigned char bus, unsigned char * id)
   \                     DS2890_SetWiperPosition:
    304          {
   \   00000000   ........                   CALL    ?PROLOGUE4_L09
   \   00000004   2F90                       MOV     R25,R16
   \   00000006   2F81                       MOV     R24,R17
   \   00000008   01D9                       MOVW    R27 : R26,R19 : R18
    305              // Reset, presence.
    306              if(!OWI_DetectPresence(bus))
   \   0000000A   2F08                       MOV     R16,R24
   \   0000000C   ........                   CALL    OWI_DetectPresence
   \   00000010   2300                       TST     R16
   \   00000012   F1B9                       BREQ    ??DS2890_SetWiperPosition_0
    307              {
    308                  return;
    309              }
    310              //Match id.
    311              OWI_MatchRom(id, bus);
   \   00000014   2F28                       MOV     R18,R24
   \   00000016   018D                       MOVW    R17 : R16,R27 : R26
   \   00000018   ........                   CALL    OWI_MatchRom
    312              
    313              // Send Write control register command.
    314              OWI_SendByte(DS2890_WRITE_CONTROL_REGISTER, bus);
   \   0000001C   2F18                       MOV     R17,R24
   \   0000001E   E505                       LDI     R16,85
   \   00000020   ........                   CALL    OWI_SendByte
    315              
    316              // Write 0x4c to control register to enable charge pump.
    317              OWI_SendByte(0x4c, bus);
   \   00000024   2F18                       MOV     R17,R24
   \   00000026   E40C                       LDI     R16,76
   \   00000028   ........                   CALL    OWI_SendByte
    318              
    319              // Check that the value returned matches the value sent.
    320              if (OWI_ReceiveByte(bus) != 0x4c)
   \   0000002C   2F08                       MOV     R16,R24
   \   0000002E   ........                   CALL    OWI_ReceiveByte
   \   00000032   340C                       CPI     R16,76
   \   00000034   F531                       BRNE    ??DS2890_SetWiperPosition_0
    321              {
    322                  return;
    323              }
    324              
    325              // Send release code to update control register.
    326              OWI_SendByte(DS2890_RELEASE_CODE, bus);
   \   00000036   2F18                       MOV     R17,R24
   \   00000038   E906                       LDI     R16,150
   \   0000003A   ........                   CALL    OWI_SendByte
    327              
    328              // Check that zeros are returned to ensure that the operation was
    329              // successful.
    330              if (OWI_ReceiveByte(bus) == 0xff)
   \   0000003E   2F08                       MOV     R16,R24
   \   00000040   ........                   CALL    OWI_ReceiveByte
   \   00000044   3F0F                       CPI     R16,255
   \   00000046   F0E9                       BREQ    ??DS2890_SetWiperPosition_0
    331              {
    332                  return;
    333              }
    334              
    335              // Reset, presence.
    336              if (!OWI_DetectPresence(bus))
   \   00000048   2F08                       MOV     R16,R24
   \   0000004A   ........                   CALL    OWI_DetectPresence
   \   0000004E   2300                       TST     R16
   \   00000050   F0C1                       BREQ    ??DS2890_SetWiperPosition_0
    337              {
    338                  return;
    339              }
    340              
    341              // Match id.
    342              OWI_MatchRom(id, bus);
   \   00000052   2F28                       MOV     R18,R24
   \   00000054   018D                       MOVW    R17 : R16,R27 : R26
   \   00000056   ........                   CALL    OWI_MatchRom
    343              
    344              // Send the Write Position command.
    345              OWI_SendByte(DS2890_WRITE_POSITION, bus);
   \   0000005A   2F18                       MOV     R17,R24
   \   0000005C   E00F                       LDI     R16,15
   \   0000005E   ........                   CALL    OWI_SendByte
    346              
    347              // Send the new position.
    348              OWI_SendByte(position, bus);
   \   00000062   2F18                       MOV     R17,R24
   \   00000064   2F09                       MOV     R16,R25
   \   00000066   ........                   CALL    OWI_SendByte
    349              
    350              // Check that the value returned matches the value sent.
    351              if (OWI_ReceiveByte(bus) != position)
   \   0000006A   2F08                       MOV     R16,R24
   \   0000006C   ........                   CALL    OWI_ReceiveByte
   \   00000070   1709                       CP      R16,R25
   \   00000072   F439                       BRNE    ??DS2890_SetWiperPosition_0
    352              {
    353                  return;
    354              }
    355              
    356              // Send release code to update wiper position.
    357              OWI_SendByte(DS2890_RELEASE_CODE, bus);
   \   00000074   2F18                       MOV     R17,R24
   \   00000076   E906                       LDI     R16,150
   \   00000078   ........                   CALL    OWI_SendByte
    358              
    359              // Check that zeros are returned to ensure that the operation was
    360              // successful.
    361              if (OWI_ReceiveByte(bus) == 0xff)
   \   0000007C   2F08                       MOV     R16,R24
   \   0000007E   ........                   CALL    OWI_ReceiveByte
   \                     ??DS2890_SetWiperPosition_0:
   \   00000082   E0E4                       LDI     R30,4
   \   00000084   ........                   JMP     ?EPILOGUE_B4_L09
    362              {   
    363                  return;
    364              }
    365          }

   \                                 In segment ABSOLUTE, at 0x3e, root
   \   union <unnamed> volatile __io _A_EEAR
   \                     _A_EEAR:
   \   00000000                              DS 2

   \                                 In segment ABSOLUTE, at 0x40, root
   \   union <unnamed> volatile __io _A_UBRRH
   \                     _A_UBRRH:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x41, root
   \   union <unnamed> volatile __io _A_WDTCR
   \                     _A_WDTCR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x42, root
   \   union <unnamed> volatile __io _A_ASSR
   \                     _A_ASSR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x43, root
   \   union <unnamed> volatile __io _A_OCR2
   \                     _A_OCR2:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x44, root
   \   union <unnamed> volatile __io _A_TCNT2
   \                     _A_TCNT2:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x45, root
   \   union <unnamed> volatile __io _A_TCCR2
   \                     _A_TCCR2:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x46, root
   \   union <unnamed> volatile __io _A_ICR1
   \                     _A_ICR1:
   \   00000000                              DS 2

   \                                 In segment ABSOLUTE, at 0x48, root
   \   union <unnamed> volatile __io _A_OCR1B
   \                     _A_OCR1B:
   \   00000000                              DS 2

   \                                 In segment ABSOLUTE, at 0x4a, root
   \   union <unnamed> volatile __io _A_OCR1A
   \                     _A_OCR1A:
   \   00000000                              DS 2

   \                                 In segment ABSOLUTE, at 0x4c, root
   \   union <unnamed> volatile __io _A_TCNT1
   \                     _A_TCNT1:
   \   00000000                              DS 2

   \                                 In segment ABSOLUTE, at 0x4e, root
   \   union <unnamed> volatile __io _A_TCCR1B
   \                     _A_TCCR1B:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x4f, root
   \   union <unnamed> volatile __io _A_TCCR1A
   \                     _A_TCCR1A:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x50, root
   \   union <unnamed> volatile __io _A_SFIOR
   \                     _A_SFIOR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x51, root
   \   union <unnamed> volatile __io _A_OSCCAL
   \                     _A_OSCCAL:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x52, root
   \   union <unnamed> volatile __io _A_TCNT0
   \                     _A_TCNT0:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x53, root
   \   union <unnamed> volatile __io _A_TCCR0
   \                     _A_TCCR0:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x54, root
   \   union <unnamed> volatile __io _A_MCUCSR
   \                     _A_MCUCSR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x55, root
   \   union <unnamed> volatile __io _A_MCUCR
   \                     _A_MCUCR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x56, root
   \   union <unnamed> volatile __io _A_TWCR
   \                     _A_TWCR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x57, root
   \   union <unnamed> volatile __io _A_SPMCR
   \                     _A_SPMCR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x58, root
   \   union <unnamed> volatile __io _A_TIFR
   \                     _A_TIFR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x59, root
   \   union <unnamed> volatile __io _A_TIMSK
   \                     _A_TIMSK:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x5a, root
   \   union <unnamed> volatile __io _A_GIFR
   \                     _A_GIFR:
   \   00000000                              DS 1

   \                                 In segment ABSOLUTE, at 0x5b, root
   \   union <unnamed> volatile __io _A_GICR

⌨️ 快捷键说明

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