0-12V程控PWM步进可调
#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 ADDKEY=P1^3;
sbit SUBKEY=P3^5;
sbit S0V=P1^0;
sbit S5V=P1^1;
sbit S12V=P1^2;
sbit COM4=P2^7;
sbit COM3=P2^6;
sbit COM2=P2^5;
sbit COM1=P2^4;
unsigned char st=0;
unsigned int SetData=50;
unsigned char bai=0,shi=0,ge=0;
code unsigned int VData[151]= //输出电压对应的DA值
{0,5,10,15,19,24,27,32,36,41,45,
50,54,58,63,67,72,76,81,85,90,
94,99,103,108,112,117,121,125,130,135,
139,144,148,153,157,162,166,171,175,180,
185,189,193,198,202,207,211,216,220,224,
229,234,238,242,247,252,256,260,265,270,
274,278,282,287,291,296,300,305,309,314,
318,323,327,332,336,340,345,350,354,358,
363,367,372,376,381,385,389,394,398,403,
408,412,417,421,425,430,435,440,444,448,
453,457,461,466,470,475,479,483,488,492,
497,501,506,510,515,519,523,528,532,537,
541,546,550,556,560,565,569,573,577,583,
586,591,595,600,604,609,613,618,622,627,
630,635,640,644,649,652,658,662,667,671
};
code unsigned int VData1[151]= //输出电压对应的DA值
{0,5,9,13,18,22,27,31,36,40,45,
49,54,59,63,68,72,77,81,86,90,
95,99,104,108,113,117,122,126,131,135,
140,144,149,153,158,162,167,171,176,180,
185,189,194,198,203,207,212,216,221,225,
230,234,239,243,248,252,257,261,266,271,
275,280,284,289,293,298,302,307,311,315,
320,325,329,334,338,343,347,352,356,361,
365,370,374,379,383,388,392,397,401,406,
411,415,420,424,429,433,438,442,447,451,
454,458,463,467,472,476,481,485,490,494,
499,503,508,512,517,521,526,530,535,539,
544,548,553,558,562,567,571,576,580,585,
589,594,598,603,607,612,616,621,625,630,
634,639,643,648,652,657,661,666,670,675
};
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部1条评论
快来发表一下你的评论吧 !