打印

用流明LM3S8962点亮OLED

[复制链接]
2582|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ddllxxrr|  楼主 | 2010-12-24 20:47 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
int main(void)

{


unsigned int x;


unsigned int y;


//


// Set the clocking to run directly from the crystal.


//


GPIOCInit();


SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |


SYSCTL_XTAL_8MHZ);


//


// Enable the SSI0 and GPIO port blocks as they are needed by this driver.


//


SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);


SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);


SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIO_OLEDDC);



//


// Configure the SSI0CLK and SSIOTX pins for SSI operation.


//


GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);


GPIOPinTypeGPIOOutput(GPIO_OLEDDC_BASE, GPIO_PIN_4);


GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4|GPIO_PIN_5,


GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);


      

//


// Configure and enable the SSI0 port for master mode.


//

   

SSIConfigSetExpClk(SSI0_BASE,2400 , SSI_FRF_MOTO_MODE_3,


SSI_MODE_MASTER, 1200, 8);
//SysCtlClockGet()


   

//


// Enable the SSI port.


//


SSIEnable(SSI0_BASE);



reset();



LCD_write_byte(0xAE,0);
//display off

      

LCD_write_byte(0x02,0);
//set lower column address
******* SSD1303 04


LCD_write_byte(0x10,0);
//set higher column address
******* SSD1303 12


LCD_write_byte(0x40,0);
//set display start line

      

LCD_write_byte(0xB0,0);
//set page address

      

LCD_write_byte(0x81,0);
//contract control


LCD_write_byte(0x80,0);
//128

      

LCD_write_byte(0xA1,0);
//set segment remap


LCD_write_byte(0xA4,0);
//normal display


LCD_write_byte(0xA6,0);
//normal / reverse

      

LCD_write_byte(0xA8,0);
//multiplex ratio


LCD_write_byte(0x3F,0);
//duty = 1/64

      

LCD_write_byte(0xC8,0);

//Com scan direction

      

LCD_write_byte(0xD3,0);
//set display offset


LCD_write_byte(0x00,0);
//SSD1303 ******** 0x60

      

LCD_write_byte(0xD5,0);
//set osc division


LCD_write_byte(0x00,0);

      

LCD_write_byte(0xD8,0);
//set area color mode off


LCD_write_byte(0x05,0);

      

LCD_write_byte(0xDA,0);
// set COM pins


LCD_write_byte(0x12,0);

      

LCD_write_byte(0xDB,0);
//


LCD_write_byte(0x40,0);

      

LCD_write_byte(0xAD,0);
// DC/DC control mode: on


LCD_write_byte(0x8B,0);



LCD_write_byte(0xAF,0);
//display ON



LCD_write_byte(0x02,0);
/*set lower column address*/


LCD_write_byte(0x10,0);
/*set higher column address*/

      

LCD_write_byte(0xB0,0);
/*set page address*/

        

for(y=0;y<8;y++)


{


LCD_write_byte((0xB0+y),0);
/*set page address*/


LCD_write_byte(0x02,0);
/*set lower column address*/


LCD_write_byte(0x10,0);
/*set higher column address*/


for(x=0;x<64;x++)


{



LCD_write_byte(0xff,1);


LCD_write_byte(0xff,1);


}


}

      

delay(60000);


delay(60000);

   


for(i=0;i<550;i++)


{




LCD_write_byte(0xFF,1);


}


delay(10000);


*/


//
for(i=0;i<550;i++)


//{


//

LCD_write_byte(0x00,1);


//}

                                   


LCD_write_byte(0x02,0);//(0x41,0);



LCD_write_byte(0x12,0);//(0x8F,0);



LCD_write_byte(0xB1,0);//(0x8F,0);



LCD_PrintStr(" HELLO!");



LCD_write_byte(0x03,0);



LCD_write_byte(0x11,0);



LCD_write_byte(0xB5,0);//(0x8F,0);



LCD_PrintStr("EEWORLD!!!");

                                   


}


该屏的淘宝地址
http://item.taobao.com/item.htm?id=8866019885

相关帖子

沙发
heartthrob| | 2012-6-30 17:06 | 只看该作者
还不如伪代码

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2399

主题

6963

帖子

68

粉丝