Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Simulide 1.0.0 DS1307 Problem updating year and log readings 7

2 posters

Go down  Message [Page 1 of 1]

feri



When I change the timetable, the year is updated with 48 years more.
To make it work I modified DS1307 :: updtDate () but I don't understand why.

void DS1307::updtDate()
{ m_clock.m_date.setDate( bcdToDec(m_data[6]-48), bcdToDec(m_data[5]), bcdToDec(m_data[4]) ); }

If I use this method of the DS1307 library to read register 7, then I can no longer write to register 7.

Ds1307SqwPinMode mode = rtc.readSqwPinMode();

ds1307SqwPin.ino (use method to read register 7 doesn't work)
ds1307SqwPin1.ino (does not use method to read register 7 works)

I attach files for testing.
Greetings
Attachments
Simulide 1.0.0 DS1307 Problem updating year and log readings 7 AttachmentDs1307.zip
You don't have permission to download attachments.
(6 Kb) Downloaded 4 times



Last edited by arcachofo on Wed Jan 12, 2022 10:39 pm; edited 1 time in total (Reason for editing : Marked as solved (green color))

arcachofo

arcachofo

Thanks, I wil have a look.

arcachofo

arcachofo

When I change the timetable, the year is updated with 48 years more.
To make it work I modified DS1307 :: updtDate () but I don't understand why.

void DS1307::updtDate()
{ m_clock.m_date.setDate( bcdToDec(m_data[6]-48), bcdToDec(m_data[5]), bcdToDec(m_data[4]) ); }
Solved in Rev 827.

The correct thing to do is:
... setDate( 2000+bcdToDec(m_data[6])...


If I use this method of the DS1307 library to read register 7, then I can no longer write to register 7.

Ds1307SqwPinMode mode = rtc.readSqwPinMode();

ds1307SqwPin.ino (use method to read register 7 doesn't work)
ds1307SqwPin1.ino (does not use method to read register 7 works)
I think you should use a single byte for the array index:
byte mode_index = 3;

arcachofo

arcachofo

feri wrote:If I use this method of the DS1307 library to read register 7, then I can no longer write to register 7.

Ds1307SqwPinMode mode = rtc.readSqwPinMode();

ds1307SqwPin.ino (use method to read register 7 doesn't work)
ds1307SqwPin1.ino (does not use method to read register 7 works)
arcachofo wrote:I think you should use a single byte for the array index:
byte mode_index = 3;
Look like this issue was indeed another bug in simulide (Solved in Rev 852):
https://simulide.forumotion.com/t429-not-a-bug-signed-counter-not-counting#2234

feri



Now it works fine.
Greetings

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum