基于51单片机MAX6675 MAX1241的热电偶测温电机驱动系统proteus仿真 程序设计

news/2024/11/19 16:23:09/

硬件设计

(末尾附文件)

1.采用AT89C51单片机作为控制器,分别对温度采集、LCD显示。
2.温度测量模块采用K\热电偶与MAX6775相结合可实现冷端温度补偿高分辨率测量
3.显示用液晶显示屏显示实时温度值。
4. 系统结构如图2.4。
在这里插入图片描述
 硬件组成原理
本系统硬件主要由热电偶温度采集电路、MAX6675温度处理电路、89C51单片机控制电路和LCD显示电路,报警电路组成。
首先通过键盘设定温度范围,存储在24C02C存储器里,热电偶采用分度号为K的热电偶,为了减少外界信号的干扰通过双绞线跟MAX6675芯片直接相连接。MAX6675芯片通过SPI串行接口传输数据,采用的89C51单片机对带有冷端补偿的温度转换芯片MAX6675进行控制。本系统设计还具有报警的特点,当所测量的温度低于所设置的温度下限或者高于所设置的温度上限时报警电路发出警报。显示电路由89C51单片机通过1602液晶显示屏(LCD)进行显示,显示的是当前设置温度的上限与下限,以及热电偶测温的温度。

仿真图1: LCD1602为显示器,MAX1241为数据采集芯片; 可设置温度上下限,超出范围后蜂鸣器报警

在这里插入图片描述

仿真图2 LCD1602为显示器,MAX6775为数据采集芯片;可设置温度上下限,超出范围电机将被正反驱动且相应的LED会亮起
在这里插入图片描述

程序设计

#include<reg51.h>
#include<intrins.h> //包含_nop_()函数定义的头文件
#include<absacc.h>
#define uchar unsigned char
#define uint  unsigned int
#define LCD1602_DW XBYTE[65023]
#define LCD1602_CW XBYTE[64767]
#define LCD1602_CR XBYTE[65279]
sbit DOUT=P1^5;
sbit SCLK=P1^6;
sbit CS=P1^7;
uint aaaa,aa,cc;//储存A/D转换后的值
uchar num;
uint a,b,c;
sbit p10=P1^0;//按键端口
sbit p11=P1^1;//按键端口
sbit p12=P1^2;//按键端口
sbit p30=P3^0;//蜂鸣器接口
uint code table1[]={	0,3,6,9,10,15,18,21,23,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,78,81,84,87,90,93,96,99,102,105,108,112,115,118,121,124,127,130,134,137,140,143,146,149,153,156,159,162,165,169,172,175,178,181,185,188,191,194,198,201,204,207,211,214,217,220,224,227,230,233,237,240,243,246,250,253,256,260,263,266,270,273,276,280,283,286,290,293,296,300,303,306,310,313,316,320,323,326,330,333,336,340,343,346,350,353,356,360,363,366,370,373,376,380,383,387,390,393,397,400,403,407,410,413,417,420,424,427,430,434,437,440,444,447,451,454,457,461,464,467,471,474,477,481,484,487,491,494,497,501,504,508,511,514,518,521,524,528,531,534,538,541,544,548,551,554,558,561,564,567,571,574,577,581,584,587,591,594,597,600,604,607,610,614,617,620,624,627,630,633,637,640,643,646,650,653,656,659,663,666,669,673,676,679,682,686,689,692,695,699,702,705,708,711,715,718,721,724,728,731,734,737,741,744,747,750,754,757,760,763,766,770,773,776,779,783,786,789,792,796,799,802,805,809,812,815,818,821,825,828,831,834,838,841,844,847,851,854,857,860,864,867,870,873,877,880,883,886,890,893,896,899,903,906,909,913,916,919,922,926,929,932,935,939,942,945,949,952,955,958,962,965,968,972,975,978,981,985,988,991,995,998,1001,1005,1008,1011,1014,1018,1021,1024,1028,1031,1034,1038,1041,1044,1048,1051,1054,1058,1061,1064,1068,1071,1074,1078,1081,1084,1088,1091,1094,1098,1101,1104,1108,1111,1114,1118,1121,1124,1128,1131,1135,1138,1141,1145,1148,1151,1155,1158,1161,1165,1168,1171,1175,1178,1182,1185,1188,1192,1195,1198,1202,1205,1209,1212,1215,1219,1222,1225,1229,1232,1236,1239,1242,1246,1249,1252,1256,1259,1263,1266,1269,1273,1276,1279,1283,1286,1290,1293,1296,1300,1303,1307,1310,1313,1317,1320,1324,1327,1330,1334,1337,1341,1344,1347,1351,1354,1358,1361,1364,1368,1371,1375,1378,1381,1385,1388,1392,1395,1398,1402,1405,1409,1412,1415,1419,1422,1426,1429,1433,1436,1439,1443,1446,1450,1453,1456,1460,1463,1467,1470,1474,1477,1480,1484,1487,1491,1494,1497,1501,1504,1508,1511,1515,1518,1521,1525,1528,1532,1535,1539,1542,1545,1549,1552,1556,1559,1563,1566,1569,1573,1576,1580,1583,1587,1590,1594,1597,1600,1604,1607,1611,1614,1618,1621,1624,1628,1631,1635,1638,1642,1645,1649,1652,1655,1659,1662,1666,1669,1673,1676,1680,1683,1686,1690,1693,1697,1700,1704,1707,1711,1714,1717,1721,1724,1728,1731,1735,1738,1742,1745,1748,1752,1755,1759,1762,1766,1769,1773,1776,1779,1783,1786,1790,1793,1797,1800,1804,1807,1811,1814,1817,1821,1824,1828,1831,1835,1838,1842,1845,1849,1852,1855,1859,1862,1866,1869,1873,1876,1880,1883,1887,1890,1893,1897,1900,1904,1907,1911,1914,1918,1921,1925,1928,1931,1935,1938,1942,1945,1949,1952,1956,1959,1963,1966,1969,1973,1976,1980,1983,1987,1990,1994,1997,2001,2004,2007,2011,2014,2018,2021,2025,2028,2032,2035,2039,2042,2045,2049,2052,2056,2059,2063,2066,2070,2073,2076,2080,2083,2087,2090,2094,2097,2101,2104,2108,2111,2114,2118,2121,2125,2128,2132,2135,2139,2142,2145,2149,2152,2156,2159,2163,2166,2170,2173,2176,2180,2183,2187,2190,2194,2197,2201,2204,2207,2211,2214,2218,2221,2225,2228,2231,2235,2238,2242,2245,2249,2252,2256,2259,2262,2266,2269,2273,2276,2280,2283,2286,2290,2293,2297,2300,2304,2307,2310,2314,2317,2321,2324,2328,2331,2334,2338,2341,2345,2348,2352,2355,2358,2362,2365,2369,2372,2375,2379,2382,2386,2389,2393,2396,2399,2403,2406,2410,2413,2416,2420,2423,2427,2430,2434,2437,2440,2444,2447,2451,2454,2457,2461,2464,2468,2471,2474,2478,2481,2485,2488,2491,2495,2498,2502,2505,2508,2512,2515,2519,2522,2525,2529,2532,2536,2539,2542,2546,2549,2552,2556,2559,2563,2566,2569,2573,2576,2580,2583,2586,2590,2593,2596,2600,2603,2607,2610,2613,2617,2620,2623,2627,2630,2634,2637,2640,2644,2647,2650,2654,2657,2661,2664,2667,2671,2674,2677,2681,2684,2687,2691,2694,2698,2701,2704,2708,2711,2714,2718,2721,2724,2728,2731,2734,2738,2741,2744,2748,2751,2754,2758,2761,2765,2768,2771,2775,2778,2781,2785,2788,2791,2795,2798,2801,2805,2808,2811,2815,2818,2821,2825,2828,2831,2835,2838,2841,2844,2848,2851,2854,2858,2861,2864,2868,2871,2874,2878,2881,2884,2888,2891,2894,2898,2901,2904,2907,2911,2914,2917,2921,2924,2927,2931,2934,2937,2941,2944,2947,2950,2954,2957,2960,2964,2967,2970,2973,2977,2980,2983,2987,2990,2993,2997,3000,3003,3006,3010,3013,3016,3019,3023,3026,3029,3032,3036,3039,3042,3045,3049,3052,3055,3058,3061,3064,3067,3071,3074,3077,3080,3082,3085,3088,3091,3094,3096,3099,3102,3104,3106,3109,3111,3113,3115,3117,3119,3121,3123,3125,3126,3128,3130,3131,3132,3134,3135,3136,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150};
uint code table2[]={	52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909};
void delay1(uint z)
{for(z=0;z<10;z++)_nop_();
}
//判忙函数
void WHILE_BUSY()						 
{while((bit)(LCD1602_CR&128));//读回DB7的值,为DB7=1时则等待 。
}
void LCD1602_init()
{ WHILE_BUSY();//判忙,不忙继续写指令LCD1602_CW=56;//写指令,8位接口,双行显示,5*7字符WHILE_BUSY();//判忙,不忙继续写指令LCD1602_CW=1;//清屏WHILE_BUSY();//判忙,不忙继续写指令LCD1602_CW=6;//地址计数自动加一WHILE_BUSY();//判忙,不忙继续写指令LCD1602_CW=12;//开显示
}
uint read_max1241()
{uint voltage=0;		 //存放12位数字量uchar cont12=12;	     //12位CS=1;SCLK=0;CS=0;while(DOUT==0);       //转换结束SCLK=1;SCLK=0;while(cont12--){SCLK=1;              //SCLK上升沿数据稳定并读出voltage<<=1;    if(DOUT==1)voltage+=1;SCLK=0;}	 CS=1;return voltage;
}

.

文件地址

链接:https://pan.baidu.com/s/1g35SOgoVfOdbluOuerBwNg
提取码:z5q5

.


http://www.ppmy.cn/news/803677.html

相关文章

FS_S5PC100平台上Linux Camera驱动开发详解

转自&#xff1a;http://mobile.riaos.com/?p2005569 说明&#xff1a; 理解摄像头驱动需要四个前提&#xff1a; 1&#xff09;摄像头基本的工作原理和S5PC100集成的Camera控制器的工作原理 2&#xff09;platform_device和platform_driver工作原理 …

vkms驱动移植及测试程序移植(基于imx6ull平台)

移植vkms 到Linux-4.9.88内核(基于100ask_imx6ull_pro开发板) 何小龙老师-Blog主页 何小龙老师的DRM系列专栏文章&#xff0c;非常适合系统入门学习DRM&#xff0c;DRM 系列非常精彩 VKMS简介 VKMS 是 “Virtual Kernel Mode Setting” 的缩写&#xff0c;它于2018年7月5日被…

DM9000C网卡驱动程序编写与测试

一般网卡驱动程序厂商会给我们提供一份模板驱动,我们的工作就是需要根据自己的需要更改这个模板驱动1、DM9000C的硬件连接 硬件连接图如下所示:它接在S3C2440的BANK4内存控制器上,它只占用8个字节的长度,并且是16bit的位宽。 下面介绍一下DM9000C的主要引脚的功能:SD0-S…

Linux网络驱动--snull

snull是《Linux Device Drivers》中的一个网络驱动的例子。这里引用这个例子学习Linux网络驱动。 因为snull的源码,网上已经更新到适合最新内核,而我自己用的还是2.6.22.6比较旧的内核。而网上好像找不到旧版的snull。因此结合《Linux Device Drivers》把最新的snull例子移植…

在数据驱动下机械故障诊断的一些方法

机械故障是风力发电设备、航空发动机、高档数控机床等大型机械装备安全可靠运行的“潜在杀手”。故障诊断是保障机械装备安全运行的“杀手锏”。由于诊断的装备量大面广、每台装备测点多、数据采样频率高、装备服役历时长&#xff0c;所以 获取了海量的诊断数据&#xff0c;推动…

OPENWRT MT7628 驱动移植WIFI折腾记

本人所写的博客都为开发之中遇到问题记录的随笔,主要是给自己积累些问题。免日后无印象,如有不当之处敬请指正(欢迎进扣群 24849632 探讨问题),如需转载,请复制全部内容包括此行; 我手上的MT7628开发板编译后,没有无线接口,检查menuconfig后,发现MT7628需要选中kmod…

【Linux 菜鸡中心】linux 驱动模块卸载, rmmod 报错 “Segmentation fault (core dumped)”

【Linux 菜鸡中心】驱动模块卸载&#xff0c;rmmod 报错 “Segmentation fault (core dumped)” 【引子】开此专栏主要记录&#xff0c;Linux开发过程中遇到的各种菜鸡问题&#xff0c;常执鞭大笑以策之。 【菜鸡简述】&#xff1a;写一个linux驱动模块时&#xff0c;insmod正常…

linux alsa驱动讲解

转载自&#xff1a;https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/477412/ 程式前沿 幫助程式設計師解決問題&#xff0c;增加專業技能&#xff0c;提升個人能力與未來世界競爭力。 程式語言前端開發IOS開發Android 開發雲端運算人工智慧伺服器搜尋資料庫軟體開發…