|
|
View previous topic :: View next topic |
Author |
Message |
project2010
Joined: 14 Mar 2010 Posts: 21
|
ds1307 problem |
Posted: Sat May 01, 2010 12:50 pm |
|
|
I'm using the following driver
http://www.ccsinfo.com/forum/viewtopic.php?t=23255
only one problem on it
// Set date for -> 15 June 2005 Tuesday
// Set time for -> 15:20:55
ds1307_set_date_time(15,6,5,2,15,20,55);
I try to set the date in 10may2009 fri 20:30:00
I write
ds1307_set_date_time(10,05,09,05,20,30,00);
But it have an error
Quote: |
*** Error 51 "test.c" Line 282(28,29): A numeric expression must appear here
|
I write (10,05,9,05,20,30,00);
or
(10,05,10,05,20,30,00);
It will be ok
Why 9 can't write 09 in this case?
Thank you |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 01, 2010 10:10 pm |
|
|
Quote: |
Why 9 can't write 09 in this case?
|
It's because the number has a leading zero in front of it. In that case,
the compiler interprets it as an Octal number and 09 is a not a valid
Octal number. In the Octal number system, the digit values can only be
from 0 to 7.
Octal isn't used that much anymore, but it is built-in to the compiler.
Each number system is indicated to the compiler by a prefix:
0b = binary
0x = Hexadecimal
0 = Octal
nothing = decimal |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|