AXE033/i2c revisited/18X-DS1307 ckt

SIRA

Member
As in AXE033, page #7, I have used the s/w and h/w,"Using the optional Clock [DS1307] upgrade in i2c mode". A LED is connected to leg#7 of DS1307 through a resistor to the +Vcc rail. When I run the following program, the LED comes ON (dim) instantly and then after a few seconds becomes bright. As per my program the LED has to turn ON after 2 minutes, and turn OFF afetr 20 seconds.
Would some one please pick the mistake?

symbol hour=b2
symbol minute=b1
symbol second=b0
main:
i2cslave %11010000,i2cslow,i2cbyte
writei2c 0,($00,$57,$11,$05,$18,$11,$06,$10)
end

i2cslave %11010000,i2cslow,i2cbyte
Loop1:

Pause 30000 ;wait 30sec
readi2c 0,(b0,b1,b2);read sec,min,hour
if b2<>11 then loop1;if hour not 11 goto loop1
if b1<>59 then loop1;if min not 59 goto loop1
high 7 ;turn ON led/buzzer
pause 20000 ;wait 20sec
low 7 ;turn OFF led/buzzer
pause 60000 ;wait 60sec
goto loop1
 

Technical

Technical Support
Staff member
These three lines are only used the very first time you use the AXE033 (to set the time). They should not be in your normal program, so delete them.

i2cslave %11010000,i2cslow,i2cbyte
writei2c 0,($00,$57,$11,$05,$18,$11,$06,$10)
end
 

SIRA

Member
Technical: I have assembled the 18X and the DS1307 on a bread-board, with legs# 7 and 10 on the 18X as SCL & SDA respectively.
Are "high 7" and "low 7" for leg#7 of the DS1307 or leg#13 of 18X?
Following your instruction, I separated the program into two parts, "read" and "write". Though the downloading of these programs have been successful, yet the response is not as expected. Why?
 

BeanieBots

Moderator
I'm a bit confused about which pin you are trying to control. Leg/pin PICAXE/DS1307.

High 7 will set output 7 (pin 13) of the 18X high.
You are also wrinting to the DS1307 control register which controls the state of leg7 on the DS1307.
You are sending it $10 which at a quick glance in the data sheet will turn on the 1Hz output (SQWE) on pin 7 of the DS1307.
Have you remembered the 4k7 pullup resistors for the I2C lines.

write $07($80) to make it high
write $07(0) to make it low
write $07(10) to make it flash at 1Hz.


Edited by - beaniebots on 20/11/2006 21:11:05
 
Top