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

📄 tsensor.txt

📁 STM32F103ZET6+UCOSII+UCGUI源码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
000046  f7fffffe          BL       GPIO_Init
;;;76     
;;;77       I2C_DeInit(I2C1);
00004a  4c10              LDR      r4,|L3.140|
00004c  4620              MOV      r0,r4
00004e  f7fffffe          BL       I2C_DeInit
;;;78     
;;;79       /* I2C1 Init */
;;;80       I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; 
000052  2000              MOVS     r0,#0
000054  f8ad0004          STRH     r0,[sp,#4]
;;;81       I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
;;;82       I2C_InitStructure.I2C_OwnAddress1 = 0x00;
000058  f8ad0008          STRH     r0,[sp,#8]
;;;83       I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
00005c  1520              ASRS     r0,r4,#20
00005e  f8ad000a          STRH     r0,[sp,#0xa]
;;;84       I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
000062  0100              LSLS     r0,r0,#4
000064  f8ad000c          STRH     r0,[sp,#0xc]
000068  f64b71ff          MOV      r1,#0xbfff            ;81
;;;85       I2C_InitStructure.I2C_ClockSpeed = 200000;
00006c  4808              LDR      r0,|L3.144|
00006e  f8ad1006          STRH     r1,[sp,#6]            ;81
;;;86       I2C_Init(I2C1, &I2C_InitStructure);
000072  9004              STR      r0,[sp,#0x10]
000074  a901              ADD      r1,sp,#4
000076  4620              MOV      r0,r4
000078  f7fffffe          BL       I2C_Init
;;;87     
;;;88       /* I2C1 Init */
;;;89       I2C_Cmd(I2C1, ENABLE);
00007c  2101              MOVS     r1,#1
00007e  4620              MOV      r0,r4
000080  f7fffffe          BL       I2C_Cmd
;;;90     }
000084  b006              ADD      sp,sp,#0x18
000086  bd10              POP      {r4,pc}
;;;91     
                          ENDP

                  |L3.136|
                          DCD      0x40010c00
                  |L3.140|
                          DCD      0x40005400
                  |L3.144|
                          DCD      0x00030d40

                          AREA ||i.I2C_LM75_Reg_Read||, CODE, READONLY, ALIGN=2

                  I2C_LM75_Reg_Read PROC
;;;146    *******************************************************************************/
;;;147    u16 I2C_LM75_Reg_Read(u8 RegName)
000000  e92d41f0          PUSH     {r4-r8,lr}
;;;148    {
;;;149      u32 RegValue=0;
;;;150    
;;;151      /* Enable I2C1 acknowledgement if it is already disabled by other function */
;;;152      I2C_AcknowledgeConfig(I2C1, ENABLE);
000004  4d30              LDR      r5,|L4.200|
000006  4607              MOV      r7,r0                 ;148
000008  2101              MOVS     r1,#1
00000a  4628              MOV      r0,r5
00000c  f7fffffe          BL       I2C_AcknowledgeConfig
;;;153    
;;;154      /*----- Transmission Phase -----*/
;;;155      /* Send I2C1 START condition */
;;;156      I2C_GenerateSTART(I2C1, ENABLE);
000010  2101              MOVS     r1,#1
000012  4628              MOV      r0,r5
000014  f7fffffe          BL       I2C_GenerateSTART
;;;157      
;;;158      /* Test on I2C1 EV5 and clear it */
;;;159      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT))  /* EV5 */
000018  4c2c              LDR      r4,|L4.204|
                  |L4.26|
00001a  4628              MOV      r0,r5
00001c  4621              MOV      r1,r4
00001e  f7fffffe          BL       I2C_CheckEvent
000022  2800              CMP      r0,#0
000024  d0f9              BEQ      |L4.26|
;;;160      {
;;;161      }
;;;162      
;;;163      /* Send STLM75 slave address for write */
;;;164      I2C_Send7bitAddress(I2C1, LM75_Addr, I2C_Direction_Transmitter);
000026  2200              MOVS     r2,#0
000028  2190              MOVS     r1,#0x90
00002a  4628              MOV      r0,r5
00002c  f7fffffe          BL       I2C_Send7bitAddress
;;;165      
;;;166      /* Test on I2C1 EV6 and clear it */
;;;167      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) /* EV6 */
000030  4e27              LDR      r6,|L4.208|
                  |L4.50|
000032  4628              MOV      r0,r5
000034  4631              MOV      r1,r6
000036  f7fffffe          BL       I2C_CheckEvent
00003a  2800              CMP      r0,#0
00003c  d0f9              BEQ      |L4.50|
;;;168      {
;;;169      }
;;;170    
;;;171      /* Send the specified register data pointer */
;;;172      I2C_SendData(I2C1, RegName);
00003e  4639              MOV      r1,r7
000040  4628              MOV      r0,r5
000042  f7fffffe          BL       I2C_SendData
;;;173      
;;;174      /* Test on I2C1 EV8 and clear it */
;;;175      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_TRANSMITTED)) /* EV8 */
000046  4e22              LDR      r6,|L4.208|
000048  1cb6              ADDS     r6,r6,#2
                  |L4.74|
00004a  4631              MOV      r1,r6
00004c  4628              MOV      r0,r5
00004e  f7fffffe          BL       I2C_CheckEvent
000052  2800              CMP      r0,#0
000054  d0f9              BEQ      |L4.74|
;;;176      {
;;;177      }
;;;178    
;;;179      /*----- Reception Phase -----*/
;;;180      /* Send Re-STRAT condition */
;;;181      I2C_GenerateSTART(I2C1, ENABLE);
000056  2101              MOVS     r1,#1
000058  4628              MOV      r0,r5
00005a  f7fffffe          BL       I2C_GenerateSTART
                  |L4.94|
;;;182      
;;;183      /* Test on EV5 and clear it */
;;;184      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT))  /* EV5 */
00005e  4621              MOV      r1,r4
000060  4628              MOV      r0,r5
000062  f7fffffe          BL       I2C_CheckEvent
000066  2800              CMP      r0,#0
000068  d0f9              BEQ      |L4.94|
;;;185      {
;;;186      }
;;;187      
;;;188      /* Send STLM75 slave address for read */
;;;189      I2C_Send7bitAddress(I2C1, LM75_Addr, I2C_Direction_Receiver);
00006a  2201              MOVS     r2,#1
00006c  2190              MOVS     r1,#0x90
00006e  4628              MOV      r0,r5
000070  f7fffffe          BL       I2C_Send7bitAddress
;;;190      
;;;191      /* Test on EV6 and clear it */
;;;192      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED))  /* EV6 */
000074  4c15              LDR      r4,|L4.204|
;;;193      {
;;;194      }
;;;195      
;;;196    
;;;197      /* Test on EV7 and clear it */
;;;198      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_RECEIVED))  /* EV7 */
000076  4e15              LDR      r6,|L4.204|
000078  1c64              ADDS     r4,r4,#1              ;192
00007a  363f              ADDS     r6,r6,#0x3f
                  |L4.124|
00007c  4621              MOV      r1,r4                 ;192
00007e  4628              MOV      r0,r5                 ;192
000080  f7fffffe          BL       I2C_CheckEvent
000084  2800              CMP      r0,#0                 ;192
000086  d0f9              BEQ      |L4.124|
                  |L4.136|
000088  4631              MOV      r1,r6
00008a  4628              MOV      r0,r5
00008c  f7fffffe          BL       I2C_CheckEvent
000090  2800              CMP      r0,#0
000092  d0f9              BEQ      |L4.136|
;;;199      {
;;;200      }
;;;201      
;;;202      /* Store I2C1 received data */
;;;203      RegValue = (u16)(I2C_ReceiveData(I2C1) << 8);
000094  4628              MOV      r0,r5
000096  f7fffffe          BL       I2C_ReceiveData
00009a  0204              LSLS     r4,r0,#8
;;;204      
;;;205      /* Disable I2C1 acknowledgement */
;;;206      I2C_AcknowledgeConfig(I2C1, DISABLE);
00009c  2100              MOVS     r1,#0
00009e  4628              MOV      r0,r5
0000a0  f7fffffe          BL       I2C_AcknowledgeConfig
;;;207      
;;;208      /* Send I2C1 STOP Condition */
;;;209      I2C_GenerateSTOP(I2C1, ENABLE);
0000a4  2101              MOVS     r1,#1
0000a6  4628              MOV      r0,r5
0000a8  f7fffffe          BL       I2C_GenerateSTOP
                  |L4.172|
;;;210      
;;;211      /* Test on EV7 and clear it */
;;;212      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_RECEIVED))  /* EV7 */
0000ac  4631              MOV      r1,r6
0000ae  4628              MOV      r0,r5
0000b0  f7fffffe          BL       I2C_CheckEvent
0000b4  2800              CMP      r0,#0
0000b6  d0f9              BEQ      |L4.172|
;;;213      {
;;;214      }
;;;215      
;;;216      /* Store I2C1 received data */
;;;217      RegValue |= I2C_ReceiveData(I2C1);
0000b8  4628              MOV      r0,r5
0000ba  f7fffffe          BL       I2C_ReceiveData
0000be  4320              ORRS     r0,r0,r4
;;;218    
;;;219      /* Return register value */
;;;220      return (RegValue >> 7);
0000c0  f3c010cf          UBFX     r0,r0,#7,#16
;;;221    }
0000c4  e8bd81f0          POP      {r4-r8,pc}
;;;222    
                          ENDP

                  |L4.200|
                          DCD      0x40005400
                  |L4.204|
                          DCD      0x00030001
                  |L4.208|
                          DCD      0x00070082

                          AREA ||i.I2C_LM75_Reg_Write||, CODE, READONLY, ALIGN=2

                  I2C_LM75_Reg_Write PROC
;;;232    *******************************************************************************/
;;;233    void I2C_LM75_Reg_Write(u8 RegName, u16 RegValue)
000000  e92d41f0          PUSH     {r4-r8,lr}
;;;234    {
000004  4607              MOV      r7,r0
;;;235      /* Shift left register value */
;;;236      RegValue = RegValue << 7;
000006  05c8              LSLS     r0,r1,#23
;;;237    
;;;238      /*----- Transmission Phase -----*/
;;;239      /* Send I2C1 START condition */
;;;240      I2C_GenerateSTART(I2C1, ENABLE);
000008  4d1f              LDR      r5,|L5.136|
00000a  0c04              LSRS     r4,r0,#16             ;236
00000c  2101              MOVS     r1,#1
00000e  4628              MOV      r0,r5
000010  f7fffffe          BL       I2C_GenerateSTART
;;;241      
;;;242      /* Test on I2C1 EV5 and clear it */
;;;243      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT))  /* EV5 */
000014  4e1d              LDR      r6,|L5.140|
                  |L5.22|
000016  4628              MOV      r0,r5
000018  4631              MOV      r1,r6
00001a  f7fffffe          BL       I2C_CheckEvent
00001e  2800              CMP      r0,#0
000020  d0f9              BEQ      |L5.22|
;;;244      {
;;;245      }
;;;246      
;;;247      /* Send STLM75 slave address for write */
;;;248      I2C_Send7bitAddress(I2C1, LM75_Addr, I2C_Direction_Transmitter);
000022  2200              MOVS     r2,#0
000024  2190              MOVS     r1,#0x90
000026  4628              MOV      r0,r5
000028  f7fffffe          BL       I2C_Send7bitAddress
;;;249      
;;;250      /* Test on I2C1 EV6 and clear it */
;;;251      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) /* EV6 */
00002c  4e18              LDR      r6,|L5.144|
                  |L5.46|
00002e  4628              MOV      r0,r5
000030  4631              MOV      r1,r6
000032  f7fffffe          BL       I2C_CheckEvent
000036  2800              CMP      r0,#0
000038  d0f9              BEQ      |L5.46|
;;;252      {
;;;253      }
;;;254    
;;;255      /* Send the specified register data pointer */
;;;256      I2C_SendData(I2C1, RegName);
00003a  4639              MOV      r1,r7
00003c  4628              MOV      r0,r5
00003e  f7fffffe          BL       I2C_SendData
;;;257      
;;;258      /* Test on I2C1 EV8 and clear it */
;;;259      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_TRANSMITTED)) /* EV8 */
000042  4e13              LDR      r6,|L5.144|
000044  1cb6              ADDS     r6,r6,#2
                  |L5.70|
000046  4631              MOV      r1,r6
000048  4628              MOV      r0,r5
00004a  f7fffffe          BL       I2C_CheckEvent
00004e  2800              CMP      r0,#0
000050  d0f9              BEQ      |L5.70|
;;;260      {
;;;261      }
;;;262    
;;;263      /* Send I2C1 data */
;;;264      I2C_SendData(I2C1, (u8)(RegValue >> 8));
000052  0a21              LSRS     r1,r4,#8
000054  4628              MOV      r0,r5
000056  f7fffffe          BL       I2C_SendData
                  |L5.90|
;;;265      
;;;266      /* Test on I2C1 EV8 and clear it */
;;;267      while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_TRANSMITTED)) /* EV8 */
00005a  4631              MOV      r1,r6
00005c  4628              MOV      r0,r5

⌨️ 快捷键说明

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