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

I2C LCD 4 bit

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
pic.programmer



Joined: 30 Apr 2015
Posts: 29
Location: Banned - spammer

View user's profile Send private message Send e-mail

I2C LCD 4 bit
PostPosted: Sun May 03, 2015 3:40 pm     Reply with quote

Hi

I made I2C LCD 4 bit. It uses PCF8574.

I have used these LCDs for testing and they work fine.

http://www.banggood.com/buy/I2C-LCD.html

I have also used this I2C LCD module with HD44780 compatible LCDs (16x2, 20x2, 20x4). They all work fine in Proteus and also hardware.

http://www.banggood.com/5Pcs-IICI2CTWISP-Serial-Module-Port-For-5V-Arduino-1602LCD-Display-p-964315.html

I have used

PIC18F46K22
8 MHz crystal
mikroElektroniks's EasyPIC v7 development board.
CCS C 5.044

I am new to CCS C Compiler. I don't know if my code can be made better.

If it can be improved then please make changes and post it here.

Download project from here

http://www.mediafire.com/download/s6ytw6z5hscfjeb/I2C_LCD.rar
pic.programmer



Joined: 30 Apr 2015
Posts: 29
Location: Banned - spammer

View user's profile Send private message Send e-mail

Re: I2C LCD 4 bit
PostPosted: Sun May 03, 2015 5:05 pm     Reply with quote

In the I2C_LCD_Chr() function, one can replace the switch statement with the below switch statement and use the code with a HD44780 and compatible 16x4 LCD.

Code:
switch(row){

        case 1:
        I2C_LCD_Cmd(0x80 + (column - 1));
        break;
        case 2:
        I2C_LCD_Cmd(0xC0 + (column - 1));
        break;
        case 3:
        I2C_LCD_Cmd(0x90 + (column - 1));
        break;
        case 4:
        I2C_LCD_Cmd(0xD0 + (column - 1));
        break;
    };



Function Prototypes were not matching. Fixed project at below link.

http://www.mediafire.com/download/xn70miqs618lal5/I2C_LCD_rev1.rar

The I2C LCD module I mentioned has 3 SMD jumpers and by default it is set to 0x07. I don't know whether the SMD jumper settings can be modified or not, but if it can be changed then one can have like one DS1307 and 7 I2C LCDs on the same I2C bus and can display many datas. They can also use Big Fonts for LCD. I will soon post a new code which will display Big Fonts.

Also I am writing a code for 40x4 HD44780 compatible LCD with 4 bit interface and I2C interface. If I succeed, I will post them here.
pic.programmer



Joined: 30 Apr 2015
Posts: 29
Location: Banned - spammer

View user's profile Send private message Send e-mail

Re: I2C LCD 4 bit
PostPosted: Sun May 03, 2015 7:15 pm     Reply with quote

Made a quick revision of the library. Now you can have 8 LCDs of any combinations of 16x2, 16x4, 20x2 and 20x4. I provided option to send address of LCD in functions.

Download link is here. I have tested this in Proteus and also in hardware with 2 x 20x4 LCDs.

http://www.mediafire.com/download/xekh4oydoyifv35/I2C_LCD_rev2.rar

http://www.mediafire.com/view/ka8knvco4nv3384/Proteus%20Simulation%20SS.jpg
pic.programmer



Joined: 30 Apr 2015
Posts: 29
Location: Banned - spammer

View user's profile Send private message Send e-mail

Re: I2C LCD 4 bit
PostPosted: Mon May 04, 2015 12:48 am     Reply with quote

Gabriel



Joined: 03 Aug 2009
Posts: 959
Location: Panama

View user's profile Send private message

PostPosted: Mon May 04, 2015 3:39 pm     Reply with quote

I'm not sure if a library tested in in Proteus is considered "working" code.


I think its funny that this is a library for a micro controller that talks to another micro controller to control the micro controller of an LCD.

"Yo dog, i heard you like micro controllers, so we put a micro controller on your micro controller's micro controller"

LOL.

G.
_________________
CCS PCM 4.135 & CCS PCH 5.013
pic.programmer



Joined: 30 Apr 2015
Posts: 29
Location: Banned - spammer

View user's profile Send private message Send e-mail

PostPosted: Tue May 05, 2015 2:27 am     Reply with quote

No, the two LCD version is tested in hardware (mikroE's EasyPIC v7 board), but the 8 LCDs version is not tested in hardware because I don't have 8 LCDs with me, but the code has only small changes so that one can use any combination of 16x2, 16x4, 20x2 and 20x4 LCDs.

In the bangood I2C modules one has to short the jumper pins to connect them to GND. I tested it. I have 50 I2C modules but have to buy 6 more LCDs to test the code.
bulentperktas



Joined: 11 Jul 2009
Posts: 2

View user's profile Send private message Send e-mail

Re: I2C LCD 4 bit
PostPosted: Mon Jun 01, 2015 5:29 pm     Reply with quote

hi,

i am trying to understand following definition, what for these lines?

thanks,

Code:

#define LCD_RS PIN_B4
#define LCD_EN PIN_B5
#define LCD_D4 PIN_B0       
#define LCD_D5 PIN_B1 
#define LCD_D6 PIN_B2   
#define LCD_D7 PIN_B3

_________________
Bülent PERKTAŞ
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library 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