找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

帖子
查看: 3074|回復: 4
收起左側(cè)

STM32單片機控制的智能加濕系統(tǒng)程序與Proteus仿真圖

[復制鏈接]
ID:607623 發(fā)表于 2022-6-19 16:16 | 顯示全部樓層 |閱讀模式
此仿真具有定時功能,在一定的時間內(nèi)打開加濕器,通過繼電器來控制加濕器的打開與關(guān)閉,數(shù)碼管顯示倒計時,LED燈知識當前狀態(tài)
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
51hei.gif 2YVYG3~_N5VJ$Z6B(U@)5LW.png
使用繼電器,通過單片機定時器控制繼電器開關(guān),模擬定時開關(guān)加濕器

單片機源程序如下:
  1. #include "stm32f10x.h"
  2. #include "bsp_SysTick.h"
  3. uint8_t table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};

  4. int main(void)
  5. {
  6.         GPIO_InitTypeDef GPIO_InitStructure;         
  7.         
  8.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
  9.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|\
  10.                                       GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;
  11.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  12.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
  13.         GPIO_Init(GPIOB, &GPIO_InitStructure);
  14.         
  15.         GPIO_SetBits(GPIOB,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|\
  16.                            GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7);
  17.         
  18.         RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  19.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2;
  20.         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  21.         GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
  22.         GPIO_Init(GPIOA, &GPIO_InitStructure);
  23.         
  24.         GPIO_SetBits(GPIOA,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2);
  25.         
  26.         SysTick_Init();
  27.         while(1)
  28.         {
  29.                 uint8_t i;
  30.                 for(i=0;i<10;i++)        
  31.                 {
  32.                         GPIO_Write(GPIOB, ~table[i]);
  33.                         Delay_ms(200);
  34.                         if( i>= 5 )
  35.                         {
  36.                                 GPIO_ResetBits(GPIOA,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2);
  37.                         }
  38.                         else
  39.                         {
  40.                                 GPIO_SetBits(GPIOA,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2);
  41.                         }
  42.                 }
  43.                
  44.         }
  45.         
  46.             
  47. }
復制代碼

Keil5代碼與Proteus8.8仿真下載:
8.8仿真和代碼.7z (359.38 KB, 下載次數(shù): 88)

評分

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

查看全部評分

回復

使用道具 舉報

ID:95059 發(fā)表于 2022-6-23 22:56 | 顯示全部樓層
仿真用什么打開?沒見過這種文件,慘了
回復

使用道具 舉報

ID:850465 發(fā)表于 2022-6-25 17:31 | 顯示全部樓層
lanxichang 發(fā)表于 2022-6-23 22:56
仿真用什么打開?沒見過這種文件,慘了

Proteus8.8
回復

使用道具 舉報

ID:1035505 發(fā)表于 2022-6-26 08:50 來自觸屏版 | 顯示全部樓層
沒有仿真protues8.8,8.9可以嗎?
回復

使用道具 舉報

ID:850465 發(fā)表于 2022-6-27 17:41 | 顯示全部樓層
2165723703 發(fā)表于 2022-6-26 08:50
沒有仿真protues8.8,8.9可以嗎?

這種軟件一般都會兼容老版本,新軟件應該可以打開老版本文件
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

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

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

快速回復 返回頂部 返回列表