Part Number: LP-CC2652RSIP
Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
We are using a Oled bought from Newhaven , 4 rows and 20 characters, we have an example for running the oled in Parallel interface in the old MSP432 simpleLink device , But we need help regarding sysconfig and conversion of code.
Q1: i have doubts regarding sending upper and lower nibble.
Q2. I have code for serial also ,but I couldn't find the issue why Oled is not turning on.
For 4 bit parallel
void oled20x04_Command(char cmd)
{
char lcdData;
lcdData = (cmd >> 4) & 0x0f;
RS_LOW(); /*oled20x04_Command Register is selected i.e.RS=0*/
GPIO_write(CONFIG_GPIO_D7_PIN, ((lcdData>>3)&0x01));
GPIO_write(CONFIG_GPIO_D6_PIN, ((lcdData>>2)&0x01));
GPIO_write(CONFIG_GPIO_D5_PIN, ((lcdData>>1)&0x01));
GPIO_write(CONFIG_GPIO_D4_PIN, ((lcdData>>0)&0x01)); /*Send MSB nibble of command first*/
EN_HIGH(); /*High-to-low pulse on Enable pin to latch data*/
usleep(40);
EN_LOW();
usleep(40);
lcdData = (cmd & 0x0F); /*Send lower nibble of command */
GPIO_write(CONFIG_GPIO_D7_PIN, ((lcdData>>3)&0x01));
GPIO_write(CONFIG_GPIO_D6_PIN, ((lcdData>>2)&0x01));
GPIO_write(CONFIG_GPIO_D5_PIN, ((lcdData>>1)&0x01));
GPIO_write(CONFIG_GPIO_D4_PIN, ((lcdData>>0)&0x01));
EN_HIGH(); /*High-to-low pulse on Enable pin to latch data*/
usleep(40);
EN_LOW();
usleep(40);
}
void oled20x04_Char(char data)
{
char lcdData;
RS_HIGH(); /*oled20x04_Command Register is selected i.e.RS=1*/
lcdData = (data >> 4) & 0x0F; /*Send MSB nibble of command first*/
GPIO_write(CONFIG_GPIO_D7_PIN, ((lcdData>>3)&0x01));
GPIO_write(CONFIG_GPIO_D6_PIN, ((lcdData>>2)&0x01));
GPIO_write(CONFIG_GPIO_D5_PIN, ((lcdData>>1)&0x01));
GPIO_write(CONFIG_GPIO_D4_PIN, ((lcdData>>0)&0x01));
EN_HIGH(); /*High-to-low pulse on Enable pin to latch data*/
usleep(40);
EN_LOW();
usleep(40);
lcdData = (data&0x0F); /*Send lower nibble of command */
GPIO_write(CONFIG_GPIO_D7_PIN, ((lcdData>>3)&0x01));
GPIO_write(CONFIG_GPIO_D6_PIN, ((lcdData>>2)&0x01));
GPIO_write(CONFIG_GPIO_D5_PIN, ((lcdData>>1)&0x01));
GPIO_write(CONFIG_GPIO_D4_PIN, ((lcdData>>0)&0x01));
EN_HIGH(); /*High-to-low pulse on Enable pin to latch data*/
usleep(40);
EN_LOW();
usleep(40);