problem reading back rtc time on New axe033y OLED board

hamtech

Member
Have just built my new axe033y OLED board. I am able to display text on the display on both lines by serout command.
I have the ds1307 clock on board too. when i send the time to the RTC it says Data Set on the display.
i cannot, however, read the time back. All i get is a row of 00000 . it does not matter whether the clk link is on or not.

any ideas. I am following the code as presented in the data sheet but do not get the time displayed.

I can program messages and display them.

Is the ds1307 likely to be the problem or am i missing something.

thanks for any help.

Regards

bob
 

nick12ab

Senior Member
Is the DS1307 fitted properly and is the backup battery also fitted?

Is this 00/00/00 00:00 on the module's own clock display?
 

hamtech

Member
Yes the backup battery is fitted and the display is 00/00/00. 00:00 as you have said.

Is the clock chip u/s do you think??
 

nick12ab

Senior Member
The datasheet says that that is what is displayed if the upgrade module is not fitted. Check that there aren't any accidental shorts etc. on the i2c connections too.

I'll check the datasheet fully later.
 

nick12ab

Senior Member
Can't find anything else in the manual. Ensure that it is a DS1307 that it inserted and not a PICAXE or 555 timer and it is inserted the right way.

The DS1307 shuts off its i2c when the battery voltage is more than two thirds Vdd so try shorting the power jumper on the module - that just shorts the counterproductive diode on the module thus removing the 0.7V drop of the diode.
 

hamtech

Member
Nick thanks will do. i am using a battery pack at present but plan to use 5volts source when finished. Will short the. Diode out and see what happens and report back.
 

nick12ab

Senior Member
Nick thanks will do. i am using a battery pack at present but plan to use 5volts source when finished. Will short the. Diode out and see what happens and report back.
What battery pack are you currently using? If using a 6V pack then don't short out the diode but if it is 4.5V then the diode is the likely culprit.
 

Technical

Technical Support
Staff member
Not sure what you are actually doing to read the time back - are you using a mixture of serial and i2c (which you can't do)?
Leave the clk jumper off and just send a (0) command via the serout command. This should show the time on the bottom line of the LCD.

Failing that post your test programs here.
 

westaust55

Moderator
To expand upon what Technical has said:
In serial mode you can (a) set the time, and (b) display the time on the bottom line of the LCD

In i2c mode you can (a) set the time, and (b) read the time parameters/registers back into the PICAXE.

You cannot use both serial and i2c comms in the same PICAXE program to communicate with the AXE033 - only one mode selected at power up in effect.

If the date and time is all zeros it may be that the RTC is not yet set and running.
 

hamtech

Member
Thanks guys. Changing the battery pack for a solid 5v has fixed the problem. he batteries were dwon a bit and witht he drop across the diode I doubt i had much more than 3.5 volts. i have left the diode in and feed it with 6v from a reulated supply so should have 5.3v available now. i note the comments regarding ic2' i have not used it yet with the axe033y , if.i do will I be able to read in the time and then redisplay it. think about time zones. If iset clock to utc then to display moscow time for example I could just add three to the hrs toatl. Would this be feasible?
 

hamtech

Member
Thanks guys, was. The battery voltage stopping the clock i think.

Feeding it with 6v leaving the diode in it now works. Supply is 5.3 v now rather than 3.8v.
 

hamtech

Member
Another thought i assume you cannot read the time unless using ic2 mode?

Would like to have a time zone clock with gmt as the basis adding the extra hours and display place name at regular intervals. Can i do this?..
 

westaust55

Moderator
Keep in mind that in i2c comms mode while you can read the RTC, the LCD part become more like a dumb terminal and does not support all of the features available in serial comms mode (eg no user pre-defined messages).

Yes, you can read in the time (in i2c mode) and then add 3 to the hours to get Moscow time.
Keep in mind that the time read in from the RTC is in BCD format so you must first convert each parts of the date and time to decimal mode.
There are many examples on this forum for this using BDCtoASCII (which is okay for immediate display) and converting to binary/decimal values without ASCII encoding where further math is required.

Edit: yes you must be in I2c to read the time into the PICAXE.
 
Last edited:

nick12ab

Senior Member
Yea, you can read in the time (in i2c mode) and then add 3 to the hours to get Moscow time.
Mel in mind that the time read in from the RTC is in BCD format so you must first convert each parts of the date and time to decimal mode.
Um... Er... What? Typo frenzy! How did 'keep' become 'mel'? The BDCtoASCII hasn't gone unnoticed either. And Moscow time?

There are many examples for this using BDCtoASCII (which is okay for immediate display) and converting to binary/decimal values without ASCII encoding where further math is required.
What about using BCDtoBIN?
 

westaust55

Moderator
Crikey Nick,
you do not even give one a chance to read back and edit a post first - a couple of minutes to fix is not a crime!
Its hard to see the posts on a small iPhone screen and iphone seems to further exacerbate spelling flaws.
You look after your typos and technical hiccups and I will look after mine.

wrt to "BCDtoBIN", yes it does exist but only for X1 and X2 parts - not M or M2 parts.
 
Last edited:

john2051

New Member
Hi Hamtech, whilst the 6v supply should be ok for what you are doing, I would err on the side of caution, using a 5v supply with the diode shorted.
I know people get away with using 6v on pics and ttl, but is it worth the risk?
regards john
 

westaust55

Moderator
John is quite correct there hamtech.


From the PIC 18F46K22 (as used for the 40X2) and typical of many PIC chips (but certainly not all):

Absolute Maximum Ratings
Voltage on VDD with respect to VSS:
PIC18F46K22 ........................................................................................................... -0.3V to +6.5V

At standard operating conditions:
VDD Supply Voltage
PIC18F2X/4XK22 min:1.8 Volts, typ:— volts, max: 5.5 Volts

So to err on the side a safety, it is recommended not to exceed 5 Vdc for the supply.
 

nick12ab

Senior Member
Back to Moscow time, it won't be simply adding three hours to the time since you'll also have to change the date too and calculate when hours have to be taken off so that the time still goes 0-23 and not 3-26.
 

ValueAdd

Senior Member
Back to Moscow time, it won't be simply adding three hours to the time since you'll also have to change the date too and calculate when hours have to be taken off so that the time still goes 0-23 and not 3-26.
think that would be taken for granted as roll over needs to be handled - just like adding or subtracting time anywhere or rolling over at 255 or 65355.
 

Paix

Senior Member
About time zones, if just concerned with the time and not the date, then not just adding the positive time difference of 3 hours, or whatever your zone happens to be, but adding the 3 hours and then taking the mod 24 result, so that 2000, 2100, 2200 and 2300 becomes 2300, 0000, 0100 and 0200.

Worked in Bash
echo $(( ((2 + -6) + 24) % 24 )) which doesn't translate to a legal PIXAXE Basic syntax
becomes
echo $(( ((-6 + 2) + 24 % 24 )) which does.


is in PICAXE Basic
offset + timehours +24 // 24
Where the offset can be plus or minus.


E&OE of course :) The Bash is only in case I have it wrong, so that someone can see where I was coming from.

An awful lot seems to have happened since I started scratching my head over the syntax. I'll leave others to bother about the date if they need it.

Time is one of those simple things that we take forgranted until we need to get down to the detail where it blossoms like a cherry tree, along with all the permutations.
 

Paix

Senior Member
Just to clarify please Westy, When you mention about not mixing serial and I2c in the one program, I take it that you mean not to mix modes to the AXE033?

It is OK to use (for example only) serial comms to the AXE033 and I2C to a RTC or I2C to both?

I understand from a quick glimpse at the AXE033 documentation that I2C can be used to transfer time directly between a DS1307 RTClock and the AXE033 module, but it would also be valid to communicate separately I2C to RTC and serial to AXE033 if required or desired for whatever reason?

Just checking that it's an AXE033 answer you gave and not a generalisation that I may have somehow missed.

[ signs of insecurity :) ]

= = =
I think that your post #13 answered my question before I asked it . . . sorry.
 

westaust55

Moderator
Even at post 9 paragraph 3 it states that one cannot use both serial and i2c in the same PICAXE program to communicate with the AXE033
 
Last edited:

stevesmythe

Senior Member
I also got caught out with the DS1307 power issue. Not unreasonably (I thought), I connected the AXE033 to the OUT7,0V,V+ connections on the Picaxe 18M2 Tutorial Board (AXE50U) (powered by 3xAA cells). Even with the "4.5V jumper" in place, I couldn't get the DS1307 to store the date/time. All other functions on the AXE033 seemed to work fine.

Just while setting the date/time,I used a separate 5v regulated supply for the AXE033. Then, when the date/time was set successfully, I reverted to getting the power for the AXE033 from the 18M2 Tutorial Board 0V and V+ connection.

For what it's worth, I had a similar issue getting the DS1307 to store the date/time on the AXE110 data logger board. A 5V regulated supply did the job, and thereafter I reverted to 3xAA cells.

[edited for typo]
 
Top