C单片机温度闭环控制实验程序.doc

C单片机温度闭环控制实验程序.doc

ID:25051421

大小:55.51 KB

页数:8页

时间:2018-11-16

C单片机温度闭环控制实验程序.doc_第1页
C单片机温度闭环控制实验程序.doc_第2页
C单片机温度闭环控制实验程序.doc_第3页
C单片机温度闭环控制实验程序.doc_第4页
C单片机温度闭环控制实验程序.doc_第5页
资源描述:

《C单片机温度闭环控制实验程序.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、#include#include#includevoidpid(void)//PID算法子程序voidinit(void)//初始化子程序voiddisplay(void)//延时子程序voidclear()//清零子程序intmmul(intx,inty)//16位乘法,溢出赋极值intmadd(intx,inty)//16位加法,溢出赋极值intchange32_16(intx,intt)//32——16charchange16_8(intwd)//16——8#d

2、efineC8255_AXBYTE[0x7F00]#defineC8255_BXBYTE[0x7F01]#defineC8255_CXBYTE[0x7F02]#defineC8255_CONXBYTE[0x7F03]#defineAD0809XBYTE[0xFEFF]//定义AD0809的地址sbitP17=P1^7;//PWM的驱动charTS=0x64;//采样周期intX=0x80;charSPEC=0x28;//给定:要求达到的温度值charIBAND=0x60;//积分分离值:PID算法中积分分离值intKP=

3、12;//比例系数:PID算法中比例项系数charKI=20;//积分系数charKD=32;//微分系数intCK;//控制量:PID算法产生用于控制的量intTC;//采样周期变量charFPWM;//PWM脉冲中间标识位intCK_1;//控制量变量,用于记录上次控制的值intAAAA;//PWM高电平脉冲时间计算intVAA;//AAAA变量intBBB;//PWM低电平脉冲时间计算intVBB;//BBB变量intTKMARK;//采样标志值intADMARK;//AD转换结束标志位intADVALUE;//A

4、D采样后保存intYK;//反馈:测量温度值intEK;//温度误差intEK_1;intAEK;intBEK;unsignedchardis;//BCD码显示unsignedcharled[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};unsignedcharb[]={0x00,0x00,0x00,0x00};//位选/********************温度表**************/unsignedcharcodea[0x100]={0x14,0

5、x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1e,0x1f,0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x31,0x32,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x40

6、,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x61,0x62,0x63,0x64,0x64,0x65,0x65,0x66,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6e,0x6f,0x

7、6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,0x80,0x81,0x82,0x83,0x84,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9f,

8、0x9f,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb0,0xb1,0xb2,0xb3,0xb4,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbd

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。