基于51单片机数控直流稳压电源.rar

  • g9_478853
    了解作者
  • C/C++
    开发工具
  • 197.1KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-02-27 20:11
    上传日期
本电路进过测试和改进 已经基本上机就可以用了 可以用来做毕业设计的仿真 里面代码齐全 硬件电路完整
基于51单片机数控直流稳压电源.rar
  • 基于51单片机数控直流稳压电源
  • Test.OBJ
    16.4KB
  • Test.PWI
    1.4KB
  • Test.Uv2.bak
    1.9KB
  • Test_Uv2.Bak
    0B
  • Test.DSN
    162.8KB
  • Test.uvgui.Administrator
    68.9KB
  • Test_uvopt.bak
    55.1KB
  • Test.lnp
    40B
  • Test.opt.bak
    928B
  • SER_DAC.build_log.htm
    374B
  • Test.hex
    7.8KB
  • Test_Opt.Bak
    926B
  • Test.M51
    16.4KB
  • Test.uvopt
    55.1KB
  • Test.pdf
    96.9KB
  • Last Loaded Test.DBK
    162.9KB
  • Test_uvproj.bak
    13.3KB
  • Test.pdsprj.A5V0OIRXDAU51JA.Administrator.workspace
    2.2KB
  • Test.uvproj
    12.9KB
  • Last Loaded Test.pdsbak
    27.8KB
  • Test.uvgui_Administrator.bak
    68.8KB
  • Test.build_log.htm
    388B
  • Test.SchDocPreview
    35.8KB
  • Test.c
    8.3KB
  • Test.LST
    19.1KB
内容介绍
#include <reg52.h>//头文件 #include <intrins.h> #define uchar unsigned char//宏定义 #define uint unsigned int//宏定义 sbit SCLK=P2^1;//TLC5615时钟线 sbit CS=P2^2;//TLC5615片选 sbit DIN=P2^0;//TLC5615数据线 sbit led = P3^7; sbit led1 = P3^6; sbit ADDKEY=P3^0; sbit SUBKEY=P3^1; sbit ADDKEY1=P3^2; sbit SUBKEY1=P3^3; sbit S0=P3^4; sbit S1=P2^3; sbit S2=P3^5; sbit S0V=P1^0; sbit S5V=P1^1; sbit S10V=P1^2; sbit S12V=P1^3; sbit S15V=P1^4; sbit S20V=P1^5; sbit S24V=P1^6; sbit S30V=P1^7; sbit COM4=P2^7; sbit COM3=P2^6; sbit COM2=P2^5; sbit COM1=P2^4; unsigned char st=0; unsigned int SetData=00; unsigned char bai=0,shi=0,ge=0; code unsigned int VData1[201]= //输出电压对应的DA值 {0,5,9,14,18,23,27,32,36,41,45,//0-1.0 50,54,59,63,68,72,77,81,86,90,//1.1-2.0 95,99,104,108,113,118,122,127,131,136,//2.1-3.0 140,145,149,154,158,163,167,172,176,181,//3.1-4.0 185,190,194,199,203,208,213,217,222,226,//4.1-5.0 231,235,240,244,249,253,258,262,267,271,//5.1-6.0 276,280,285,289,294,298,303,308,312,317,//6.1-7.0 321,326,330,335,339,344,348,353,357,362,//7.1-8.0 366,371,375,380,384,389,393,398,402,407,//8.1-9.0 412,416,421,425,430,434,439,443,448,452,//9.1-10.0 457,461,466,470,475,479,483,488,492,497,//10.1-11.0 501,506,510,515,519,523,528,532,537,541,//11.1-12.0 546,550,556,560,565,569,573,577,583,586,//12.0-13.0 591,595,600,604,609,613,618,622,627,631,//13.1-14.0 636,640,645,649,654,658,663,667,672,676,//14.1-15.0 681,685,690,694,699,703,708,713,717,722,//15.1-16.0 727,731,736,740,745,749,754,759,763,767,//16.1-17.0 771,776,780,785,790,794,799,804,809,814,//17.1-18.0 818,825,829,834,839,844,849,854,858,864,//18.1-19.0 870,874,879,883,888,892,897,901,906,910//19.1-20.0 }; code unsigned int VData[341]= //输出电压对应的DA值 {0,3,6,9,12,15,18,21,24,27,30,//0-1.0 33,36,39,42,45,48,51,54,57,60,//1.1-2.0 63,66,69,72,75,78,81,84,87,90,//2.1-3.0 93,96,99,102,105,108,111,114,117,120,//3.1-4.0 123,126,129,132,135,138,141,144,147,150,//4.1-5.0 153,156,159,162,165,168,171,174,177,180,//5.1-6.0 183,186,189,192,195,198,201,204,207,210,//6.1-7.0 213,216,219,222,225,228,231,234,237,240,//7.1-8.0 243,246,249,252,255,258,261,264,267,270,//8.1-9.0 273,276,279,282,285,288,291,294,297,300,//9.1-10.0 303,306,309,312,315,318,321,324,327,330,//10.1-11.0 333,336,339,342,345,348,351,354,357,360,//11.0-12.0 363,366,369,372,375,378,381,384,387,390,//12.1-13.0 393,396,399,402,405,408,411,414,417,420,//13.1-14.0 423,426,429,432,435,438,441,444,447,450,//14.1-15.0 453,456,459,462,465,468,471,474,477,480,//15.1-16.0 483,486,489,492,495,498,501,504,507,510,//16.1-17.0 513,516,519,522,525,528,531,534,537,540,//17.1-18.0 543,546,549,552,555,558,561,564,567,570,//18.1-19.0 573,576,579,582,585,588,591,594,597,600,//19.1-20.0 603,606,609,612,615,618,621,624,627,630,//20.1-21.0 633,636,639,642,645,648,651,654,657,660,//21.1-22.0 663,666,669,672,675,678,681,684,687,690,//22.1-23.0 693,696,699,702,705,708,711,714,717,720,//23.1-24.0 723,726,729,732,735,738,741,744,747,750,//24.1-25.0 753,756,759,762,765,768,771,774,777,780,//25.1-26.0 783,786,789,792,795,798,801,804,807,810,//26.1-27.0 813,816,819,822,825,828,831,834,837,840,//27.1-28.0 843,846,849,852,855,858,861,864,867,870,//28.1-29.0 873,876,879,882,885,888,891,894,897,900,//29.1-30.0 903,906,909,912,905,908,911,914,917,910,//30.1-31.0 913,916,919,922,925,928,931,934,937,940,//31.1-32.0 943,946,949,952,955,958,961,964,967,970,//32.1-33.0 973,976,979,982,985,988,991,994,997,999//33.1-34.0 }; //*********************************共阴*******************************// unsigned char code DSYC[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x27,0x7f,0x6f,0x3e}; unsigned char code DSYC1[]={0x00,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x27,0x7f,0x6f,0x3e}; /*****************************************************/ void DAConvert(uint Data) //DAC转换程序 { uchar i; Data<<=6;//数据左移6位,右边对齐 SCLK=0; CS=0; for (i=0;i<12;i++)// { if(Data&0x8000) DIN=1; else DIN=0; SCLK=1; Data<<=1; SCLK=0; } CS=1; } void delayms(uint ms) //延时xx毫秒 { uchar i; while(ms--) { for(i=0;i<120;i++); } } void Timer0() interrupt 1 { TH0 = (65535-500)/256; TL0 = (65535-500)%256; switch(st) { case 0: st=1;COM1=1;COM2=1;COM3=1;COM4=1;P0=DSYC1[bai];COM1=0;break; case 1: st=2;COM1=1;COM2=1;COM3=1;COM4=1;P0=DSYC[shi]|0x80;COM2=0;break; case 2: st=3;COM1=1;COM2=1;COM3=1;COM4=1;P0=DSYC[ge];COM3=0;break; case 3: st=0;COM1=1;COM2=1;COM3=1;COM4=1;P0=DSYC[10];COM4=0;break; } } /*****************************************************/ void main(void) { unsigned int temp=0; delayms(100); TMOD = 0x01; TH0 = (65535-1000)/256; TL0 = (65535-1000)%256; EA=1; ET0=1; TR0=1; DAConvert(VData[00]); SetData=00; bai=SetData/100; shi=SetData%100/10; ge=SetData%10; while(1) { if(ADDKEY==0) { delayms(20); if(ADDKEY==0) { if(SetData<300) SetData++; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(ADDKEY==0); } if(ADDKEY1==0) { delayms(20); if(ADDKEY1==0) { if(SetData<300) SetData+=10; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(ADDKEY1==0); } if(SUBKEY==0) { delayms(20); if(SUBKEY==0) { if(SetData>0) SetData--; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(SUBKEY==0); } if(SUBKEY1==0) { delayms(20); if(SUBKEY1==0) { if(SetData>9) SetData-=10; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(SUBKEY1==0); } if(S0==0) { delayms(20); if(S0==0) { led=0; led1=0; delayms(100); led1=1; } while(S0==0); } if(S1==0) { delayms(20); if(S1==0) { led=1; led1=0; delayms(300); led1=1; delayms(200); led1=0; delayms(300); led1=1; delayms(200); led1=0; delayms(300); led1=1; delayms(200); led1=0; delayms(300); led1=1; delayms(200); led1=0; delayms(300); led1=1; } while(S1==0); } if(S2==0) { delayms(20); if(S2==0) { led=1; led1=0; delayms(500); led1=1; } while(S2==0); } if(S0V==0) { delayms(20); if(S0V==0) { SetData=0; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(S0V==0); } if(S5V==0) { delayms(20); if(S5V==0) { SetData=50; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(S5V==0); } if(S10V==0) { delayms(20); if(S10V==0) { SetData=100; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(S10V==0); } if(S12V==0) { delayms(20); if(S12V==0) { SetData=120; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(S12V==0); } if(S15V==0) { delayms(20); if(S15V==0) { SetData=150; DAConvert(VData[SetData]); bai=SetData/100; shi=SetData%100/10; ge=SetData%10; } while(S15V==0); } if(S20V==0) { delayms(20); if(S20V==0) { SetData=200; DAConvert(VDa
评论
    相关推荐
    • 单片机课件
      能够帮助同学们快速的了解单片机并对于单片机的一些设计程序有一定的认知
    • 单片机课件
      单片机的课件及例题, 单片机的课件及例题, 单片机的课件及例题, 单片机的课 件及例题,
    • 爱上单片机
      一本电子爱好者都能看懂,会边看边笑的单片机入门书籍,作者杜洋曾在《无线电》上发表过“趣味单片机制作专题”、“单片机编程魔法学校”等深受读者喜爱、让无数单片机入门者热血沸腾的系列文章。本书通过生动的语言...
    • 单片机资料
      内含30个单片机应用开发的资料,包括配套单片机入门PPT。
    • 单片机课件
      单片机课的课件,对单片机的基础进行了全面的概述,也有非常精细的指导。
    • 单片机工具
      单片机工具 供单片机学习使用 免费资源 日后还会有更多资源 请联系我
    • 单片机课件
      单片机课件 ppt文件格式 介绍了单片机的结构、程序设计、定时器、中断等
    • 单片机教程
      这是一个单片机的教程,可以用于初次学习单片机的人学习。
    • 单片机入门
      很好的单片机学习资源,入门比较好适合对单片机的学习有兴趣的人,而且是名校的精彩讲解,
    • 爱上单片机
      《爱上单片机》本书是一本电子爱好者都能看懂,会边看边笑的单片机入门书籍,作者杜洋曾在《无线电》上发表过“趣味单片机制作专题”、“单片机编程魔法学校”等深受读者喜爱、让无数单片机入门者热血沸腾的系列文章...