0',不闪烁,小数点不点亮*/
/*7290*/
while(1)
{
/*display*/
if (need==1) /*初始need=1,被显示的数据更新后need=1,做为显示更新标志need=1*/
{ writedata7290(0x64,display[4]); /*按位下载数据且译码指令:初始第四位显示'1',不闪烁,小数点不点亮*/
writedata7290(0x66,display[5]); /*按位下载数据且译码指令:初始第六位显示'1',不闪烁,小数点不点亮*/
writecmd7290(0x13,0x0); /*初始向显示缓存寄存器DpRam3写0,即第三位不点亮*/
writecmd7290(0x12,0x0); /*初始向显示缓存寄存器DpRam2写0,即第二位不点亮*/
writecmd7290(0x11,0x0); /*初始向显示缓存寄存器DpRam1写0,即第一位不点亮*/
for (i=0;i<display[6];i++)/*初始第零、一、二显示'0',不闪烁,小数点不点亮*/
writedata7290((0x60+i),display[i]);
need=0;
};
/*display*/
/* read speed and temperature and electricity*/
i=*p; /*7865状态地址(只读):0x8001 */
if(!(i&0x08)) /*电机一次测速完成时执行*/
{
r1=TH0;r1=(r1<<8)+TL0; /*将计数器所计的数值赋给r1*/
r1=(int)(r1*3/10); /*?*/
TH0=0;TL0=0;EA=0; /*将计数器清零,为下次计数做准备;关闭中断*/
P1=P1&0x3f; /* triger 555 电机测速使能*/
P1=0xff;EA=1; /*测速使能完成;开放中断*/
if(!(new&0x80)) /*初始new=0*/
if(num==1) /*初始num=1*/
new|=0x01; /*new=1*/
};
if(f1) /*初始f1=0;设置完温度后 f1=1 */
{f1=0; r3=(3*r2/2);
if(r3>0x0fff) /*D/A变换器是12位的*/
r3=0x0fff;
};
if ((r2>r1)&&(r3<0x0ff9))
r3=r3+4;
if ((r2<r1)&&(r3>0x05))
r3=r3-4;
write5618(r3+0x4000); /*转速控制,设置DAC B为输出,选择快速模式*/
/*update display array*/
switch(s) /*初始 s=1*/
{
/*测速情况*/
case 1:display[5]=1;
&
实验一转速测量与控制(四)相关范文