12864液晶屏程序初始化问题

2019-08-03 17:53发布

#include<msp430x14x.h>
#define uc unsigned char
void delay(uc x)
{
uc a;
int b;
for(a=x;a>0;a--)
  for(b=100;b>0;b--);
}
void shuju(uc a)
{
P5OUT|=0X20;
P5OUT&=0Xbf;
P5OUT&=0X7F;
P4OUT=a;
delay(20);
P5OUT|=~0X7f;
delay(20);
P5OUT&=0X7F;
delay(20);
}
void zhiling(uc a)
{
P5OUT&=0Xdf;
P5OUT&=0Xbf;
P5OUT&=0X7F;
P4OUT=a;
delay(20);
P5OUT|=~0X7f;
delay(20);
P5OUT&=0X7F;
delay(20);
}
void chushihua()
{
zhiling(0x01);
zhiling(0x02);
zhiling(0x0f);
delay(20);
}
void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;
  P5SEL=0X00;
  P4SEL=0X00;
P5DIR=0XFF;
P4DIR=0XFF;
chushihua();
while(1);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。