HELP I2C CMPS10 và Stm32f4???

Collapse
X
 
  • Giờ
  • Show
Clear All
new posts
  • locthanh3005
    Thành viên mới
    • Oct 2009
    • 13

    #1

    HELP I2C CMPS10 và Stm32f4???

    mình đang đọc dữ liệu từ la bàn số CMPS10 dùng mạch stm32f4 bằng mode I2C mà làm mãi không đc... mong ace giúp đỡ mình sớm... tks pà còn nha.
    PHP Code:
    #include "stm32f4_discovery.h"
    
    #define MAG_ADDRESS 0xC0 // the slave address (example)
    uint8_t data;
    uint8_t received_data[2];
    void init_I2C1(void){
        
        GPIO_InitTypeDef GPIO_InitStruct;
        I2C_InitTypeDef I2C_InitStruct;
        
        // enable APB1 peripheral clock for I2C1
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
        // enable clock for SCL and SDA pins
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
        
        /* setup SCL and SDA pins
         * You can connect I2C1 to two different
         * pairs of pins:
         * 1. SCL on PB6 and SDA on PB7 
         * 2. SCL on PB8 and SDA on PB9
         */
        GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_9; // we are going to use PB6 and PB7
        GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;            // set pins to alternate function
        GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;        // set GPIO speed
        GPIO_InitStruct.GPIO_OType = GPIO_OType_OD;            // set output to open drain --> the line has to be only pulled low, not driven high
        GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;            // enable pull up resistors
        GPIO_Init(GPIOB, &GPIO_InitStruct);                    // init GPIOB
        
        // Connect I2C1 pins to AF  
        GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1);    // SCL
        GPIO_PinAFConfig(GPIOB, GPIO_PinSource9, GPIO_AF_I2C1); // SDA
        
        // configure I2C1 
        I2C_InitStruct.I2C_ClockSpeed = 100000;         // 100kHz
        I2C_InitStruct.I2C_Mode = I2C_Mode_I2C;            // I2C mode
        I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2;    // 50% duty cycle --> standard
        I2C_InitStruct.I2C_OwnAddress1 = 0x00;            // own address, not relevant in master mode
        I2C_InitStruct.I2C_Ack = I2C_Ack_Disable;        // disable acknowledge when reading (can be changed later on)
        I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; // set address length to 7 bit addresses
        I2C_Init(I2C1, &I2C_InitStruct);                // init I2C1
        
        // enable I2C1
        I2C_Cmd(I2C1, ENABLE);
    }
    
    /* This function issues a start condition and 
     * transmits the slave address + R/W bit
     * 
     * Parameters:
     *         I2Cx --> the I2C peripheral e.g. I2C1
     *         address --> the 7 bit slave address
     *         direction --> the tranmission direction can be:
     *                         I2C_Direction_Tranmitter for Master transmitter mode
     *                         I2C_Direction_Receiver for Master receiver
     */
    void I2C_start(I2C_TypeDef* I2Cx, uint8_t address, uint8_t direction){
        // wait until I2C1 is not busy anymore
        while(I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY));
      
        // Send I2C1 START condition 
        I2C_GenerateSTART(I2Cx, ENABLE);
          
        // wait for I2C1 EV5 --> Slave has acknowledged start condition
        while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT));
            
        // Send slave Address for write 
        I2C_Send7bitAddress(I2Cx, address, direction);
          
        /* wait for I2C1 EV6, check if 
         * either Slave has acknowledged Master transmitter or
         * Master receiver mode, depending on the transmission
         * direction
         */ 
        if(direction == I2C_Direction_Transmitter){
            while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
        }
        else if(direction == I2C_Direction_Receiver){
            while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
        }
    }
    
    /* This function transmits one byte to the slave device
     * Parameters:
     *        I2Cx --> the I2C peripheral e.g. I2C1 
     *        data --> the data byte to be transmitted
     */
    void I2C_write(I2C_TypeDef* I2Cx, uint8_t data){
        I2C_SendData(I2Cx, data);
        // wait for I2C1 EV8_2 --> byte has been transmitted
        while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_TRANSMITTED));
    }
    
    /* This function reads one byte from the slave device 
     * and acknowledges the byte (requests another byte)
     */
    uint8_t I2C_read_ack(I2C_TypeDef* I2Cx){
        // enable acknowledge of recieved data
        I2C_AcknowledgeConfig(I2Cx, ENABLE);
        // wait until one byte has been received
        while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) );
        // read data from I2C data register and return data byte
        data = I2C_ReceiveData(I2Cx);
        return data;
    }
    
    /* This function reads one byte from the slave device
     * and doesn't acknowledge the recieved data 
     */
    uint8_t I2C_read_nack(I2C_TypeDef* I2Cx){
        // disabe acknowledge of received data
        I2C_AcknowledgeConfig(I2Cx, DISABLE);
        // wait until one byte has been received
        while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) );
        // read data from I2C data register and return data byte
        data = I2C_ReceiveData(I2Cx);
        return data;
    }
    
    /* This funtion issues a stop condition and therefore
     * releases the bus
     */
    void I2C_stop(I2C_TypeDef* I2Cx){
        // Send I2C1 STOP Condition 
        I2C_GenerateSTOP(I2Cx, ENABLE);
    }
    uint8_t out[] = {0,0,0,0,0,0,0};
    int main(void){
        
        init_I2C1(); // initialize I2C peripheral
      
      while (1)
      {
            I2C1->DR = 0;
     
            I2C_GenerateSTART(I2C1, ENABLE);
            I2C_Send7bitAddress(I2C1,MAG_ADDRESS,I2C_Direction_Transmitter);
            I2C_SendData(I2C1,5);
            I2C_SendData(I2C1,3);
            I2C_GenerateSTART(I2C1, DISABLE);
            I2C_GenerateSTOP(I2C1, ENABLE);
            I2C_GenerateSTOP(I2C1, DISABLE);
         
         
            I2C_GenerateSTART(I2C1, ENABLE);
            I2C_Send7bitAddress(I2C1,MAG_ADDRESS,I2C_Direction_Transmitter);
            I2C_SendData(I2C1,0x00);
            I2C_SendData(I2C1,(1<<3)|(1<<4));
            I2C_GenerateSTART(I2C1, DISABLE);
            I2C_GenerateSTOP(I2C1, ENABLE);
            I2C_GenerateSTOP(I2C1, DISABLE);
         
         
            I2C_GenerateSTART(I2C1, ENABLE);
            I2C_Send7bitAddress(I2C1,MAG_ADDRESS,I2C_Direction_Transmitter);
            I2C_SendData(I2C1,5);
            I2C_Send7bitAddress(I2C1,MAG_ADDRESS,I2C_Direction_Receiver);
         
            out[0] =      I2C_ReceiveData(I2C1);
            out[1] =      I2C_ReceiveData(I2C1);
            out[2] =      I2C_ReceiveData(I2C1);
            out[3] =      I2C_ReceiveData(I2C1);
            out[4] =      I2C_ReceiveData(I2C1);
            out[5] =      I2C_ReceiveData(I2C1);
            out[6] =      I2C_ReceiveData(I2C1);
         
            I2C_GenerateSTART(I2C1, DISABLE);
            I2C_GenerateSTOP(I2C1, ENABLE);
            I2C_GenerateSTOP(I2C1, DISABLE);
      }
    }
    
    #ifdef  USE_FULL_ASSERT
    
    /**
      * @brief  Reports the name of the source file and the source line number
      *         where the assert_param error has occurred.
      * @param  file: pointer to the source file name
      * @param  line: assert_param error line source number
      * @retval None
      */
    void assert_failed(uint8_t* file, uint32_t line)
    {
      /* User can add his own implementation to report the file name and line number,
         ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
    
      while (1)
      {}
    }
    #endif
    
    /**
      * @}
      */ 
    
    /**
      * @}
      */ 
    
    /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 
    
  • locthanh3005
    Thành viên mới
    • Oct 2009
    • 13

    #2
    ai giúp mình với

    Comment

    • locthanh3005
      Thành viên mới
      • Oct 2009
      • 13

      #3
      mình code thế này không hiều sao không lấy đc dữ liệu
      PHP Code:
      #include "stm32f4_discovery.h"
      #define SLAVE_ADDRESS 0xC0 // the slave address (example)
      
      uint8_t data;
      void init_I2C1(void){
      
          GPIO_InitTypeDef GPIO_InitStruct;
          I2C_InitTypeDef I2C_InitStruct;
      
          // enable APB1 peripheral clock for I2C1
          RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
          // enable clock for SCL and SDA pins
          RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
      
          /* setup SCL and SDA pins
           * You can connect I2C1 to two different
           * pairs of pins:
           * 1. SCL on PB6 and SDA on PB7 
           * 2. SCL on PB8 and SDA on PB9
           */
          GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; // we are going to use PB6 and PB7
          GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;            // set pins to alternate function
          GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;        // set GPIO speed
          GPIO_InitStruct.GPIO_OType = GPIO_OType_OD;            // set output to open drain --> the line has to be only pulled low, not driven high
          GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;            // enable pull up resistors
          GPIO_Init(GPIOB, &GPIO_InitStruct);                    // init GPIOB
      
          // Connect I2C1 pins to AF  
          GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1);    // SCL
          GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1); // SDA
      
          // configure I2C1 
          I2C_InitStruct.I2C_ClockSpeed = 10000;         // 100kHz
          I2C_InitStruct.I2C_Mode = I2C_Mode_I2C;            // I2C mode
          I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2;    // 50% duty cycle --> standard
          I2C_InitStruct.I2C_OwnAddress1 = 0xC0;            // own address, not relevant in master mode
          I2C_InitStruct.I2C_Ack = IS_I2C_ACK_STATE(I2C_Ack_Enable);        // disable acknowledge when reading (can be changed later on)
          I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; // set address length to 7 bit addresses
          I2C_Init(I2C1, &I2C_InitStruct);                // init I2C1
      
          // enable I2C1
          I2C_Cmd(I2C1, ENABLE);
      }
      /* This function issues a start condition and 
       * transmits the slave address + R/W bit
       * 
       * Parameters:
       *         I2Cx --> the I2C peripheral e.g. I2C1
       *         address --> the 7 bit slave address
       *         direction --> the tranmission direction can be:
       *                         I2C_Direction_Tranmitter for Master transmitter mode
       *                         I2C_Direction_Receiver for Master receiver
       */
      void I2C_start(I2C_TypeDef* I2Cx, uint8_t address, uint8_t direction){
          // wait until I2C1 is not busy anymore
          while(I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY));
      
          // Send I2C1 START condition 
          I2C_GenerateSTART(I2Cx, ENABLE);
      
          // wait for I2C1 EV5 --> Slave has acknowledged start condition
          while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT));
      
          // Send slave Address for write 
          I2C_Send7bitAddress(I2Cx, address, direction);
      
          /* wait for I2C1 EV6, check if 
           * either Slave has acknowledged Master transmitter or
           * Master receiver mode, depending on the transmission
           * direction
           */ 
          if(direction == I2C_Direction_Transmitter){
              while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
          }
          else if(direction == I2C_Direction_Receiver){
              while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
          }
      }
      
      /* This function transmits one byte to the slave device
       * Parameters:
       *        I2Cx --> the I2C peripheral e.g. I2C1 
       *        data --> the data byte to be transmitted
       */
      void I2C_write(I2C_TypeDef* I2Cx, uint8_t data){
          I2C_SendData(I2Cx, data);
          // wait for I2C1 EV8_2 --> byte has been transmitted
          while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_TRANSMITTED));
      }
      
      /* This function reads one byte from the slave device 
       * and acknowledges the byte (requests another byte)
       */
      uint8_t I2C_read_ack(I2C_TypeDef* I2Cx){
          // enable acknowledge of recieved data
          I2C_AcknowledgeConfig(I2Cx, ENABLE);
          // wait until one byte has been received
          while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) );
          // read data from I2C data register and return data byte
          data = I2C_ReceiveData(I2Cx);
          return data;
      }
      
      /* This function reads one byte from the slave device
       * and doesn't acknowledge the recieved data 
       */
      uint8_t I2C_read_nack(I2C_TypeDef* I2Cx){
          // disabe acknowledge of received data
          I2C_AcknowledgeConfig(I2Cx, DISABLE);
          // wait until one byte has been received
          while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) );
          // read data from I2C data register and return data byte
          data = I2C_ReceiveData(I2Cx);
          return data;
      }
      
      /* This funtion issues a stop condition and therefore
       * releases the bus
       */
      void I2C_stop(I2C_TypeDef* I2Cx){
          // Send I2C1 STOP Condition 
          I2C_GenerateSTOP(I2Cx, DISABLE);
          I2C_GenerateSTOP(I2Cx, ENABLE);
          
          
      }
      uint8_t received_data[2];
      int main(void){
      
          init_I2C1(); // initialize I2C peripheral
      
      
      
          while(1){
      
              I2C_start(I2C1, SLAVE_ADDRESS, I2C_Direction_Transmitter); // start a transmission in Master transmitter mode
               I2C_write(I2C1, 22); // write one byte to the slave
              I2C_write(I2C1, 1); // write another byte to the slave
              I2C_stop(I2C1); // stop the transmission
      
              while(1)
              {
                  I2C_start(I2C1, SLAVE_ADDRESS, I2C_Direction_Receiver); // start a transmission in Master receiver mode
                  received_data[0] = I2C_read_ack(I2C1); // read one byte and request another byte
                  received_data[1] = I2C_read_nack(I2C1); // read one byte and don't request another byte
                  I2C_stop(I2C1); // stop the transmission
              }
          }
      }
      
      #ifdef  USE_FULL_ASSERT
      
      void assert_failed(uint8_t* file, uint32_t line)
      {
        while (1)
        {}
      }
      #endif 
      

      Comment

      • locthanh3005
        Thành viên mới
        • Oct 2009
        • 13

        #4
        mình code thế này không hiều sao không lấy đc dữ liệu
        PHP Code:
        #include "stm32f4_discovery.h"
        #define SLAVE_ADDRESS 0xC0 // the slave address (example)
        
        uint8_t data;
        void init_I2C1(void){
        
            GPIO_InitTypeDef GPIO_InitStruct;
            I2C_InitTypeDef I2C_InitStruct;
        
            // enable APB1 peripheral clock for I2C1
            RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
            // enable clock for SCL and SDA pins
            RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
        
            /* setup SCL and SDA pins
             * You can connect I2C1 to two different
             * pairs of pins:
             * 1. SCL on PB6 and SDA on PB7 
             * 2. SCL on PB8 and SDA on PB9
             */
            GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; // we are going to use PB6 and PB7
            GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;            // set pins to alternate function
            GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;        // set GPIO speed
            GPIO_InitStruct.GPIO_OType = GPIO_OType_OD;            // set output to open drain --> the line has to be only pulled low, not driven high
            GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;            // enable pull up resistors
            GPIO_Init(GPIOB, &GPIO_InitStruct);                    // init GPIOB
        
            // Connect I2C1 pins to AF  
            GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1);    // SCL
            GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_I2C1); // SDA
        
            // configure I2C1 
            I2C_InitStruct.I2C_ClockSpeed = 10000;         // 100kHz
            I2C_InitStruct.I2C_Mode = I2C_Mode_I2C;            // I2C mode
            I2C_InitStruct.I2C_DutyCycle = I2C_DutyCycle_2;    // 50% duty cycle --> standard
            I2C_InitStruct.I2C_OwnAddress1 = 0xC0;            // own address, not relevant in master mode
            I2C_InitStruct.I2C_Ack = IS_I2C_ACK_STATE(I2C_Ack_Enable);        // disable acknowledge when reading (can be changed later on)
            I2C_InitStruct.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; // set address length to 7 bit addresses
            I2C_Init(I2C1, &I2C_InitStruct);                // init I2C1
        
            // enable I2C1
            I2C_Cmd(I2C1, ENABLE);
        }
        /* This function issues a start condition and 
         * transmits the slave address + R/W bit
         * 
         * Parameters:
         *         I2Cx --> the I2C peripheral e.g. I2C1
         *         address --> the 7 bit slave address
         *         direction --> the tranmission direction can be:
         *                         I2C_Direction_Tranmitter for Master transmitter mode
         *                         I2C_Direction_Receiver for Master receiver
         */
        void I2C_start(I2C_TypeDef* I2Cx, uint8_t address, uint8_t direction){
            // wait until I2C1 is not busy anymore
            while(I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY));
        
            // Send I2C1 START condition 
            I2C_GenerateSTART(I2Cx, ENABLE);
        
            // wait for I2C1 EV5 --> Slave has acknowledged start condition
            while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT));
        
            // Send slave Address for write 
            I2C_Send7bitAddress(I2Cx, address, direction);
        
            /* wait for I2C1 EV6, check if 
             * either Slave has acknowledged Master transmitter or
             * Master receiver mode, depending on the transmission
             * direction
             */ 
            if(direction == I2C_Direction_Transmitter){
                while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
            }
            else if(direction == I2C_Direction_Receiver){
                while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
            }
        }
        
        /* This function transmits one byte to the slave device
         * Parameters:
         *        I2Cx --> the I2C peripheral e.g. I2C1 
         *        data --> the data byte to be transmitted
         */
        void I2C_write(I2C_TypeDef* I2Cx, uint8_t data){
            I2C_SendData(I2Cx, data);
            // wait for I2C1 EV8_2 --> byte has been transmitted
            while(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_TRANSMITTED));
        }
        
        /* This function reads one byte from the slave device 
         * and acknowledges the byte (requests another byte)
         */
        uint8_t I2C_read_ack(I2C_TypeDef* I2Cx){
            // enable acknowledge of recieved data
            I2C_AcknowledgeConfig(I2Cx, ENABLE);
            // wait until one byte has been received
            while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) );
            // read data from I2C data register and return data byte
            data = I2C_ReceiveData(I2Cx);
            return data;
        }
        
        /* This function reads one byte from the slave device
         * and doesn't acknowledge the recieved data 
         */
        uint8_t I2C_read_nack(I2C_TypeDef* I2Cx){
            // disabe acknowledge of received data
            I2C_AcknowledgeConfig(I2Cx, DISABLE);
            // wait until one byte has been received
            while( !I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED) );
            // read data from I2C data register and return data byte
            data = I2C_ReceiveData(I2Cx);
            return data;
        }
        
        /* This funtion issues a stop condition and therefore
         * releases the bus
         */
        void I2C_stop(I2C_TypeDef* I2Cx){
            // Send I2C1 STOP Condition 
            I2C_GenerateSTOP(I2Cx, DISABLE);
            I2C_GenerateSTOP(I2Cx, ENABLE);
            
            
        }
        uint8_t received_data[2];
        int main(void){
        
            init_I2C1(); // initialize I2C peripheral
        
        
        
            while(1){
        
                I2C_start(I2C1, SLAVE_ADDRESS, I2C_Direction_Transmitter); // start a transmission in Master transmitter mode
                 I2C_write(I2C1, 22); // write one byte to the slave
                I2C_write(I2C1, 1); // write another byte to the slave
                I2C_stop(I2C1); // stop the transmission
        
                while(1)
                {
                    I2C_start(I2C1, SLAVE_ADDRESS, I2C_Direction_Receiver); // start a transmission in Master receiver mode
                    received_data[0] = I2C_read_ack(I2C1); // read one byte and request another byte
                    received_data[1] = I2C_read_nack(I2C1); // read one byte and don't request another byte
                    I2C_stop(I2C1); // stop the transmission
                }
            }
        }
        
        #ifdef  USE_FULL_ASSERT
        
        void assert_failed(uint8_t* file, uint32_t line)
        {
          while (1)
          {}
        }
        #endif 
        

        Comment

        • locthanh3005
          Thành viên mới
          • Oct 2009
          • 13

          #5
          toàn 4rum mà chẳng có ai giúp ak... hajz

          Comment

          • queduong
            Moderator
            • Jul 2005
            • 6781

            #6
            Nguyên văn bởi locthanh3005 Xem bài viết
            toàn 4rum mà chẳng có ai giúp ak... hajz
            Nếu mà có cmps10 thì đã giúp được rồi ... không có lấy gì mà giúp !
            --- test từng phần là sẽ làm được thôi
            1) Test I2C ( cho kết nối với 1 I2C nào đó : 24C01 chẳng hạn ) ... đọc viết dữ liệu cho ngon lành đi
            2) xem cái cmps10 có Mode kết nối không , vị trí chân cẳng , trở treo , địa chỉ đọc/ghi dữ liệu ...v.v

            cứ làm từng bước 1 mà chuẩn là chạy ngay chứ có gì ...!
            ( Phi )
            Module RF chuyên dụng điều khiển, truyền dữ liệu, thiết kế đề tài, dự án điện tử - chuyển giao công nghệ... ĐT: 0904964977 - email: dientuqueduong@yahoo.com

            Comment

            • locthanh3005
              Thành viên mới
              • Oct 2009
              • 13

              #7
              lúc đầu mình bị treo ở chổ này....
              while(!I2C_CheckEvent(I2C2, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
              nhưng mình gắn điện trở vào thì chạy đc rồi...
              nhưng bây giờ nó lại bị treo ở chổ này
              while(!I2C_CheckEvent(I2C2, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
              mọi người giúp minh với.

              Comment

              • dinhvan
                Thành viên mới
                • Apr 2014
                • 1

                #8
                bạn ơi, mình đang làm về cmps10 bạn đã từng làm cho mình xin số điện thoại để mình hỏi 1 chút được k? cảm ơn bạn nhiều, sđt mình là 0966 398222

                Comment

                Về tác giả

                Collapse

                locthanh3005 Tìm hiểu thêm về locthanh3005

                Bài viết mới nhất

                Collapse

                Đang tải...