基于51单片机MAX6675 MAX1241的热电偶测温电机驱动系统proteus仿真 程序设计
硬件設(shè)計(jì)
(末尾附文件)
1.采用AT89C51單片機(jī)作為控制器,分別對(duì)溫度采集、LCD顯示。
2.溫度測(cè)量模塊采用K\熱電偶與MAX6775相結(jié)合可實(shí)現(xiàn)冷端溫度補(bǔ)償高分辨率測(cè)量
3.顯示用液晶顯示屏顯示實(shí)時(shí)溫度值。
4. 系統(tǒng)結(jié)構(gòu)如圖2.4。
硬件組成原理
本系統(tǒng)硬件主要由熱電偶溫度采集電路、MAX6675溫度處理電路、89C51單片機(jī)控制電路和LCD顯示電路,報(bào)警電路組成。
首先通過(guò)鍵盤設(shè)定溫度范圍,存儲(chǔ)在24C02C存儲(chǔ)器里,熱電偶采用分度號(hào)為K的熱電偶,為了減少外界信號(hào)的干擾通過(guò)雙絞線跟MAX6675芯片直接相連接。MAX6675芯片通過(guò)SPI串行接口傳輸數(shù)據(jù),采用的89C51單片機(jī)對(duì)帶有冷端補(bǔ)償?shù)臏囟绒D(zhuǎn)換芯片MAX6675進(jìn)行控制。本系統(tǒng)設(shè)計(jì)還具有報(bào)警的特點(diǎn),當(dāng)所測(cè)量的溫度低于所設(shè)置的溫度下限或者高于所設(shè)置的溫度上限時(shí)報(bào)警電路發(fā)出警報(bào)。顯示電路由89C51單片機(jī)通過(guò)1602液晶顯示屏(LCD)進(jìn)行顯示,顯示的是當(dāng)前設(shè)置溫度的上限與下限,以及熱電偶測(cè)溫的溫度。
仿真圖1: LCD1602為顯示器,MAX1241為數(shù)據(jù)采集芯片; 可設(shè)置溫度上下限,超出范圍后蜂鳴器報(bào)警
仿真圖2 LCD1602為顯示器,MAX6775為數(shù)據(jù)采集芯片;可設(shè)置溫度上下限,超出范圍電機(jī)將被正反驅(qū)動(dòng)且相應(yīng)的LED會(huì)亮起
程序設(shè)計(jì)
#include<reg51.h> #include<intrins.h> //包含_nop_()函數(shù)定義的頭文件 #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;//儲(chǔ)存A/D轉(zhuǎn)換后的值 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_(); } //判忙函數(shù) void WHILE_BUSY() {while((bit)(LCD1602_CR&128));//讀回DB7的值,為DB7=1時(shí)則等待 。 } void LCD1602_init() { WHILE_BUSY();//判忙,不忙繼續(xù)寫指令LCD1602_CW=56;//寫指令,8位接口,雙行顯示,5*7字符WHILE_BUSY();//判忙,不忙繼續(xù)寫指令LCD1602_CW=1;//清屏WHILE_BUSY();//判忙,不忙繼續(xù)寫指令LCD1602_CW=6;//地址計(jì)數(shù)自動(dòng)加一WHILE_BUSY();//判忙,不忙繼續(xù)寫指令LCD1602_CW=12;//開(kāi)顯示 } uint read_max1241() {uint voltage=0; //存放12位數(shù)字量uchar cont12=12; //12位CS=1;SCLK=0;CS=0;while(DOUT==0); //轉(zhuǎn)換結(jié)束SCLK=1;SCLK=0;while(cont12--){SCLK=1; //SCLK上升沿?cái)?shù)據(jù)穩(wěn)定并讀出voltage<<=1; if(DOUT==1)voltage+=1;SCLK=0;} CS=1;return voltage; }.
文件地址
鏈接:https://pan.baidu.com/s/1g35SOgoVfOdbluOuerBwNg
提取碼:z5q5
.
總結(jié)
以上是生活随笔為你收集整理的基于51单片机MAX6675 MAX1241的热电偶测温电机驱动系统proteus仿真 程序设计的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 语义分割深度学习方法集锦
- 下一篇: sigmoid函数的数值稳定性