Discussion in "General help Guidance and Discussion" started by    Edward_    Dec 22, 2013.
Sun Dec 22 2013, 10:48 pm
#1
I am trying to understand the use of multiple I2C buss devices on an 8051. To use multiple I2C devices like DS1307 and I2C 1602 LCD.

Referencing this example: http://www.8051projects.net/i2c-twi-tutorial/8051-DS1307-example.php Its unclear to me where the address is for the DS1307.
(Much of the code examples I'm seeing is lacking any comments.) But I have seen examples where there is only one I2C device on a buss, no device address is used.

I have been using code like this:

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // LCD address 0x27



(The Code insert feature of this forum removed many characters from my sample code)

I have not found any examples of multiple I2C devies on 8051.

Any assistance appreciated.


[ Edited Thu Dec 26 2013, 08:32 pm ]
Mon Dec 23 2013, 03:40 am
#2
The DS1302 uses a serial protocol, but not I2C, so it may not work property on a true I2C buss.
Start by disconnecting the DS1302 and just getting the LCD to work.
What model of LCD do you have ?

Mon Dec 23 2013, 08:28 am
#3
Thanks

I really can't say what model my LCD is, its from China, with no visible brand name. It is a 1602 with a I2C board rear-mounted..
I have been using the I2C 1602 and I2C 2004 LCD displays for years on the same buss as our DS3231 real time clock modules with never a problem, using Atmel MCUs.
In my code, I've just been specifying the I2C address for the LCD, and all works nicely.

I was hoping just to carry this simple technique over to the 8051.
Tue Dec 24 2013, 09:37 pm
#4


I have been using the I2C 1602 and I2C 2004 LCD displays for years on the same buss as our DS3231 real time clock modules with never a problem

Edward_


Your question was about using the DS1302 and a I2C 1602 LCD.
The DS3231 is I2C, the DS1302 is not.
Wed Dec 25 2013, 01:51 am
#5
I think Phil has answered most of the things.. just for clarification on the tutorial source code:

I2CStart();
I2CSend(0xD0);


The first byte sent after a start condition is always device address. and in the source code example here, 0xD0 is address of DS1307.

(The Code insert feature of this forum removed many characters from my sample code)


I will look into this
Wed Dec 25 2013, 07:54 am
#6

Can you tell us more about what you have done ?.

The tutorial is for the DS1307, but you asked about the DS1302.
The tutorial is for a single I2C device ( DS1307) not two, on the same bus.
What setup are you using ?


[ Edited Wed Dec 25 2013, 08:03 am ]
Thu Dec 26 2013, 08:37 pm
#7
My apology.
I referenced a DS1302, but I meant to type the DS1307 as in the title. Corrected.

I am using a library for my LCD display. Apparently the library handles the address.
The library is referenced in my code as such.
#include "LiquidCrystal_I2C.h"


Should I not assume that Keil and other IDEs have libraries for I2C LCD displays and RTCs?
It concerns me that I have seen no examples.

(3rd attempt, replies not displaying using bottom form)


[ Edited Thu Dec 26 2013, 08:41 pm ]
Tue Dec 31 2013, 12:04 am
#8


Should I not assume that Keil and other IDEs have libraries for I2C LCD displays and RTCs?

Edward_



You should not assume libraries will be provided.

IDEs often don't provide the services you might expect.
Last time I looked Keil didn't even provide basic delay functions.
(Some feeble excuse about different clock timing)




[ Edited Tue Dec 31 2013, 12:24 am ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am