基于单片机热电偶MAX6675温度控制
1456下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0
#include <reg51.h> #include <intrins.h> #include <math.h> #define uchar unsigned char #define uint unsigned int #define ulong unsigned long //共阳极/*0,1,2,3,4,5,6,7,8,9,*/ uchar code SEG7[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; //显示缓冲 uchar num[2]; //位码定义 sbit q1=P2^0; sbit q2=P2^1; sbit out1=P2^2; sbit out2=P2^3; //定义温度数据变量 float temp = 0; ulong x = 0; uint wendu; sbit SO=P1^0; //P1.0口与SO相连 sbit SCK=P1^1; //P1.1口与SCK相连 sbit CS=P1^2; //P1.2口与CS相连 //热电偶数据--读取温度 unsigned long Re_Convert() { uchar i; unsigned long Temp_2; Temp_2=0; CS=1; SCK=0; _nop_();_nop_(); CS=0; for(i=0;i<16;i++)//16位数据读