This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS:12按钮键盘

Guru**** 2595770 points
Other Parts Discussed in Thread: MSP430G2553

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/637919/ccs-12-button-keypad

主题中讨论的其他部件:MSP430G2553

工具/软件:Code Composer Studio

您好,

我的代码有问题。 我需要让MSP430在LCD上显示12按钮键盘的值。 你可以通过任何方式查看我的代码并给我一些见解。

#include <msp430g2553.h>
#include "keypad12.h"
#include "flashmem.h"
#include "lcdLib.h"
包含"common.h"

CHAR标准解码(CHAR密钥代码2解码);
字符一[5]={0};
字符2[5]={0};
字符3[5]={0};
char gotkey =0;
char getKey =0;
字符键=0;

int main (void){
WDTCTL = WDTPW | WDTHOLD;//停止看门狗计时器
lcdInit();//初始化lcd。整数


Keypad12Config (BIT3 + BIT4 + BIT5 + BIT6,BIT0 + BIT1 + BIT1,端口1,端口1,10);//端口1 (不包括WFP 1.7)的所有端口

volatile char gotkey =0,key =0;//在'expressions'选项卡中查看这些变量。

而(1){

int h = 0;
INT I = 0;

如果(h == 0)

gotkey = 0;
键= 0;
密钥=标准解码(getKey12(1));

IF (键=='#')

gotkey = 0;
键= 0;

同时(i < 4){

delay_ms(500);

密钥=标准解码(getKey12(1));
一[I]=键;

lcdSetText(one, 0,0);

delay_ms(500);
I++;

}

H++;
闪擦除(0x1080);
闪存写入(one,segmentB,block,3);
键= 0;
}
//段B
//flashMove (0xE800,0xE600,块,3);
IF (key =='*')

闪擦除(0x1080);
//lcdInit();
lcdClar();
lcdSetText ("XXXX",0,0);
}
}
如果(h == 1)

lcdClar();
gotkey = 0;
键= 0;
密钥=标准解码(getKey12(1));

IF (键=='#')

gotkey = 0;
键= 0;
i=0;

同时(i < 4){

delay_ms(500);
密钥=标准解码(getKey12(1));
两个[I]=键;

lcdSetText(&2),12,1);

delay_ms(500);
I++;
}
H++;

闪擦除(0x1040);
闪存写入(两个,分段C,块,3);
//flashMove (0xE800,0xE600,块,3);
IF (键=='*')

闪擦除(0x1040);
//lcdInit();
lcdClar();
lcdSetText ("XXXX",12,1);
}
}
}
如果(h =2)

lcdClar();
gotkey = 0;
键= 0;
密钥=标准解码(getKey12(1));

IF (键=='#')

gotkey = 0;
键= 0;
i=0;
同时(i < 4){

delay_ms(500);
密钥=标准解码(getKey12(1));
3[I]=键;

lcdSetText(&th,0,1);

delay_ms(500);
I++;

}

闪擦除(0x1000);
闪存写入(三,分段D,块,3);
//flashMove (0xE800,0xE600,块,3);

IF (键=='*')

闪擦除(0x1000);
//lcdInit();
lcdClar();
lcdSetText ("XXXX",0,1);
}
否则{
lcdClar();
}

}
}
}
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    请说明您的特定问题,将来使用语法突出显示器插入代码。

    此致,
    Ryan