MSP430G2553数据手册

时间:2018-08-09 14:56:50
【文件属性】:

文件名称:MSP430G2553数据手册

文件大小:11.6MB

文件格式:PDF

更新时间:2018-08-09 14:56:50

MSP430

void mcu_init() { WDTCTL = WDTPW + WDTHOLD; WDTCTL=WDTPW+WDTHOLD; BCSCTL1=CALBC1_1MHZ; DCOCTL=CALDCO_1MHZ; BCSCTL3|=LFXT1S_0; IFG1&=~OFIFG; BCSCTL2 |=SELM_1 + DIVM_0; lcd_port_dir|=RST+SCE+D_C+DIN+SCK; lcd_port_out=RST+SCE+D_C+DIN+SCK; //lcd_back_dir|=BIT4; //cd_back_out|=BIT4; } void lcd_write(uchar dat,uchar cmd) { uchar i; lcd_port_out&=~SCE; if(cmd) lcd_port_out|=D_C; else lcd_port_out&=~D_C; for(i=0;i<8;i++) { if(dat&0x80) lcd_port_out|=DIN; else lcd_port_out&=~DIN; dat<<=1; lcd_port_out&=~SCK; lcd_port_out|=SCK; } lcd_port_out|=SCE; } ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //LCD_init: LCD初始化 void LCD_init(void) { lcd_port_out&=~RST; delay_1ms(); lcd_port_out|=RST; delay_1ms(); lcd_port_out&=~SCE; delay_1ms(); lcd_port_out|=SCE; delay_1ms(); lcd_write(0x21,0);//初始化Lcd,功能设定使用扩充指令 lcd_write(0xd0,0);//设定液晶偏置电压 lcd_write(0x06,0); lcd_write(0x13,0); lcd_write(0x20,0);//使用基本指令 水平寻址 lcd_write(0x0C,0);//设定显示模式,正常显示 //lcd_write0x0D,0); //设定显示模式,反白显示 lcd_port_out&=~SCE;//选择芯片SCE=0; } ///////////////////////////////////////////////////////////// void lcd_s_xy(uchar x,uchar y) { lcd_write(0x40|y,0); lcd_write(0x80|x,0); } void LCD_Clear(void) { uchar x; uchar y; lcd_s_xy(0,0); lcd_write(0x0c,0); lcd_write(0x80,0); for(y=0;y<=5;y++) { for(x=0;x<=83;x++) { lcd_write(0x00,1); } } } void display_ASIll(uchar s_x,uchar s_y,uchar ASI) { uchar i; lcd_s_xy(s_x*8,s_y); for(i=0;i<8;i++) { lcd_write(nAsciiDot[ASI-0X20][i],1); } lcd_s_xy(s_x*8,s_y+1); for(i=8;i<16;i++) { lcd_write(nAsciiDot[ASI-0X20][i],1); } } void Display_hz(uchar S_X,uchar S_Y,uchar n)///汉字显示函数S_X为x坐标;y为纵坐标;n为显示第几个汉字; { uchar i,j; uchar dx; lcd_s_xy( S_X*16, S_Y); for(i=0;i<16;i++) { dx=Chinese_table[i+n*32]; lcd_write(dx,1); } lcd_s_xy( S_X*16, S_Y+1); for(j=0;j<16;j++) { dx=Chinese_table[j+16+n*32]; lcd_write(dx,1); } } void LCD_Write_str68(uchar x, uchar y,uchar *string) { uchar i; lcd_s_xy(x*8,y); while(!(*string=='\0')) { for(i=0; i<6;i++) { lcd_write(font6x8[*string-0x20][i],1); } string++; } } /*void lcd_draw_bmp(uchar x,uchar y,const uchar *map,uchar pin_x_y,uchar pin_x_x) { uint n,i; uchar row; if(pin_x_y%8==0) row=pin_x_y/8; else row=pin_x_y/8+1; lcd_s_xy(x,y); for(n=0;n


网友评论