資源簡介
基于stm32的煙霧報警器程序,已經過測試。

代碼片段和文件信息
#include?“stm32f10x.h“
void?GPIO_Configuration()
{
GPIO_InitTypeDef?GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB?|?RCC_APB2Periph_GPIOC?|?RCC_APB2Periph_GPIOD?|?RCC_APB2Periph_AFIOENABLE);
GPIO_InitStructure.GPIO_Pin??=?GPIO_Pin_8?|?GPIO_Pin_9?|?GPIO_Pin_10?|?GPIO_Pin_11?|?GPIO_Pin_12?|?GPIO_Pin_13?|?GPIO_Pin_14?|?GPIO_Pin_15;
?? GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_50MHz;
?? GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_Out_PP;
GPIO_Init(GPIOC&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin??=?GPIO_Pin_2;
?? GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_50MHz;
?? GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_Out_PP;
GPIO_Init(GPIOD&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin??=?GPIO_Pin_6;
?? GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_50MHz;
?? GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_IPU;
GPIO_Init(GPIOB&GPIO_InitStructure);
}
int?main(void)
{
GPIO_Configuration();
GPIO_Write(GPIOC0xff00);
GPIO_SetBits(GPIODGPIO_Pin_2);
GPIO_ResetBits(GPIODGPIO_Pin_2);
while(1)
{
?if(GPIO_ReadInputDataBit(GPIOBGPIO_Pin_6)==0)
?{
? GPIO_Write(GPIOC0xf000);
GPIO_SetBits(GPIODGPIO_Pin_2);
GPIO_ResetBits(GPIODGPIO_Pin_2);
?}
?else
?{
? GPIO_Write(GPIOC0x0f00);
GPIO_SetBits(GPIODGPIO_Pin_2);
GPIO_ResetBits(GPIODGPIO_Pin_2);
?}
?
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????260336??2012-08-01?15:40??煙霧報警器\cute.axf
?????文件???????8826??2012-08-01?15:40??煙霧報警器\cute.hex
?????文件??????43548??2012-08-01?15:40??煙霧報警器\cute.htm
?????文件????????383??2012-08-01?15:40??煙霧報警器\cute.lnp
?????文件??????61620??2012-08-01?15:40??煙霧報警器\cute.map
?????文件????????706??2012-08-01?15:40??煙霧報警器\cute.plg
?????文件????????479??2012-07-29?17:33??煙霧報警器\cute.sct
?????文件???????1369??2012-08-01?15:40??煙霧報警器\cute.tra
????.......?????79607??2012-08-01?17:11??煙霧報警器\cute.uvopt
????.......?????16666??2012-07-29?17:37??煙霧報警器\cute.uvproj
?????文件??????22574??2012-08-01?15:40??煙霧報警器\cute_Target?1.dep
????.......?????79599??2012-08-01?10:23??煙霧報警器\cute_uvopt.bak
????.......?????????0??2012-07-29?17:26??煙霧報警器\cute_uvproj.bak
?????文件???????1361??2012-08-01?15:40??煙霧報警器\main.c
?????文件?????347465??2012-08-01?15:40??煙霧報警器\main.crf
?????文件???????2228??2012-08-01?15:40??煙霧報警器\main.d
?????文件?????378104??2012-08-01?15:40??煙霧報警器\main.o
?????文件????????322??2012-08-01?15:40??煙霧報警器\main.__i
?????文件?????347783??2012-07-29?17:33??煙霧報警器\misc.crf
?????文件???????2350??2012-07-29?17:33??煙霧報警器\misc.d
?????文件?????379316??2012-07-29?17:33??煙霧報警器\misc.o
?????文件????????121??2012-07-29?17:33??煙霧報警器\startup_stm32f10x_md.d
?????文件??????54665??2012-07-29?17:33??煙霧報警器\startup_stm32f10x_md.lst
?????文件???????6080??2012-07-29?17:33??煙霧報警器\startup_stm32f10x_md.o
?????文件?????348342??2012-07-29?17:33??煙霧報警器\stm32f10x_exti.crf
?????文件???????2680??2012-07-29?17:33??煙霧報警器\stm32f10x_exti.d
?????文件?????380188??2012-07-29?17:33??煙霧報警器\stm32f10x_exti.o
?????文件?????351281??2012-07-29?17:33??煙霧報警器\stm32f10x_gpio.crf
?????文件???????2680??2012-07-29?17:33??煙霧報警器\stm32f10x_gpio.d
?????文件?????385724??2012-07-29?17:33??煙霧報警器\stm32f10x_gpio.o
............此處省略16個文件信息
評論
共有 條評論