<div><b>【上下文】</b></div>打算用超级电容+太阳能电池供电,所以功率一定要小。本来考虑AVR的,后来欣喜的发现了LPC111x系列。<div>打算用12864的液晶,能够显示基本的时间和日期(公历农历),还能够每天显示几个位图,可以是一些小幽默什么的。</div><div>最好能够加入测光还有测温的感应器件,能够显示光线是否适合读书上网。</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="line-height: 22px; "><div style="word-wrap: break-word; line-height: normal; ">除了LPC1114以外,时钟、闪存、图形液晶的选型都是一头雾水,主要是功耗的限制。</div><div style="word-wrap: break-word; line-height: normal; ">假设10法拉是电容的极限,最少在黑暗的条件下坚持20小时,工作电压是2.7~3.6V的话,平均工作电流要限制在0.125mA以内……</div></span></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><br class="Apple-interchange-newline">忘了声明,单片机方面我是菜鸟,除了大学里学的8051以外没有任何经验(大学用编码器锁存器做过简单的数字抢答器,和单片机没任何关系)</div><div>编程方面会用JAVA和Python,面对C应该不是很痛苦。</div><div><br></div><div><b>【求助】</b></div><div>1、请问有没有一种12864图形液晶可以用很低的功耗维持当前的画面呢?</div><div>2、如果有,那么时钟芯片可以每几十秒唤醒MCU然后刷新画面吗?</div><div>3、如果没有,除了把电容换成电池以外还有其他的可能设计吗?</div><div>4、另外请推荐一下比较容易上手的时钟IC和flash,flash4MB就足够了。</div><div>5、网上看到一种串口Flash,M25P32这种型号,读的电流约8mA,不知道是否容易入门……</div><div><br></div><div><b>【这里留给开发过程】</b></div><div><br></div><div><b>【结束】</b></div><div>打算30天左右做出来,外壳估计会很头疼。先感谢各位路过的、顶贴的和回复的大侠了,这厢有礼了。</div>
此帖出自
小平头技术问答
- #include "LPC11xx.h"
- #include "gpio.h"
- #include "ssp.h"
- /* MX25xx05 SPI FLASH command set*/
- #define MX25_WREN 0x06
- #define MX25_WRDI 0x04
- #define MX25_RDSR 0x05
- #define MX25_WRSR 0x01
- #define MX25_READ 0x03 // 3bytes addr followed
- #define MX25_WRITE 0x02 // 3bytes addr followed, erased to 'ff' requried
- #define MX25_PP MX25_WRITE
- #define MX25_CP 0xAD // continuios program, 3bytes addr followed
- #define MX25_SE 0x20 // sector erase 3bytes addr followed
- #define MX25_BE 0xD8 // block erase 3bytes addr followed
- #define MX25_CE 0x60
- #define MX25_DP 0xB9 // Deep Power down
- #define MX25_RDP 0xAB // Release from Deep Power down
- #define LED1_on() (GPIOSetValue(0, 1, 0))
- #define LED1_off() (GPIOSetValue(0, 1, 1))
- #define LED2_on() (GPIOSetValue(1, 8, 0))
- #define LED2_off() (GPIOSetValue(1, 8, 1))
- #define SSP0_csHigh() (GPIOSetValue(0, 3, 1))
- #define SSP0_csLow() (GPIOSetValue(0, 3, 0))
- #define SPI_BUFFER_SIZE 256
- uint8_t opBuf[4];
- uint8_t wrBuf[SPI_BUFFER_SIZE];
- uint8_t rdBuf[SPI_BUFFER_SIZE];
- void initMingIO(void){
- // init GPIO
- GPIOInit();
- GPIOSetDir(0, 1, 1); // LED1
- GPIOSetDir(1, 8, 1); // LED2
- LPC_IOCON->PIO0_3 &= ~0x07;
- GPIOSetValue(0, 3, 1);
- GPIOSetDir(0, 3, 1); // SSP0 /CS
- // init SSP
- SSP_IOConfig(0);
- SSP_Init(0);
-
- }
- void printBits(uint8_t value){
- uint32_t i = 0;
- uint8_t v = value;
- uint8_t p;
- for(p=0; p < 8; p ++){
- LED1_on();
- if(v & 0x01){
- LED2_on();
- }else{
- LED2_off();
- }
- v = v >> 1;
- for(i=0;i<0x200000;i++);
- LED2_off();
- LED1_off();
- for(i=0;i<0x200000;i++);
- }
- LED1_off();
- LED2_off();
- for(i=0;i<0x200000;i++);
- }
- /**
- Wait Untill WIP release
- **/
- void spiFlash_Wait(void){
- uint32_t i;
- uint8_t sr = 0x01;
- while(sr & 0x01){
- opBuf[0] = MX25_RDSR;
- SSP0_csLow();
- SSP_Send(0, (uint8_t *)opBuf, 1);
- SSP_Receive(0, (uint8_t *)rdBuf, 1);
- SSP0_csHigh();
- sr = rdBuf[0];
- for(i = 0; i < 100; i ++);
- }
- }
- /**
- Sector Erase 4096 bytes, least 8 bits of addr ignored.
- **/
- void spiFlash_SE(uint32_t addr){
- spiFlash_Wait();
- // send WREN
- opBuf[0] = MX25_WREN;
- SSP0_csLow();
- SSP_Send(0, (uint8_t *)opBuf, 1);
- SSP0_csHigh();
- spiFlash_Wait();
- // send SE
- opBuf[0] = MX25_SE;
- opBuf[1] = addr >> 16;
- opBuf[2] = addr >> 8;
- opBuf[3] = 0;
- SSP0_csLow();
- SSP_Send(0, (uint8_t *)opBuf, 1);
- SSP0_csHigh();
- spiFlash_Wait();
- }
- /**
- Page Programming 256 bytes, least 8 bits of addr ignored.
- **/
- void spiFlash_PP(uint32_t addr){
- spiFlash_Wait();
- // send WREN
- opBuf[0] = MX25_WREN;
- SSP0_csLow();
- SSP_Send(0, (uint8_t *)opBuf, 1);
- SSP0_csHigh();
- spiFlash_Wait();
- // PP 256 bytes
- opBuf[0] = MX25_PP;
- opBuf[1] = addr >> 16;
- opBuf[2] = addr >> 8;
- opBuf[3] = 0;
- SSP0_csLow();
- SSP_Send(0, (uint8_t *)opBuf, 4);
- SSP_Send(0, (uint8_t *)wrBuf, 256);
- SSP0_csHigh();
- spiFlash_Wait();
- }
- /**
- Page Reading 256 bytes, least 8 bits of addr ignored.
- **/
- void spiFlash_PR(uint32_t addr){
- spiFlash_Wait();
- opBuf[0] = MX25_READ;
- opBuf[1] = addr >> 16;
- opBuf[2] = addr >> 8;
- opBuf[3] = 0;
- SSP0_csLow();
- SSP_Send(0, (uint8_t *)opBuf, 4);
- SSP_Receive(0, (uint8_t *)rdBuf, 256);
- SSP0_csHigh();
- }
- void testSpiFlash(void){
- spiFlash_SE(0);
-
- wrBuf[0] = 0x55;
- wrBuf[1] = 0xAA;
- wrBuf[2] = 0x12;
- wrBuf[3] = 0x34;
- spiFlash_PP(0);
- spiFlash_PR(0);
- printBits(rdBuf[0]);
- printBits(rdBuf[1]);
- printBits(rdBuf[2]);
- printBits(rdBuf[3]);
- }
复制代码调用的代码是这样子的
- #include "LPC11xx.h"
- #include "gpio.h"
- #include "ming_io.c"
- int main(void){
-
- SystemInit();
-
- initMingIO();
- while(1){
- testSpiFlash();
- }
- }
复制代码从现在起,我有4MB的闪存可以用咯,开心^ ^
唉,编辑的时候有缩进。编辑完看不到了,严重不是“所见即所得模式”啊~
[ 本帖最后由 elulis 于 2010-11-22 00:56 编辑 ]
下一步是加上一个1K的负载电阻测试电压从2.4V降至0.8V的时间进行模拟(打算用DC-DC升压至3.3V工作了,电容器串联的容量均衡看的我好头疼……)。
一周热门 更多>