CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Newhaven Display NHD-C0220BiZ-FSW-FBW-3V3M and PIC24, CCS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
NickGama



Joined: 23 Mar 2019
Posts: 3

View user's profile Send private message

Newhaven Display NHD-C0220BiZ-FSW-FBW-3V3M and PIC24, CCS
PostPosted: Sat Apr 06, 2019 4:42 am     Reply with quote

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: 9174
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Apr 06, 2019 5:05 am     Reply with quote

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

View user's profile Send private message

Newhaven Display NHD-C0220BiZ-FSW-FBW-3V3M and PIC24, CCS
PostPosted: Sat Apr 06, 2019 5:29 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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