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 |