久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 1286|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

STM32F030 temperature source code源碼下載

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:425535 發(fā)表于 2018-11-13 10:26 | 只看該作者 |只看大圖 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
STM32F030
Read the temperature sensor through ADC


  1. /* Includes ------------------------------------------------------------------*/
  2. #include "main.h"
  3. #include "stdio.h"

  4. /** @addtogroup STM32F0308-Discovery_Demo
  5.   * @{
  6.   */

  7. /* Private typedef -----------------------------------------------------------*/
  8. /* Private define ------------------------------------------------------------*/
  9. /* Private macro -------------------------------------------------------------*/
  10. /* Private variables ---------------------------------------------------------*/
  11. static __IO uint32_t TimingDelay;
  12. uint8_t BlinkSpeed = 0;

  13. /* Private function prototypes -----------------------------------------------*/
  14. /* Private functions ---------------------------------------------------------*/

  15. /**
  16.   * @brief  Main program.
  17.   * @param  None
  18.   * @retval None
  19.   */
  20. float Tmp275_temperature(void);
  21. void Tmp275_Init(void);
  22. extern void lcd_init(void);
  23. void PutStr(unsigned char row,unsigned char col,unsigned char *puts);
  24. void LcmClearTXT(void);

  25. int main(void)
  26. {
  27.         float temperature;
  28.         char msg[64];
  29.         RCC_ClocksTypeDef RCC_Clocks;

  30.         /* Configure LED3 and LED4 on STM32F0308-Discovery */
  31.         STM_EVAL_LEDInit(LED3);
  32.         STM_EVAL_LEDInit(LED4);

  33.         /* Initialize User_Button on STM32F0308-Discovery */
  34.         STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO);

  35.         /* SysTick end of count event each 1ms */
  36.         RCC_GetClocksFreq(&RCC_Clocks);
  37.         SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);

  38.         /* Initiate Blink Speed variable */
  39.         BlinkSpeed = 1;
  40.        
  41.         lcd_init();
  42.         Tmp275_Init();
  43.         while(1)
  44.         {
  45.                 temperature = Tmp275_temperature();
  46.                 sprintf(msg, "溫度: %6.1f℃", temperature);
  47.                 //LcmClearTXT();
  48.                 PutStr(0, 0, " HELLO EEWORLD! ");
  49.                 PutStr(1, 0, msg);
  50.                 Delay(2000);
  51.         }
  52. //        lcd_test();
  53. //  while(1)
  54. //  {  
  55. //    /* Check if the user button is pressed */
  56. //    if(STM_EVAL_PBGetState(BUTTON_USER)== SET)
  57. //    {
  58. //      /* BlinkSpeed: 1 -> 2 -> 0, then re-cycle */
  59. //      /* Turn on LD4 Blue LED during 1s each time User button is pressed */
  60. //      STM_EVAL_LEDOn(LED4);
  61. //      
  62. //      /* wait for 1s */
  63. //      Delay(1000);
  64. //      
  65. //      /* Turn off LD4 Blue LED after 1s each time User button is pressed */
  66. //      STM_EVAL_LEDOff(LED4);
  67. //      
  68. //      /* Increment the blink speed counter */
  69. //      BlinkSpeed++;
  70. //      
  71. //      /* Default value for blink speed counter */
  72. //      if(BlinkSpeed == 3)
  73. //      {  
  74. //        BlinkSpeed = 0;
  75. //      }
  76. //    }
  77. //   
  78. //    /* Test on blink speed */
  79. //    if(BlinkSpeed == 2)
  80. //    {
  81. //      /* LED3 toggles each 100 ms */
  82. //      STM_EVAL_LEDToggle(LED3);
  83. //      
  84. //      /* maintain LED3 status for 100ms */
  85. //      Delay(100);
  86. //    }
  87. //    else if(BlinkSpeed == 1)
  88. //    {
  89. //      /* LED3 toggles each 200 ms */
  90. //      STM_EVAL_LEDToggle(LED3);
  91. //      
  92. //      /* maintain LED3 status for 200ms */
  93. //      Delay(200);
  94. //    }
  95. //    else
  96. //    {  
  97. //      /* LED3 Off */
  98. //      STM_EVAL_LEDOff(LED3);
  99. //    }
  100. //  }
  101. }

  102. /**
  103.   * @brief  Inserts a delay time.
  104.   * @param  nTime: specifies the delay time length, in 1 ms.
  105.   * @retval None
  106.   */
  107. void Delay(__IO uint32_t nTime)
  108. {
  109.   TimingDelay = nTime;

  110.   while(TimingDelay != 0);
  111. }

  112. /**
  113.   * @brief  Decrements the TimingDelay variable.
  114.   * @param  None
  115.   * @retval None
  116.   */
  117. void TimingDelay_Decrement(void)
  118. {
  119.   if (TimingDelay != 0x00)
  120.   {
  121.     TimingDelay--;
  122.   }
  123. }

  124. #ifdef  USE_FULL_ASSERT

  125. /**
  126.   * @brief  Reports the name of the source file and the source line number
  127.   *   where the assert_param error has occurred.
  128.   * @param  file: pointer to the source file name
  129.   * @param  line: assert_param error line source number
  130.   * @retval None
  131.   */
  132. void assert_failed(uint8_t* file, uint32_t line)
  133. {
  134.   /* User can add his own implementation to report the file name and line number,
  135.      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  136.   /* Infinite loop */
  137.   while (1)
  138.   {}
  139. }
  140. #endif

  141. /**
  142.   * @}
  143.   */


  144. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
復(fù)制代碼



全部資料51hei下載地址:
STM32F0308-Discovery_FW_V1.0.1_temperature.rar (1.83 MB, 下載次數(shù): 24)

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 羞羞视频免费在线 | 日韩免费网 | 九九色综合 | 在线免费观看日本视频 | 国产激情精品视频 | 欧美色性 | 精品国产乱码久久久久久影片 | 亚洲国产69 | 日韩欧美国产一区二区 | 波多野结衣一区二区三区 | 黑人精品欧美一区二区蜜桃 | 国产资源视频 | 国产一级在线观看 | 久久久久久久久久久91 | 国产精品一区二区av | hitomi一区二区三区精品 | 久久久精| 久久精品免费 | 一级片毛片 | 亚洲综合婷婷 | 亚洲高清在线 | 欧美精品一区二区三区在线播放 | 国产成人免费视频网站视频社区 | 一区二区三区视频在线观看 | 欧美精品一二区 | 国产精品久久毛片av大全日韩 | 日本不卡高清视频 | 成人在线a| 欧美精品导航 | 国产成人99久久亚洲综合精品 | av中文字幕在线观看 | 成人影院在线视频 | 亚洲国产精品成人无久久精品 | 欧美一级免费 | 国产精品一区2区 | 中文字幕国产精品 | 一区二区三区亚洲 | 黑人粗黑大躁护士 | 国产精品美女久久久久久免费 | 99久久电影 | 欧美一区二区三区的 |