基于51单片机的数控电源设计

2026/1/26 18:33:13

C语言原程序:

#include

unsigned char code dispbitcode[]={0x77,0xbb,0xdd,0xee}; unsigned char code

dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00}; unsigned char dispbuf[8]={0,0,0,0,0,0,0,0}; unsigned char dispcount=0,flag; unsigned char getdata; unsigned int temp; unsigned char i,j,k; sbit ST=P3^6; sbit OE=P3^7; sbit EOC=P3^0; sbit DA=P3^5; //sbit DB=P3^4; void main(void) {

while(1) {

ST=1; ST=0;

ST=1; if(EOC==1) {

OE=0; getdata=P1; OE=1;

temp=getdata; temp=temp*100; if(DA==1)

{temp=temp/51; temp=temp*4;} else

{temp=temp/51;} dispbuf[0]=0;

dispbuf[1]=0; dispbuf[2]=0; dispbuf[3]=0; dispbuf[4]=0; dispbuf[5]=0; dispbuf[6]=0; dispbuf[7]=0; i=0;

while(temp/10)

{ dispbuf[i]=temp; temp=temp/10; i++; }

dispbuf[i]=temp; for(k=0;k<=3;k++)

{ P0=dispcode[dispbuf[k]]; P2=dispbitcode[k]; if(k==2)

P0=P0 | 0x80; for(j=0;j<=110;j++) {} } }}}


基于51单片机的数控电源设计.doc 将本文的Word文档下载到电脑
搜索更多关于: 基于51单片机的数控电源设计 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219