当前位置:网站首页>Blue Bridge Cup - minimum frame
Blue Bridge Cup - minimum frame
2022-06-29 07:30:00 【2020 robot experiment class】
Only keys and nixie tubes are included

#include "stc15.h" // Or is it REG52.h Suggestion is STC15.h
#define uchar unsigned char
#define uint unsigned int
#define FOSC 12000000L
/* Variable definitions */
uchar Trg=0,Cont=0,flag=0;
uchar menu,set,add,sub;
uchar code LedChar[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
/* Statement */
void Init();
void Timer_Init();
void BTN();
void display_u();
void Delay100us();
/* function */
void main()
{
Init();
Timer_Init();
while(1)
{
if(flag)
{
flag=0;
BTN();
if(Trg&0x08)
{
menu++;
if(menu==4) menu =1;
}
else if(Trg&0x04)
{
set++;
if(set==3) set =1;
}
else if(Trg&0x02)
{
if(menu ==3) add++;
}
else if(Trg&0x01)
{
if(menu ==3) sub++;
}
}
}
}
void timer0() interrupt 1
{
static uint flag_cnt=0,dis_cnt=0;
flag_cnt++;
if(flag_cnt==10)
{
flag=1;
flag_cnt=0;
}
dis_cnt++;
if(dis_cnt==5)
{
dis_cnt=0;
display_u();
}
}
void Init()
{
P2=0XA0;
P0=0;
P2=0X80;
P0=0XFF;
}
void BTN()
{
unsigned char dat=P3^0xff;
Trg = dat & (dat^Cont);
Cont = dat;
}
void Timer_Init()
{
AUXR |= 0x80;
TL0 = 0xCD;
TH0 = 0xD4;
TR0 = 1;
ET0 = 1;
EA = 1;
}
void display_u()
{
uchar dis[8],i;
dis[0]=0Xc1;//0Xc1 0X88
dis[1]=0XFF ;
dis[2]=0XFF;
dis[3]=0XFF;
dis[4]=0XFF;
dis[5]=0XFF;
dis[6]=0XFF;
dis[7]=0XFF;
for(i=1;i<8;i++)
{
if(dis[i]==LedChar[0])
{
dis[i]=0xff;
}
else break;
}
for(i=0;i<8;i++){
P2&=0x1f;
P0=1<<i;
P2|=0xc0;
P2&=0x1f;
P0=dis[i];
P2|=0xe0;
Delay100us();
P0=0xff;
}
P2&=0x1f;
}
void Delay100us() //@12.000MHz
{
unsigned char i, j;
i = 2;
j = 39;
do
{
while (--j);
} while (--i);
}边栏推荐
猜你喜欢

感知健康生活 赋能无界连接 ——为OpenHarmony 3.1生态构建贡献芯海力量

Autosar SWC在Simulink中Parameter的使用

IMX6DL4.1.15支持EIM总线(上)——实际操作,修改内容。

Redis of NoSQL database (II): introduction to redis configuration file
![[translation] E-Cloud. Large scale CDN using kubeedge](/img/ac/178c078589bb5bc16dbdc8f4ae9525.png)
[translation] E-Cloud. Large scale CDN using kubeedge

阿里云访问资源:NoSuchKey

WordPress adds article topping, password protection, and privacy Tags

解题-->在线OJ(十三)
![[software test] interface - Basic test process](/img/8d/f61f7d3f721a60c28fc16115c138b4.jpg)
[software test] interface - Basic test process

施努卡:什么是视觉定位系统 视觉定位系统的工作原理
随机推荐
Markdown skill tree (4): link
uva10859
项目中 if else 的代替写法
【软件测试】接口——基本测试流程
YGG pilipinas: typhoon Odette disaster relief work update
服装行业的CRM品牌供应商如何选型?
电子商务盛行,怎么提高商店转换率?
Markdown 技能树(8):代码块
YGG cooperated with Web3 platform leader to empower the creative community with Dao tools and resources
Spark RDD案例:统计每日新增用户
Markdown skill tree (3): title
Final summary spark
flutter 仿照 uiswitch
Exploring the depth of objects in JVM series
什么是测试架构师
【翻译】e-Cloud。使用KubeEdge的大规模CDN
你真的懂 “Binder 一次拷贝吗“?
uva10891
[QNX Hypervisor 2.2用户手册]6.2.1 Guest之间通信
[translation] swarmed out. Design methods for building modern applications