欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
控制數(shù)控電位器x9313改變電位,調(diào)整液晶對(duì)比度 源程序
[打印本頁(yè)]
作者:
51hei學(xué)習(xí)技術(shù)中
時(shí)間:
2016-10-11 19:19
標(biāo)題:
控制數(shù)控電位器x9313改變電位,調(diào)整液晶對(duì)比度 源程序
0.png
(62.33 KB, 下載次數(shù): 82)
下載附件
2016-10-11 19:17 上傳
一個(gè)用51單片機(jī)控制數(shù)控電位器x9313改變電位,來(lái)調(diào)整12864液晶對(duì)比度的例子:
控制數(shù)控電位器x9313改變電位.rar
(26.14 KB, 下載次數(shù): 17)
2016-10-11 19:18 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
下面是部分源碼預(yù)覽:
/*******************************************************************
*【文 件 名】:x9313.h *
*【建立日期】:7月2日 *
*【修改日期】:7月4日 *
*【文件作用】:液晶對(duì)比度設(shè)置,共分32級(jí) *
*【說(shuō) 明】:控制數(shù)控電位器x9313改變電位,調(diào)整對(duì)比度 *
*------------------------------------------------------------------*
*【作 者】:郭鑫(ben) *
*【版 權(quán)】:國(guó)家創(chuàng)新性實(shí)驗(yàn)項(xiàng)目,編號(hào)GCS07001 *
*******************************************************************/
#ifndef _X9313_08_07_04_
#define _X9313_08_07_04_
/***************************頭文件部分*****************************/
#include <reg52.h>
#include "intrins.h"
//-------------------------管腳定義--------------------------------
sbit inc = P1^5;
sbit ud = P1^6;
sbit cs = P1^7;
/***************************函數(shù)聲明*******************************/
void short_delay();
void down_edge(void);
void un_latch(void);
void x9313(void);
void short_delay()
{
_nop_();
_nop_();
}
void down_edge(void)
{
inc = 1;
short_delay();
inc = 0;
short_delay();
}
/*******************************************************************
*【函 數(shù) 名】:un_latch *
*【修改日期】:2008年7月3日 *
*【文件作用】:不保存設(shè)置 *
*------------------------------------------------------------------*
*【備 注】:本意是想保存的 ,有問(wèn)題 *
*******************************************************************/
void un_latch(void)
{
cs = 0;
short_delay();
short_delay();
cs = 1;
short_delay();
short_delay();
}
/*******************************************************************
*【函 數(shù) 名】:x9313 *
*【修改日期】:2008年7月3日 *
*【文件作用】:控制x9313設(shè)置液晶對(duì)比度 *
*------------------------------------------------------------------*
*【備 注】: *
*******************************************************************/
void x9313(void)
{
cs = 0;
inc = 1;
lcd_cmd_w(0x01);
lcd_setposition(1,0);
lcd_str_w("顯示器對(duì)比度設(shè)置");
while(1)
{
if(key_check(3) == 1)
{
lcd_setposition(3,0);
lcd_str_w("KEY3: 對(duì)比度增強(qiáng)");
ud = 1;
short_delay();
down_edge();
delay(50);
lcd_setposition(3,0);
lcd_str_w(" ");
}
if(key_check(2) == 1)
{
lcd_setposition(3,0);
lcd_str_w("KEY2: 對(duì)比度減弱");
ud = 0;
short_delay();
down_edge();
delay(50);
lcd_setposition(3,0);
lcd_str_w(" ");
}
if(key_check(0) == 1)
{
un_latch();
lcd_setposition(3,0);
lcd_str_w("KEY0: 未保存");
delay(50);
return;
}
if(key_check(1) == 1)
{
cs = 0;
lcd_setposition(3,0);
lcd_str_w("KEY1: 已保存");
delay(50);
return;
}
}
}
#endif
復(fù)制代碼
/*******************************************************************
*【文 件 名】:keys.h *
*【建立日期】7月3日 *
*【修改日期】7月4日 *
*【文件作用】:液晶12864驅(qū)動(dòng)程序,包括所有關(guān)于液晶得函數(shù) *
*【說(shuō) 明】:操作按鍵提供直接調(diào)用函數(shù),內(nèi)部包括按鍵去抖 *
*------------------------------------------------------------------*
*【作 者】:郭鑫(ben) *
*【版 權(quán)】:國(guó)家創(chuàng)新性實(shí)驗(yàn)項(xiàng)目,編號(hào)GCS07001 *
*******************************************************************/
#ifndef _KEYS_08_07_04_
#define _KEYS_08_07_04_
/***************************頭文件部分*****************************/
#include <reg52.h>
sbit key5 = P0^5;
sbit key4 = P0^4;
sbit key3 = P0^3;
sbit key2 = P0^2;
sbit key1 = P0^1;
sbit key0 = P0^0;
/***************************函數(shù)聲明*******************************/
uchar key_check(uchar num);
/*******************************************************************
*【函 數(shù) 名】:key_check *
*【修改日期】:2008年7月3日 *
*【函數(shù)作用】:檢測(cè)按鍵情況, 1:有相應(yīng)按鍵按下 0:反之 *
*------------------------------------------------------------------*
*【備 注】: *
*******************************************************************/
uchar key_check(uchar num)
{
uchar sta;
switch(num)
{
case 0:
if(~key0)
{
delay(10);
if(~key0)
{
while(~key0);
sta = 1;
}
}
else
sta = 0;
break;
case 1:
if(~key1)
{
delay(10);
if(~key1)
{
while(~key1);
sta = 1;
}
}
else
sta = 0;
break;
case 2:
if(~key2)
{
delay(10);
if(~key2)
{
while(~key2);
sta = 1;
}
}
else
sta = 0;
break;
case 3:
if(~key3)
{
delay(10);
if(~key3)
{
while(~key3);
sta = 1;
}
}
else
sta = 0;
break;
case 4:
if(~key4)
{
delay(10);
if(~key4)
{
while(~key4);
sta = 1;
}
}
else
sta = 0;
break;
case 5:
if(~key5)
{
delay(10);
if(~key5)
{
while(~key5);
sta = 1;
}
}
else
sta = 0;
break;
}
return sta;
}
#endif
復(fù)制代碼
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1