1。功能说明:按下按钮,数码管从0计数,到9复位为0,继续显示。
2。代码如下:欢迎大家优化为最佳代码。
/*
Date : 20091010
For : button drive led
Tool : HT IDE 3000 V7.0
MCU : HT48R50A-1
Fsys : 4MHz
ASM/C: C
VPM : yes
*/
#include "self-HT48R50A-1.h"
//for Segs-Com0
#define SegsPort _pa
#define SegsCtrl _pac
#define PtrPort _pb6
#define PtrCtrl _pbc6
#define Com0Port _pb7
#define Com0Ctrl _pbc7
//for Button
#define swPort _pc0 //switch port
#define swCtrl _pcc0 //switch controlling
//variable
int iCntButton;
//function
int getSwitchStatus(void);
void blinkSegs(int);
//the main function
void main(void)
{
int i;
SegsPort = 0x00; //turn off segs
SegsCtrl =

本文介绍如何使用HT IDE 3000 VPM软件仿真,实现按下按钮后数码管从0到9计数并循环显示的电路设计。提供源代码,欢迎优化。

511

被折叠的 条评论
为什么被折叠?



