Please see mikroC PRO PIC example of RTC DS1307. You can get the examples if you install the demo version of mikroC PRO for PIC. You can also get the code from libstock.com Search for RTC DS1307. The code shows how to write data to ds1307, read ds1307.
- - - Updated - - -
Please see mikroC PRO PIC example of RTC DS1307. You can get the examples if you install the demo version of mikroC PRO for PIC. You can also get the code from libstock.com Search for RTC DS1307. The code shows how to write data to ds1307, read ds1307.
24 hr = 100100. In 24 hr mode you dont use 5th bit. 6th bit is used and is 0, so you pass bcd values 0...24. In 12 hr mode you write 5th bit and 6th bit once only. Are you asking how to pass data in this condition?
After doing dec2bcd(12) you get 10010. add 1000000 or 1100000 to it and then write the value to hour.