Discussion in "Project Help" started by    CheV    Aug 1, 2007.
Wed Aug 01 2007, 12:58 pm
#1
hello everyone, i'm having huge trouble with my project, i need to implement a ds"mf"1307, and it doesn't work as expected, i use proteus for simulation, i will attach the file i've worked, during debugging, the file doesn't read correct data from the "mf"1307. and i was wondering if anyone could help me with this. seriously all i need is a working example just to read data from the DS"mf"1307, i've seen several projects with this RTC but i get lost with all the non relevant code, really only read the ds1307, the rest leave it to me, i'm just having trouble with getting the data




[ Edited Tue Aug 07 2007, 09:21 pm ]
Wed Aug 01 2007, 02:11 pm
#2
if you're using proteus... then try debugging your project using I2C debugger... see what you're getting on the I2C bus. i mean is your data coming the way you want.. check for any false triggering of the signals..
Wed Aug 01 2007, 02:59 pm
#3
YES!!!

i'm using the I2C debugger, yet i'm not getting the data in the RTC, i'm getting junk data + all my mcu ram gets filled with junk.
Wed Aug 01 2007, 04:32 pm
#4
are you getting something like this "ÿ" in your ram?
Wed Aug 01 2007, 09:58 pm
#5
well no, it's filled up with random stuff, first time it's full with "2C", then it starts again filled up with "52", then another thing, it's puzzling. in my project there were many components, to each one i had the same approach, first i find simple code, start building up, except this DS1307, it's giving me huge trouble, all i need is a head start code, something that gets data from the RTC, then i'll be on my own.

Thu Aug 02 2007, 12:49 am
#6
I2C libraries to read from I2C bus is there.. if you want to have idea regarding I2C.
for reading.. there is something that you might need to know..
when you read from I2C device the order of reading must be this way.. First you send a dummy write byte to set the address from where you want to read. and then send a simple read cycle without stopping the previous comunication.
In coding you do like this..

[Start condition] [send write with address from where you want to read] [Start Condition] [send read with address] [stop condition]

i hope you are reading this way. Also.. please check you might overwriting some variable because.. you just need to read 7 bytes why you reading and how come filling up the whole ram.
If you ask me.. you are getting the data but something messed up in the code which is overwriting and filling up the whole ram. Maybe i am wrong but this happen sometimes... because you are using assembly..
Suggestion is.. change the stack pointer so u must have enough ram area for stack.
Thu Aug 02 2007, 01:08 am
#7
Hmmm look at the code of digital clock, there ds1307 is implemented succesfully. u will get it in rickeys world.
implementing I2C logic is difficult, first u have to go throught the details.........
Thu Aug 02 2007, 02:02 am
#8
i did work with I2C before, with eeprom, actually i used the same code that worked with the eeprom, with some changes, like the access code of the DS1307 instead of the 24LC265, which is in my code here:
http://www.sandrouni.com/1307.asm
i'll try changing the stack pointer, see what happens, but seriously, why isn't there any simple code to just retrieve data from the DS1307, i haven't seen any small sized project with decent descriptions that could guide me on this, i'm losing a lot of project hours rotating around the DS1307, i just want to rid of it and get going.
Thu Aug 02 2007, 03:06 am
#9
well if you do the things right way.. then code can be very small..
do this way.. download my I2C library and write a simple reading code. according to the steps i told in my previous post write the code. Please read only the data which is needed.. or if u want to read the whole ram, that won't take more than 40 bytes so be careful how and where you are storing the data. Because one wrong mistake does everything wrong.
Mon Aug 06 2007, 06:45 pm
#10
*NEWS FLASH*
it worked, it finally worked, i was able to get what i want from the DS1307 without the junk, i had to initiate the rtc, then to use the stop communication, now i'll try to write to the DS1307, i guess it won't be as hard, if you think it would help others, can you add this to the code area, if it's good enough?
here:
http://www.sandrouni.com/1307.asm


[ Edited Mon Aug 06 2007, 06:49 pm ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Michailqfh
Fri Mar 29 2024, 01:53 am
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