共2条
1/1 1 跳转至页
msp430f149 (msp430f149)请教如何将一张固定的表格放入代码区??
问
(MSP430f149)请教如何将一张固定的表格用C语言放入代码区??
谢谢!! 答 1: 定义数组,如下面的程序
#include <MSP430x44x.h>
char digit[10] = {
0xB7, /* "0" LCD segments a+b+c+d+e+f */
0x12, /* "1" */
0x8F, /* "2" */
0x1F, /* "3" */
0x3A, /* "4" */
0x3D, /* "5" */
0xBD, /* "6" */
0x13, /* "7" */
0xBF, /* "8" */
0x3F /* "9" */
};
void main(void)
{
int i;
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
FLL_CTL0 |= XCAP14PF; // Configure load caps
LCDCTL = LCDON + LCD4MUX + LCDP2; // STK LCD 4Mux, S0-S17
BTCTL = BTFRFQ1; // STK LCD freq
P5SEL = 0xFC; // Common and Rxx all selected
for (;;)
{
for (i=0; i<7; ++i) // Display "6543210"
LCDMEM[i] = digit[i];
}
}
就是将0-9的显示代码放入了代码区。 答 2: http://bbs.zoglab.com/viewthread.ph...80&highlight=4k 答 3: const BYTE Lierda_13_19[3][38]=
{
0x00,0x10,0x92,0x92,0xD2,0x72,0xFE,0xFB,0x53,0x93,0x90,0x00,0xFC,0xFC,0x00,0x07,0xFF,0xC2,0x00,
0x03,0x03,0x03,0x01,0x00,0x00,0x1F,0x0F,0x00,0x00,0x00,0x08,0x08,0x18,0x18,0x0C,0x0F,0x07,0x00,
0x00,0x10,0x10,0x18,0x08,0x8C,0xC7,0x47,0x04,0xFC,0xFC,0x04,0x44,0xC4,0x84,0x0C,0x7C,0x00,0x00,
0x04,0x04,0x06,0x03,0x03,0x01,0x0C,0x08,0x18,0x1F,0x0F,0x00,0x00,0x00,0x01,0x07,0x0E,0x0E,0x04,
0x00,0x30,0x16,0x16,0x76,0xB4,0x08,0x08,0x0C,0x8C,0xCC,0x7F,0x3F,0x44,0xC4,0x84,0x04,0x00,0x00,
0x06,0x02,0x02,0x02,0x03,0x03,0x02,0x03,0x07,0x05,0x04,0x04,0x0C,0x0C,0x0C,0x1D,0x1F,0x0C,0x0C,
};
这样就可以了。如果你要放入指定代码区,就参考楼上的。 答 4: liaoduck 兄:
用这个CONST定义,可还占用RAM啊!
这可怎么办啊!
谢谢!! 答 1: 定义数组,如下面的程序
#include <MSP430x44x.h>
char digit[10] = {
0xB7, /* "0" LCD segments a+b+c+d+e+f */
0x12, /* "1" */
0x8F, /* "2" */
0x1F, /* "3" */
0x3A, /* "4" */
0x3D, /* "5" */
0xBD, /* "6" */
0x13, /* "7" */
0xBF, /* "8" */
0x3F /* "9" */
};
void main(void)
{
int i;
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
FLL_CTL0 |= XCAP14PF; // Configure load caps
LCDCTL = LCDON + LCD4MUX + LCDP2; // STK LCD 4Mux, S0-S17
BTCTL = BTFRFQ1; // STK LCD freq
P5SEL = 0xFC; // Common and Rxx all selected
for (;;)
{
for (i=0; i<7; ++i) // Display "6543210"
LCDMEM[i] = digit[i];
}
}
就是将0-9的显示代码放入了代码区。 答 2: http://bbs.zoglab.com/viewthread.ph...80&highlight=4k 答 3: const BYTE Lierda_13_19[3][38]=
{
0x00,0x10,0x92,0x92,0xD2,0x72,0xFE,0xFB,0x53,0x93,0x90,0x00,0xFC,0xFC,0x00,0x07,0xFF,0xC2,0x00,
0x03,0x03,0x03,0x01,0x00,0x00,0x1F,0x0F,0x00,0x00,0x00,0x08,0x08,0x18,0x18,0x0C,0x0F,0x07,0x00,
0x00,0x10,0x10,0x18,0x08,0x8C,0xC7,0x47,0x04,0xFC,0xFC,0x04,0x44,0xC4,0x84,0x0C,0x7C,0x00,0x00,
0x04,0x04,0x06,0x03,0x03,0x01,0x0C,0x08,0x18,0x1F,0x0F,0x00,0x00,0x00,0x01,0x07,0x0E,0x0E,0x04,
0x00,0x30,0x16,0x16,0x76,0xB4,0x08,0x08,0x0C,0x8C,0xCC,0x7F,0x3F,0x44,0xC4,0x84,0x04,0x00,0x00,
0x06,0x02,0x02,0x02,0x03,0x03,0x02,0x03,0x07,0x05,0x04,0x04,0x0C,0x0C,0x0C,0x1D,0x1F,0x0C,0x0C,
};
这样就可以了。如果你要放入指定代码区,就参考楼上的。 答 4: liaoduck 兄:
用这个CONST定义,可还占用RAM啊!
这可怎么办啊!
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
vscode+cmake搭建雅特力AT32L021开发环境被打赏30分 | |
【换取逻辑分析仪】自制底板并驱动ArduinoNanoRP2040ConnectLCD扩展板被打赏47分 | |
【分享评测,赢取加热台】RISC-V GCC 内嵌汇编使用被打赏38分 | |
【换取逻辑分析仪】-基于ADI单片机MAX78000的简易MP3音乐播放器被打赏48分 | |
我想要一部加热台+树莓派PICO驱动AHT10被打赏38分 | |
【换取逻辑分析仪】-硬件SPI驱动OLED屏幕被打赏36分 | |
换逻辑分析仪+上下拉与多路选择器被打赏29分 | |
Let'sdo第3期任务合集被打赏50分 | |
换逻辑分析仪+Verilog三态门被打赏27分 | |
换逻辑分析仪+Verilog多输出门被打赏24分 |