嵌入式STM32控制电梯面板
用点阵来显示电梯向上还是向下运动,用数码管来显示楼层数(由于灯阵显示楼层数比较困难故用数码管代替)。当按下对应的按钮,就可以去到对应层数,可上升可下降。
#include "stm32f10x.h"
#include "stm32f10x_exti.h"
#include "stm32f10x_it.h"
#define uint unsigned int
#define KEY1 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_10) //一楼按钮
#define KEY2 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_11)//二楼
#define KEY3 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_12)//三楼
#define KEY4 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_13)//四楼
#define KEY5 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_14)//五楼
#define KEY6 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_15)//六楼
void Delay(void);
void IO_Init(void);
void Smg_Init(void);
void Key_Init(void);
void exit_config(void);
uint b,c,temp,stagepan;
uint stagetemp=1;
uint stage=0;
uint count=1;
uint a=1;
uint arr[]={
0xffff,0xfe7f,0xfc3f,0xf81f,0xf00f,0xfe7f,0xfe7f,0xfe7f,
0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f}; //点阵上升箭头
uint dig[]={
0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,0xfe7f,
0xfe7f,0xfe7f,0xfe7f,0xf00f,0xf81f,0xfc3f,0xfe7f,0xffff}; //点阵下降箭头
uint table[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,