標(biāo)題: stm32數(shù)據(jù)存儲(chǔ) [打印本頁(yè)]

作者: 姍姍    時(shí)間: 2014-9-30 13:14
標(biāo)題: stm32數(shù)據(jù)存儲(chǔ)
/********************1號(hào)*************************************/
int main(void)
     {

                 RCC_Configuration();
                 GPIO_Configuration();
                 USART_Configuration();                 
                 TIM4_Configuration();
                 SPI_Configuration();
                 NVIC_Configuration();
                                                                                                                
         while(1)                                                         
              {       
                  if(flag==1)                               //標(biāo)志位有效
                 {

                    flag=0;
                    Dataflash_erase_block(0);
                    delay_us(10);       
                    bufferPageWrite(present_count,12,1,FLASH_BUFFER1);
                    delay_us(10);
                    FlashPageWrite(2,present_count,12);
                    delay_us(10);   //往存儲(chǔ)芯片中寫(xiě)數(shù)據(jù)
                                        
                        AT45DB_ReadBytes(2,1,12,present_count2); //讀取存儲(chǔ)芯片中的數(shù)據(jù)
                        SendData(present_count2,12);
                        SendData(start,15);       
                       
                                                                  }

                                                                               }
                                                                               }

/********************2號(hào)*************************************/
int main(void)
     {

                 RCC_Configuration();
                 GPIO_Configuration();
                 USART_Configuration();                 
                 TIM4_Configuration();
                 SPI_Configuration();
                 NVIC_Configuration();
                AT45DB_ReadBytes(2,1,12,present_count2); //讀取存儲(chǔ)芯片中的數(shù)據(jù)
                                                                                               
         while(1)                                                         
              {       
                  if(flag==1)
           {

                   flag=0;
                    Dataflash_erase_block(0);
                    delay_us(10);       
                    bufferPageWrite(present_count,12,1,FLASH_BUFFER1);
                    delay_us(10);
                    FlashPageWrite(2,present_count,12);
                    delay_us(10);
                   SendData(present_count2,12);
                   SendData(start,15);                               
                                                                  }

                                                                               }
                                                                               }

/*****************************************************************************/
  為什么1號(hào)程序,讀取的數(shù)據(jù)正確,而2好程序讀取的數(shù)據(jù)是錯(cuò)誤的,求解釋?zhuān)x謝!
其實(shí)就是單片機(jī)剛上電后,讀取掉電前一刻的數(shù)據(jù),所以程序要按照2的那樣編程。。。。。。。。。


作者: admin    時(shí)間: 2014-9-30 13:21
存儲(chǔ)芯片是什么?
作者: 姍姍    時(shí)間: 2014-9-30 13:23
AT45DB642D
作者: 姍姍    時(shí)間: 2014-9-30 13:26
admin 發(fā)表于 2014-9-30 13:21
存儲(chǔ)芯片是什么?

AT45DB642D
作者: lshhjx    時(shí)間: 2014-10-16 15:33
樓主倒是很暢快,上來(lái)就直接上代碼。




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1