DS1307 RTC and 24LC156 EERPOM Work Separately but not together

IronJungle

Senior Member
Using the LKM1638 discussed here with a:

- PICAXE 18M2
- DS1307 RTC
- 24LC156 EERPOM

The objective is to display the time of day (from the 1307 RTC) on the LEFT four 7 segments and
display a four letter words from the 24LC156 EERPOM on the RIGHT four segments.

Separately every thing works fine. If I comment out the readi2c command for the 1307 RTC the display happily shows four letter words read from the EEPROM just fine.
If I comment out the readi2c commands for the EEPROM the display happily shows the time just fine.

When I try to show both the time of day AND a four letter word the result is: time as "ghost in the machine" and the four letter word remains perfect.

This is the first time I have had more that one device on the i2c bus. I think this has something to do with the way I am reading the two devices from the i2c bus. I am doing no writei2c in the program. I have pre loaded the EEPROM and the time of day into the RTC.

To read the 1307 RTC I am using:
readi2c 0,(seconds, minutes, hours, junkread, junkread, junkread, junkread, blinky) 'REMARK: 'junkread' because I do not need day, date, month, year.

To read the 24LC156 EERPOM I am using:
readi2c w10, (Segment1RIGHT) ' where w10 ranges from 0 to 1,003.

BTW, I have tried starting the EEPROM with w10 = 1 (thinking "0" was conflicting with the RTC), but no change.

Any guidance?
 

nick12ab

Senior Member
time as "ghost in the machine"
Which means...?

To read the 1307 RTC I am using:
readi2c 0,(seconds, minutes, hours, junkread, junkread, junkread, junkread, blinky) 'REMARK: 'junkread' because I do not need day, date, month, year.

To read the 24LC156 EERPOM I am using:
readi2c w10, (Segment1RIGHT) ' where w10 ranges from 0 to 1,003.
Why not use hi2cin instead?

Are you remembering to use i2cslave/hi2csetup each time you want to read from a different device - and are you remembering to use i2cslow in this command?

Do you have the correct pull-up resistors on the i2c lines and decoupling capacitors on the power lines?
 

IronJungle

Senior Member
@nick12ab"
"Ghost in the Machine" is pretty much as KeithRB describes; garbage characters on the display. I have been hearing/using the term for about 30 years. Maybe it is more common in the US or in the circles that I run in.

You absolutely nailed the issue. I was using the ic2slave command before the EEPROM reading, but not before the RTC. I simply added:

i2cslave %11010000, i2cslow, i2cbyte ; set PICAXE as master and DS1307 slave address

before the RTC read and all the magic fell into place.

Thanks for offering a few suggestions. I was pretty confident it was a something basic. Right now I have the rig on an AXE091 so I felt pretty good about the connections.

Next step... Using reading the display tact switches to set the RTC time. Controlling the Red/Green LEDs to show seconds passing.
 
Top