Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
you have to power it up . many of the OLED displays use serial interface like TWI or SPI. is there any lettering on the display? like this "SSD1308"? if yes, then google it. see this link , this one and this one too command sets
:edit reason for edit:
I didnt see the Parallel thing my mistake.. can you post any of the details of the OLED?
/*******************************
Class LCD 4 bit for 4 bit lcd
interface
*******************************/
void lcd_init() // fuction for intialize
{
dis_cmd(0x02); // to initialize LCD in 4-bit mode.
dis_cmd(0x28); //to initialize LCD in 2 lines, 5X7 dots and 4bit mode.
dis_cmd(0x0C);
dis_cmd(0x06);
dis_cmd(0x80);
_delay_ms(100);
}
void dis_cmd(char cmd_value)
{
char cmd_value1;
cmd_value1 = cmd_value & 0xF0; //mask lower nibble because PA4-PA7 pins are used.
lcdcmd(cmd_value1); // send to LCD
cmd_value1 = ((cmd_value<<4) & 0xF0); //shift 4-bit and mask
lcdcmd(cmd_value1); // send to LCD
}
void to_line(char line,char pos)
{
if(line ==1)
{
dis_cmd(0x80 + pos);
}
else
{
dis_cmd(0xC0+pos);
}
}
void clear()
{
to_line(1,0);
lcd_write_string(" ");
}
void dis_data(char data_value)
{
char data_value1;
data_value1=data_value&0xF0;
lcddata(data_value1);
data_value1=((data_value<<4)&0xF0);
lcddata(data_value1);
}
void lcdcmd(char cmdout)
{
ctrl=cmdout;
ctrl&=~(1<<rs);
ctrl|=(1<<en);
_delay_ms(1);
ctrl&=~(1<<en);
}
void lcddata(char dataout)
{
ctrl=dataout;
ctrl|=(1<<rs);
ctrl|=(1<<en);
_delay_ms(1);
ctrl&=~(1<<en);
}
void lcd_write_string(char *str) //take address vaue of the string in pionter *str
{
int i=0;
while(str[i]!='\0') // loop will go on till the NULL charaters is soon in string
{
dis_data(str[i]); // sending data on CD byte by byte
i++;
}
}
Power on
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
000011****
Wait for more than 15 ms after VCC rises to 4.5 V
Wait for more than 4.1 ms
1
DB7 DB4
0
RS
0
R/W DB6
0 0
DB5
1
DB3 DB2 DB1
****
DB0
Wait for more than 100 µs
DB4
1
RS R/W DB7
0 0
DB6 DB5
001
DB3 DB2 DB1
***
DB0
*
1
DB7 DB4
0 0
RS R/W
0 0 1
DB6 DB5 DB1
N F *
DB3 DB2
*
DB0
0000001000
0000000001
00000001 I/D S
Initialization ends
all of the voltages must be in range specifiecd in datasheet.
almost all of the displays have back light. so if you want to test that, just connect the ground of the supply with the last N/C pin and then connect a small valued resistance (as current limiter (preferred: 220 Ω) ) to the next N/C pin (yeah its "not connected" but many to all of the back lit displays use those pins for the internal back light LED)