1. ?秒表秒表?? Դ??
2.秒表计时,按S0开始计时,源码源程并由数码管显示,秒表秒表梦幻师门源码再按S0停止。源码源程若计满1分钟结束未按S0停止,秒表秒表库里南源码则蜂鸣器报警
3.ç¨c#设计ç§è¡¨ä»£ç ç¨åº
4.å¦ä½ç¨c#åä¸ä¸ªç§è¡¨
?源码源程griffpatch作品源码?? Դ??
1)
启动visual basic6.0 ,打开一个新的秒表秒表标准工程。
2)
在窗体上Form1上添加6个标签空间(Label) 2个命令按钮(CommandButton)和1个计时器(Timer)。源码源程命令按钮的秒表秒表Caption属性分别为“启动”“停止”
Timer1的Interval属性为
Label1 Label2 Label3的Caption属性分别为“开始时间”“结束时间”“经过时间” Timer1的Enable属性为False
3)代码
Dim Starttime As Variant
Dim End time As Variant
Dim Elapsed As Variant
Private Sub cmdStart_Click()
'显示开始时间
lblStart.Caption=Time$
Starttime=Now
'启动时钟控件
Timer1.Enabled=Ture
End Sub
Private Sub cmdStop_Click()
'记录停止时间
Endtime=Now
'关闭时钟控件
Timer1.Enabled=False
'显示经过时间
lblApaed.Caption=Format(Endtime-Starttime,"hh:mm:ss"
End Sub
Private Sub Timer1_Timer()
lblStop.Caption=Time$
End Sub
以上是用VB6.0实现的
秒表计时,按S0开始计时,源码源程并由数码管显示,秒表秒表再按S0停止。源码源程若计满1分钟结束未按S0停止,秒表秒表雷达公式源码则蜂鸣器报警
使用搭配最小系统就能实现了。源码源程
关键在定时器上面,秒表秒表指定板块源码如果不需要精确的就用C写个延迟函数。
具体可参考我的空间:
单片机数码管显示数字递增
关键字: 单片机 动态扫描 数码管 整数递增 让单片机的数码管显示的数从0开始递增一直到,然后重新置0,再递增,如此循环.
还是用到了将要显示的数进行百位,十位,个位的分离.
从这篇开始,以后的程序就要注意程序的规范性,与可读性了.源代码如下(已经成功调通):
C代码
#include<reg.h>
#define uint unsigned int
#define uchar unsigned char
sbit sda = P1^0;
sbit clk = P1^1;
sbit dig1 = P1^2;
sbit dig2 = P1^3;
sbit dig3 = P1^4;
sbit dig4 = P1^ 5;
uchar code table[]={ 0x7e,0x0c,0xb6,0x9e,0xcc,0xda,0xfa,0x0e,0xfe,0xde};
uchar times;
void init();
void delay(uchar);
void write(uchar);
void display(uchar);
void main()
{
uchar i = 0;
init();
while(1)
{
display(i);
if(times>2)
{
times = 0;
i ++;
if(i==)
i = 0;
}
}
}
/** 显示一个3位的整数 **/
void display(uchar num)
{
uchar bai,shi,ge;
bai = num/;
shi = num%/;
ge = num%;
/* 显示个位 */
dig4 = 0;
write(table[ge]);
delay();
dig4 = 1;
/* 显示十位 */
dig3 = 0;
write(table[shi]);
delay();
dig3 = 1;
/* 显示百位 */
dig2 = 0;
write(table[bai]);
delay();
dig2 = 1;
}
/** 程序初始化函数 **/
void init()
{
clk = 0;
times = 0;
TMOD = 0x; //定时器模式1
TH0 = (-)/; //每毫秒产生一次中断
TL0 = (-)%;
TR0 = 1; //开始计时
EA = 1; //打开总中断开关
ET0 = 1;
}
/** 向数据码管写入一个字节数据 **/
void write(uchar u)
{
uchar i;
for(i=0;i<8;i++)
{
clk = 1;
sda = u&0x;
clk = 0;
u = u<<1;
}
}
/** 延迟函数 **/
void delay(uchar t)
{
uchar x,y;
for(x=t;x>0;x--)
for(y=;y>0;y--);
}
/** 1号中断 **/
void timer0() interrupt 1
{
TH0 = (-)/; //每毫秒产生一次中断
TL0 = (-)%;
times ++;
}
ç¨c#设计ç§è¡¨ä»£ç ç¨åº
private DateTime TimeStart = new DateTime();
private Boolean IsFirst = true;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (IsFirst)
{
TimeStart = DateTime.Now;
timer1.Enabled = true;
IsFirst = false;
}
else
{
timer1.Enabled = !timer1.Enabled;
}
}
private void button3_Click(object sender, EventArgs e)
{
TimeStart = DateTime.Now;
timer1.Enabled = false;
label1.Text = (DateTime.Now - TimeStart).ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = (DateTime.Now - TimeStart).ToString();
}
å¦ä½ç¨c#åä¸ä¸ªç§è¡¨
ç±äºç®åç¨å°äºC#çæå ³ç¥è¯ï¼ä½ä¹å没æC#çåºç¡ï¼æ以è¶çæºä¼æ£å¥½å¦ä¹ å¦ä¹ ãæ¬ç¯åæï¼è®°å½ä¸å©ç¨C#å®ç°ä¸ä¸ªç®åçç§è¡¨è®¡æ¶å¨ï¼åºæ¬çé¢å¦ä¸å¾ã
åè½è¯´æï¼ç¹å»âå¼å§âå¼å§è®¡æ¶ï¼ç¹å»âæåâæå计æ¶ï¼ç¹å»ââåæ¢ââåæ¢è®¡æ¶ï¼åç¹å»âå¼å§âï¼éæ°å¼å§è®¡æ¶ã
é¦å ï¼æ们å¨çªä½è®¾è®¡çªå£ç»åºè¯¥çé¢ï¼ç±1个Labelï¼3个buttonææãåå»æé®æ·»å äºä»¶ã
æ ¸å¿é¨åæ¯ç¨ç§è¡¨å¯¹è±¡Stopwatchåæ¶éTimerå®ç°çã
ç¨åºæºä»£ç å¦ä¸ï¼
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace ChEx
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Timer time = new Timer();
Stopwatch sw; //ç§è¡¨å¯¹è±¡
TimeSpan ts;
static int count = 1;
private void button1_Click(object sender, EventArgs e)
{
//å¼å§æé®
button2.Enabled = true;
button3.Enabled = true;
if(button2.Text == "继ç»") //å¼å§åå°ç»§ç»æé®é置为æå
button2.Text = "æå";
sw = new Stopwatch();
time.Tick += new EventHandler(time_Tick); //æ¶é触åä¿¡å·
time.Interval = 1;
sw.Start();
time.Start();
}
void time_Tick(object sender, EventArgs e)
{
ts = sw.Elapsed;
label1.Text = string.Format("{ 0}:{ 1}:{ 2}:{ 3}", ts.Hours, ts.Minutes, ts.Seconds,ts.Milliseconds/);
}
private void button3_Click(object sender, EventArgs e)
{
//åæ¢æ¶é´æé®
sw.Stop();
time.Stop();
label1.Text = string.Format("{ 0}:{ 1}:{ 2}:{ 3}", 0, 0, 0, 0);
}
private void Form1_Load(object sender, EventArgs e)
{
button2.Enabled = false;
button3.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
if (button2.Text == "æå")
{
//æåäºä»¶æé®
button2.Text = "继ç»";
sw.Stop();
time.Stop();
}
else if (button2.Text == "继ç»")
{
//继ç»äºä»¶
button2.Text = "æå";
sw.Start();
time.Start();
}
}
}
}
ç§è¡¨è¿è¡ç»æå¦å¾æ示ã
ä¸ä¸æ¥å·¥ä½ï¼å¨å·¦ä¸æ¹æ·»å ä¸ä¸ªlabelï¼å®éªå¤æ¬¡æåçåè½ï¼å³è½ä¿åç§è¡¨çå¤ä¸ªä¸é´ç»æï¼å¦è®°å½å¤ååå¦çé¿è·æ绩çæ¶åï¼æåæé®åªæ¯è®°å½å°è¾¾ç»ç¹çåå¦çæ绩ï¼è®¡æ¶è¿å¨ç»§ç»ï¼è¿ä¸ªåè½ä¸é¾å®ç°ï¼ç»èªå·±ä¹ç»åä½ä¸ä¸ªå¨æçä½å°ã
-------------------------------------------------------------------------------------------------------
以ä¸æ¯çªä½è®¾è®¡å¨èªå¨çæç代ç ï¼è¾ å©åèã
#region Windows çªä½è®¾è®¡å¨çæç代ç
/// <summary>
/// 设计å¨æ¯ææéçæ¹æ³ - ä¸è¦
/// 使ç¨ä»£ç ç¼è¾å¨ä¿®æ¹æ¤æ¹æ³çå 容ã
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(, );
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(, );
this.button1.TabIndex = 0;
this.button1.Text = "å¼å§";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(, );
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(, );
this.button3.TabIndex = 2;
this.button3.Text = "åæ¢";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.label1.Font = new System.Drawing.Font("å®ä½", F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = 3;
this.label1.Text = "0:0:0:0";
//
// button2
//
this.button2.Location = new System.Drawing.Point(, );
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(, );
this.button2.TabIndex = 4;
this.button2.Text = "æå";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.button2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.RightToLeftLayout = true;
this.Text = "ç§è¡¨";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
2024-11-27 22:29915人浏览
2024-11-27 22:26726人浏览
2024-11-27 21:341781人浏览
2024-11-27 20:322371人浏览
2024-11-27 20:002619人浏览
2024-11-27 19:56559人浏览
1.如何理解python的sqlalchemy这种orm框架?2.说说 Python çå ç¼ç¨3.程序中的类是什么?如何理解python的sqlalchemy这种orm框架?
1.php����Դ��2.本人现在没有工作,自己租了间房子,有一台电脑!我可以去做点什么让我一个月赚800元左右的事?3.怎样修该劲舞密码4.代练妈妈怎么拉黑打手 代练妈妈怎么拉黑上家php����