论坛大神
  
- 积分
- 1264
- 金钱
- 1264
- 注册时间
- 2012-4-2
- 在线时间
- 69 小时
|

楼主 |
发表于 2012-4-22 17:07:12
|
显示全部楼层
#include"EXTI.h"
#include"sys.h"
#include"display.h"
#include"delay.h"
void display(void)
{
const unsigned char table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; //共阴数码管
u8 a,b,c,d;
d = count % 10; //个
c = count / 10 % 10; //十
b = count / 100 % 10; //百
a = count / 1000 % 10; //千
RCC->APB2ENR |= 1<<3; //使能Port_B
GPIOB->CRL = 0x33333333; //低8位输出 段选
GPIOB->CRH&= 0xffff0000; //高四位 位选
GPIOB->CRH|= 0x00003333; //输出 50M
GPIOB->ODR|= 0x00000fff; //输出 高电平
outdata( table[d] );
Ud;
delay_us(222);
outdata( table[c] );
Uc;
delay_us(222);
outdata( table );
Ub;
delay_us(222);
outdata( table[a] );
Ua;
delay_us(222);
}
|
|