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.
工具/软件:Code Composer Studio
有没有人在这里有过任何经验? 由于某种原因,我无法找到,我只能在打开所有句段时获取数字来显示。 例如,将0x01,0x02,0x04或0x08加载到LCDM1中不会显示任何内容,但输入0x0F将打开所有4个分段:D,E,F和CA。 我感到困惑。 我正在使用内部充电泵,LCDACTL=0x1D, LCDPCTL0=0xff,LCDPCTL1=0x00,LCDVCTL0 = 08和LCDVCTL1=0x13。 非常感激地接受任何帮助。
你好,Nathan。 您需要所有代码还是只需要一个部件? 以下是相关的位。 Dig[8]在 InitVars()中初始化。 接下来的两周我都在休假,但当我29日回来时,我将会寻找您的意见。
#define Lo0 0x07 #define HI0 0x0E #define LO1 0x00 #define HI1 0x06 #define LO2 0x23 #define HI2 0x4C #define LO3 0x21 #define HI3 0x4E #define LO4 0x24 #define HI4 0x46 #define LO5 0x25 #define Hi5 0x4A #define LO6 0x27 #define LO6 0x4A #define LO7 0x4A #define 0x7 0x4A #define #0x7 0x4A #define 0x8 0x27 #定义HI8 0x4E #定义LO9 0x24 #定义HI9 0x4E
unsigned char Dig[8]; // Varitronix字符[88.8888万]
/* main.c */ int main(void){ WDTCTL = WDTPW | WDTHOLD; //停止看门狗计时器 // InitOsc(); InitPorts(); InitTimers(); InitRTC(); InitVars(); // 延迟(10); //等待32kHz稳定 // InitLCD(); // __bis_sr_register (GIE); //启用所有活动中断 // 同时(1){
//此处为主循环
如果(某些条件){
ShowDigits();
}
}
// 启用LCD // void InitLCD(void){ LCDACTL = LCDFREQ_32 + LCD4MUX; // LCDFREQ=1kHz,4-Mux LCDDAVCTL1 = VLCD_11; // VLCD = 3.2V LCDDAVCTL0 = LCDCPEN; // PCCLF=1kHz充电泵已启用 ;DDA0 / TL0关闭;/0x39 = Tlcff = //打开段0 - 31 LCDACTL || LCDON; // LCDON /////BTCTL = LCDFREQ_128;// STK LCD freq = ACLK/128 //P5SEL = 0xFE; //为LCD设置Rxx和COM引脚 }
/* 显示所有数字。 调用自main() */ void ShowDigits(void){ Show7( Dig[7]); Show6( Dig[6]); Show5( Dig[5]); Show4( Dig[4]); Show3( Dig[3]); Show2 (Dig[2]); Show1 (Dig[1]); Show0 (Dig[0]); }/* Show digit 7 */ void Show7 (unsigned char d){ LCDM1 = LoSegs( d ); LCDM16 = HiSegs( d ); }
/* 为数据段a,b,c,dp,g,h,m,n */ unsigned char HiSegs(unsigned char d){ unsigned char c; switch ( d ){ 案例0x00: //段:a,b,c C = HI0; 中断; 案例0x01: //段:b,c C = HI1; 中断; 案例0x02: //段: C = HI2; 中断; 案例0x03: //段: C = HI3; 中断; 案例0x04: //段: C = HI4; 中断; 案例0x05: //段: C = Hi5; 中断; 案例0x06: //段: C = HI6; 中断; 案例0x07: //段: C = HI7; 中断; 案例0x08: //段: C = HI8; 中断; 案例0x09: //段: C = HI9; 中断; 默认: c = 0xff; //段: } 返回c; }