一款 Sauna 控制器控制器原理图

2020-01-13 18:39发布

<p> 闲话少说,上原理图。链接:https://pan.baidu.com/s/1VY-AQ1rRtxLioNI49VaMLQ&nbsp;</p><p>提取码:h667</p><p> 按钮的处理的办法很好,节约了很多IO口。</p><br> <br><p> 此处只给出数码管扫描、按键读取的函数,注意下某些IO口的模式变化。其它程序都是浮云~~~~</p><br><p> //1ms中断,用于数码管扫描、按键检测</p><br><p> void Timer0Interrupt(void) interrupt 1</p><br><p> {</p><br><p> &nbsp; &nbsp; TH0 = 0xFC;</p><br><p> &nbsp; &nbsp; TL0 = 0x18;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; //add your code here!</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; bit_con++; if(bit_con&gt;6) bit_con=0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; ms_100_con++;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; ms_1_con++;</p><br> <br><p> &nbsp; &nbsp; &nbsp; &nbsp; //关闭所有数码管,消隐</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; LED1_A = 0;LED2_A = 0;LED3_A = 0;LED4_A = 0;LED5_A = 0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; switch(bit_con)</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; {</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;case 0:&nbsp;&nbsp;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; //检测按钮</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;key_value = 0; cn_value = 0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;for(key_tab_con=0;key_tab_con&lt;8;key_tab_con++)</p><br><!--8--><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;{</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;put_one_char(~KEY_TAB[key_tab_con]);&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;//依次输出按键扫描码A-H</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if(!KEY_in) key_value = key_value + KEY_TAB[key_tab_con];</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if(!CN_in)&nbsp;&nbsp;cn_value&nbsp;&nbsp;=&nbsp;&nbsp;cn_value + KEY_TAB[key_tab_con];</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;}</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;//if(key_value) key_flg = 1;&nbsp; &nbsp; &nbsp; &nbsp; </p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;//if(cn_value) cn_flg = 1;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; //检测按钮结束</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;break;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;case 1: //LED1</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;put_one_char(Led_show_buf[0]);</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;LED1_A = 1;LED2_A = 0;LED3_A = 0;LED4_A = 0;LED5_A = 0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;break;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;case 2: //LED2</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;put_one_char(Led_show_buf[1]);</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; LED1_A = 0;LED2_A = 1;LED3_A = 0;LED4_A = 0;LED5_A = 0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;break;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;case 3: //LED3</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;put_one_char(Led_show_buf[2]);</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; LED1_A = 0;LED2_A = 0;LED3_A = 1;LED4_A = 0;LED5_A = 0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;break;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;case 4: //LED4</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;put_one_char(Led_show_buf[3]);</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; LED1_A = 0;LED2_A = 0;LED3_A = 0;LED4_A = 1;LED5_A = 0;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;break;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;case 5: //LED5</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;put_one_char(Led_show_buf[4]);</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; LED1_A = 0;LED2_A = 0;LED3_A = 0;LED4_A = 0;LED5_A = 1;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;break;</p><br> <br><p> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;default:</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; break;</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; }</p><br> &nbsp; &nbsp; &nbsp; &nbsp; <br><p> }</p><br><p> /*******************************/</p><br><p> /*&nbsp; &nbsp;*&nbsp;&nbsp;『 164写1个数码管 』 *&nbsp;&nbsp;*/</p><br><p> /*******************************/&nbsp;&nbsp;</p><br><p> void put_one_char(uchar data_char)</p><br><p> {</p><br><p> &nbsp;&nbsp;uchar temp; </p><br><p> &nbsp;&nbsp;temp=data_char;</p><br><p> &nbsp;&nbsp;P3M1 = 0x00; //P1强推挽输出</p><br><p> &nbsp;&nbsp;P3M0 = 0xbf;</p><br><p> &nbsp;&nbsp;for (i=0;i&lt;8;i++)&nbsp;&nbsp;</p><br><!--8--><p> &nbsp;&nbsp;{ </p><br><p> &nbsp; &nbsp; CLK_164 = 0;//拉低74HC164时钟 &nbsp; &nbsp; &nbsp; &nbsp; </p><br><p> &nbsp; &nbsp; if(temp&amp;0x80)</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;DAT_164 = 1;</p><br><p> &nbsp; &nbsp; else</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;DAT_164 = 0; </p><br><p> &nbsp; &nbsp; temp=temp&lt;&lt;1;//左移一位数据,先发高位&nbsp; &nbsp; &nbsp; &nbsp; </p><br><!--1--><p> &nbsp; &nbsp; CLK_164 = 1;//拉高74HC164时钟 </p><br><p> &nbsp;&nbsp;}&nbsp;&nbsp;</p><br><p> &nbsp;&nbsp;DAT_164 = 1;</p><br><p> &nbsp;&nbsp;CLK_164 = 0; </p><br> &nbsp; &nbsp;<br><p> &nbsp;&nbsp;P3M1 = 0x20; //P34、P35输入、其余强推挽输出</p><br><p> &nbsp;&nbsp;P3M0 = 0x8f; </p><br><p> &nbsp;&nbsp;_nop_();_nop_();_nop_();_nop_();</p><br><p> }</p><br> <br><p> 为了布线方便(仔细看图纸),数码管的接线也是不一般的,所以字符表也就不一般了。</p><br><p> code unsigned char SMG_1_3_5_TAB[]= {</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xC0,/*0*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xFC,/*1*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x4A,/*2*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x68,/*3*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x74,/*4*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x61,/*5*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x41,/*6*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xF8,/*7*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x40,/*8*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x60,/*9*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x7f,/*-*/ //0x50,/*A*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xbf,/* */ //0x45,/*b*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xC3,/*C*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x4C,/*d*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x43,/*E*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x53,/*F*/</p><br><p> };</p><br><p> code unsigned char SMG_2_4_TAB[]= {</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x21,/*0*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x6F,/*1*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x34,/*2*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x64,/*3*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x6A,/*4*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xE0,/*5*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xA0,/*6*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x67,/*7*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x20,/*8*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x60,/*9*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xfe,/*-*/ //0x22,/*A*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xff,/*b*/ //0xA8,/*b*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xB1,/*C*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x2C,/*d*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xB0,/*E*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0xB2,/*F*/</p><br><p> };</p><br><p> //扫描按键用的</p><br><p> code unsigned char KEY_TAB[8]={</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x01,/*A*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x02,/*B*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x04,/*C*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x08,/*D*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x10,/*E*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x20,/*F*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x40,/*G*/</p><br><p> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x80 /*H*/</p><br><p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };</p><br> <br><p> ----------------------分割线下面才是我的目的----------------------------------</p><br><p> 找人(招聘),前一段时间,有个女孩子到我们公司面试(铜山新区,润泽电气),当时你说要把目前手头的工作完成才可以~~。不巧的事,人事部门主管后来离职了,你的资料我找不到了,所以借此找找你,我的邮箱64785674在163点公司。谢谢。</p><br> <br><p> 招聘硬件设计工程师,要求:徐州人,有工作经验,工作经验要求硬件设计&gt;2年(含非常爱恋电子设计的新手)。 </p><p><br></p>
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
22条回答
liuzhengyaAVR
1楼-- · 2020-01-15 07:52
顶一下了,可惜是个初学者了。
52robot
2楼-- · 2020-01-15 12:52
帮孟兄顶一下吧,5年不回徐州,不知道电子市场的张荣举和胡萍还在开店否,当年就这么2家能买元器件的。
powermeter
3楼-- · 2020-01-15 13:49
mark
depv
4楼-- · 2020-01-15 16:45
 精彩回答 2  元偷偷看……
天堂之泪
5楼-- · 2020-01-15 22:40

QQ图片20180611160918.png (70.48 KB, 下载次数: 0)

下载附件

2018-6-11 16:09 上传


我的电路整体上跟楼主的是差不多的原理,应该也是采用类似的算法,谢谢提供思路。
gallle
6楼-- · 2020-01-16 02:41
天堂之泪 发表于 2018-6-11 16:11
我的电路整体上跟楼主的是差不多的原理,应该也是采用类似的算法,谢谢提供思路。 ...

目前直接上一个tm1629A之类的驱动芯片,连按键,带LED驱动都有了,而且还可以7级亮度调节,省空间,省焊接成本

一周热门 更多>