发新帖我要提问
12
返回列表
打印

请问如何用一节3伏纽扣电池给8051供电?

[复制链接]
楼主: sky657
手机看帖
扫描二维码
随时随地手机跟帖
21
logokfu| | 2013-5-2 11:23 | 只看该作者 回帖奖励 |倒序浏览
本帖最后由 **kfu 于 2013-5-2 11:25 编辑

再发一个,这个是个段式LCD的驱动程序。


gdw-014-01(466C).rar (87.17 KB)

#include"sn8p_init_sys.h"


void init_sys(void);

void init_sys(void)
{
unsigned char i,j;

beep_lock = false;
BEEPM = 1;
seg1_m = 1;
seg2_m= 1;
seg3_m =1;
seg4_m =1;
seg5_m =1;

Mode.OptMode = 0x00;
Mode.Number = 0x03;//上电先跑第三

FP54M=1;

TC0M = 0x54; //TC0M register value, Fcpu: 4.000000MHZ//CLK source: Fcpu
TC0C = 0x4C; //TC0C register value, time: 360.000000us(2777.777778HZ)
TC0R = 0x4C; //TC0R register value
FTC0IRQ = 0;
FTC0IEN = 1; //TC0 Interrupt enable
FTC0ENB = 1; //TC0 enable

T0M = 0x70; //T0M register value, Fcpu: 4.000000MHZ//CLK source: Fcpu
T0C = 0x9C; //T0C register value, time: 50.000000us
FT0IRQ = 0;
FT0IEN = 1; //T0 Interrupt enable
FT0ENB = 1; //T0 enable


FGIE= 1;

}


#include"sn8p_bias_lcd_driver.h"

//定义22幅画面
__ROM unsigned char

//SetMode
seg_code_1[4] = {0x40,0x20,0x68,0x20},//flash_1
seg_code_2[4] = {0x80,0xE0,0x60,0xA8},//flash_2
seg_code_3[4] = {0xC0,0x60,0x60,0x60},//flash_3

seg_code_4[4] = {0x00,0x20,0x20,0x20},//flash_none 0000 0000,0010 0000,0010 0000,0010 0000
//RunMode

seg_code_1r[28] =
{
0x40,0x20,0x68,0x20,
0x40,0x28,0x68,0x20,
0x48,0x28,0x68,0x20,
0x58,0x28,0x68,0x20,
0x58,0x38,0x68,0x20,
0x58,0x38,0x78,0x20,
0x58,0x38,0x78,0x30,
},
seg_code_2r[28] =
{
0x80,0xE0,0x60,0xA8,
0x80,0xE8,0x60,0xA8,
0x88,0xE8,0x60,0xA8,
0x98,0xE8,0x60,0xA8,
0x98,0xF8,0x60,0xA8,
0x98,0xF8,0x70,0xA8,
0x98,0xF8,0x70,0xB8,
},
seg_code_3r[28] =
{
0xC0,0x60,0x60,0xE0,
0xC0,0x68,0x60,0xE0,
0xC8,0x68,0x60,0xE0,
0xD8,0x68,0x60,0xE0,
0xD8,0x78,0x60,0xE0,
0xD8,0x78,0x70,0xE0,
0xD8,0x78,0x70,0xF0,
}
;


void dispp(unsigned char *pCode);


static void select_seg(unsigned char seg_x);

static void select_seg(unsigned char seg_x)
{
seg1 =(seg_x&0x80)>0x00?1:0;
seg2 =(seg_x&0x40)>0x00?1:0;
seg3 =(seg_x&0x20)>0x00?1:0;
seg4 =(seg_x&0x10)>0x00?1:0;
seg5 =(seg_x&0x08)>0x00?1:0;
}

void dispp(unsigned char *pCode)
{
static unsigned char ScanCount=0;

switch(ScanCount) //动态扫描显示
{
case 0: //com1正向驱动


select_seg(*pCode);
com1 = 0;
com1_m = 1;
com2_m = 0;
com3_m = 0;
com4_m = 0; //除com1输出外,其余com设为输入

break;

case 1: //com1反向驱动

select_seg(~*pCode);
com1 = 1;

break;


case 2: //com2正向驱动

select_seg(*(pCode+1));
com2 = 0;
com1_m = 0;
com2_m = 1;
com3_m = 0;
com4_m = 0;

break;

case 3: //com2反向驱动
select_seg(~*(pCode+1));
com2 = 1;

break;


case 4: //com3正向驱动

select_seg(*(pCode+2));
com3 = 0;
com1_m = 0;
com2_m = 0;
com3_m = 1;
com4_m = 0;

break;

case 5: //com3反向驱动

select_seg(~*(pCode+2));
com3 = 1;

break;

case 6: //com4正向驱动

select_seg(*(pCode+3));
com4 = 0;
com1_m = 0;
com2_m = 0;
com3_m = 0;
com4_m = 1;


break;

case 7: //com4反向驱动

select_seg(~*(pCode+3));//1111 1111
com4 = 1;
com1_m = 0;
com2_m = 0;
com3_m = 0;
com4_m = 1;



break;

default:

break;



}

ScanCount++;

if(ScanCount>=8)
{
ScanCount=0;
}
}


使用特权

评论回复
22
sky657|  楼主 | 2013-5-2 17:43 | 只看该作者
**kfu 发表于 2013-5-2 11:23
再发一个,这个是个段式LCD的驱动程序。

多谢多谢

使用特权

评论回复
23
redcar| | 2013-5-6 11:53 | 只看该作者
1个纽扣电池噢,亲
楼上都是神马人噢,叫人家在死胡同里面转,8051上1个纽扣电池噢,亲,你准备用多长时间噢.
这种方案,除了430,还是430,永远的430
过去是,现在是,将来很有可能还是,430,超低微功耗王中王

使用特权

评论回复
24
sky657|  楼主 | 2013-5-6 14:29 | 只看该作者
redcar 发表于 2013-5-6 11:53
1个纽扣电池噢,亲
楼上都是神马人噢,叫人家在死胡同里面转,8051上1个纽扣电池噢,亲,你准备用多长时间噢.
这 ...

两个纽扣电池配51,一般能用多久,能用到一年吗

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则