Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] DS1302 / LCD / Codevision

2005-03-03 by Svenn Dahlstrøm

Things to check :
1-Reading of data is done at SCLK falling edge, and starts with the first 
falling edge after last rising edge at write adr/command...

2-Delay from clock falling edge unthil you read the data input...

Svenn

>
> Svenn:
>> The contents of the time and calendar register in DS1302 ar in BCD 
>> format.
>> 23sec are 0x23, and not 0x17...
> Yes, sorry, I typed the wrong thing in my original email (the code is at
> work and I was at home.)  We were using:
>
> second=DS1302_read(0xNN); //Can't remember address
> second=bcd2bin(second)
> //Convert to string and dislpay
> itoa(second,sec);
> lcd_gotoxy(0,0);
> lcd_puts(sec);
>
> Now, if I convert it from BCD to binary and read it out, it should, in the
> case of the seconds counter, get to 59 and roll over to 0, but doesn't.
> In fact, it doesn't give sensible numbersat all...
>
> It's very confusing to say the least.  If I retrieve a BCD value, and use
> bcd2bin (as we need an int for calculations), surely creating a string
> from it to display should work.
>
> Any help is much appreciated.
>
>
> Richard
> -- 
> Na vratima raja, ja savijam krila...
> http://www.van-gogh.co.yu
>
>
>
>
> Yahoo! Groups Links
>
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.