|
|
View previous topic :: View next topic |
Author |
Message |
NickGama
Joined: 23 Mar 2019 Posts: 3
|
Newhaven Display NHD-C0220BiZ-FSW-FBW-3V3M and PIC24, CCS |
Posted: Sat Apr 06, 2019 4:42 am |
|
|
Help
Using NHD-C0220BIZ-FSW-FBW-3V3M in my project.
Using PIC24FJ128GC010-I/PT using I2c bus to drive the display.
Using CCS Compiler.
I managed to get one line on display, but do not know how to get to second line.
If I use longer text, it does not roll over to second line.
My code is as below: Can you please advise ?
Code: |
// ************** NHD-C0220BIZ-FSW-FBW-3V3M Display ***********************
void Display_Text()
{
unsigned char mytxt[] = {" Aerosino IXDC-GF R4"};
DSP_LED_on();
output_low(LCD_RST);
delay_us(300);
output_high(LCD_RST);
delay_ms(1000);
Init_LCD();
int i = 0;
I2C_start();
delay_us(30);
I2C_write(SLAVE_WRITE); // slave address
delay_us(30);
I2C_write(0x40); // data send
delay_us(30);
do
{
I2C_write(mytxt[i]);
delay_us(30);
i++;
} while (mytxt[i] != '\0');
delay_ms(5000);
}
//****************** FUNCTIONS ****************************
void DSP_LED_off(void)
{
output_low(LCD_BL);
}
// LED on - turn on the LED
void DSP_LED_on(void)
{
output_high(LCD_BL);
}
void init_LCD(void)
{
I2C_start();
delay_us(30);
I2C_write(SLAVE_WRITE); // slave
delay_us(30);
I2C_write(0); // Command send
delay_us(30);
I2C_write(0x38); // Set table 0
delay_us(30);
I2C_write(0x39); // Set table 1
delay_us(30);
I2C_write(0x14); // Set bias - 1/5
delay_us(30);
I2C_write(0x74); // Set contrast C3 on
delay_us(30);
I2C_write(0x5E); // Icon on, Booster on, C5 on
delay_us(30);
I2C_write(0x6D); // follower on, follower amp ratio 5
delay_us(30);
I2C_write(0x0C); // display on
delay_us(30);
I2C_write(0x01); // clear display
delay_us(30);
I2C_write(0x06); // entry mode set to increment
delay_us(30);
I2C_stop();
}
|
_________________ NickGama |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Apr 06, 2019 5:05 am |
|
|
OK, I haven't used that LCD before but general comments.
1) Be sure the hardware is correct ! Have you the proper I2C pullup resistors? Do you have the correct caps on the display? I found a datasheet and it needs 4 or 5 parts for it to work.
2)Run PCM P's 'I2C Scanner' program from the code library. It will confirm the device's base address and that it's communicating.
3) that LCD is 2 by 20, where line 1, pos 1 is 0x00, line 2, pos 1 is 0x40. So you'll have to send 64 characters before you see any on the second line.
4) have a look at the datasheet as they show basic code (driver) to use the display. You'll have to translate into CCS C but it should work.
5) Search this forum for possible code, then use google. Be aware though that Arduino programs use 7 bit I2C addressing, CCS 8 bit. |
|
|
NickGama
Joined: 23 Mar 2019 Posts: 3
|
Newhaven Display NHD-C0220BiZ-FSW-FBW-3V3M and PIC24, CCS |
Posted: Sat Apr 06, 2019 5:29 am |
|
|
Temtronic, Many thanks, I sent 64 characters and second line became alive.
This saved me lot of time.......
temtronic wrote: | OK, I haven't used that LCD before but general comments.
1) Be sure the hardware is correct ! Have you the proper I2C pullup resistors? Do you have the correct caps on the display? I found a datasheet and it needs 4 or 5 parts for it to work.
2)Run PCM P's 'I2C Scanner' program from the code librry. It will confirm the device's base address and that it's communicating.
3) that LCD is 2 by 20, where line 1,pos 1 is 0x00, line 2,pos 1 is 0x40. So you'll have to send 64 characters before you see any on the second line.
4) have a look at the datasheet as they show basic code( driver) to use the display. you'll have to translate into CCS C but it should work.
5) search this forum for possible code, then use google. Be aware though that Ardunio programs use 7 bit I2C addressing, CCS 8 bit. |
_________________ NickGama |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|