TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139250 times)
  2. FAT32 Library (71746 times)
  3. Network Ethernet Library (57120 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28074 times)
  9. PID Library (26885 times)
  10. microSD click (26198 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Example

All in One - 31 function and sub , RTC ds1307 1307 in avr :)

Rating:

5

Author: Ebrahim Rahmanian

Last Updated: 2015-07-21

Package Version: 1.1.0.1

Example: 1.0.0.0

Category: Timers (Real time clock)

Downloaded: 1457 times

Followed by: 1 user

License: MIT license  

Please download and
Read Help.pdf

..............................Enjoy!

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "All in One - 31 function and sub , RTC ds1307 1307 in avr :)" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "All in One - 31 function and sub , RTC ds1307 1307 in avr :)" changes.

Do you want to report abuse regarding "All in One - 31 function and sub , RTC ds1307 1307 in avr :)".

  • Information
  • Comments (2)

Example Blog


1.open “DS1307_module.bas” file and edit I2c Config :
For ex)
' Soft_I2C config pins---------------------------
dim Soft_I2C_Scl_Output        as sbit at PORTC.0
dim Soft_I2C_Sda_Output        as sbit at PORTC.1
dim Soft_I2C_Scl_Input         as sbit at PINC.0
dim Soft_I2C_Sda_Input         as sbit at PINC.1
dim Soft_I2C_Scl_Direction as sbit at DDrC.0
dim Soft_I2C_Sda_Direction as sbit at DDrC.1

'------------------------------------------------
2. call DS1307_Init() in “main”
3. if is first Run ds1307 then call Ds1307_play() in “main”
4.Enjoy!        

'------------------------------------------
sub procedure DS1307_Init()

Init  software_i2c

 '------------------------------------------
sub Function Ds1307_is_play0_pause1()as Byte
If return 0 then ds1307 is Pause
If return 1  then …
--------------------------------------
Sub procedure Ds1307_play()
Play ds1307
if is first Run ds1307 then call Ds1307_play()
'------------------------------------------
Sub procedure Ds1307_pause()
Pause ds1307 time counter
'------------------------------------------
Sub procedure Ds1307_set_second(dim Second_0_59 As Byte)
Set second
Second_0_59 = 0 … 59
'------------------------------------------
sub Function Ds1307_get_second_0_59() As Byte
Get second
Return 0…59
'------------------------------------------
Sub procedure Ds1307_set_minute(dim Minute_0_59 As Byte)
Set minuite
Minute_0_59 = 0…59
'------------------------------------------
sub Function Ds1307_get_minute_0_59() As Byte
Get minute
Return 0…59
'------------------------------------------
sub Function Ds1307_is_24h_0_12h_1_mode() As Byte
If ds1307 is 24h mode then
Return 0 and … return 1
'------------------------------------------
Sub procedure Ds1307_set_24h_or_12h_mode(dim _24h_0_12h_1 As Byte)
Set ds1307 to 24h or 12h mode If _24h_0_12h_1=0 then 24h mode
Else if _24h_0_12h_1=1 then 12h mode
'------------------------------------------
sub Function Ds1307_is_pm_1_am_0() As Byte
If time is am then return 0 and … return 1 This Function worked in 24h and 12h mode !
'------------------------------------------
sub Function Ds1307_get_hour_0_23() As Byte
Get Hour
Return 0…23
This Function worked in 24h and 12h mode !
'------------------------------------------
sub Function Ds1307_get_hour_0_12() As Byte
Get Hour
Return 0…12
If is 0:00Am retrun 0
Then is 12:00pm Return 12
And otherwise is 1…11 This Function worked in 24h and 12h mode !
'------------------------------------------
sub procedure Ds1307_set_hour_0_23(dim Hour_0_23 As Byte )
Set Hour
Hour_0_23 = 0…23
This Function worked in 24h and 12h mode !
'------------------------------------------
Sub procedure Ds1307_set_hour_0_11(dim Hour_0_12  , Am0_pm1 As Byte )
Set Hour
Hour_0_12  = 0…12
Am0_pm1 = 0 or 1
0 is AM and 1 is Pm
This Function worked in 24h and 12h mode !
'------------------------------------------
sub Function Ds1307_get_dayofweek_1_7()as Byte
Get Day of Week
Return 1…7
1 is first day of week and 7 is …
'------------------------------------------
Sub procedure Ds1307_set_dayofweek(dim Dayofweek_1_7 As Byte )
Set day Of week
Dayofweek_1_7 = 1…7
1 is first day of week and 7 is …
'------------------------------------------
sub Function Ds1307_get_dayofmonth_1_31()as Byte
Get day Of Month
Return 1…31 '------------------------------------------
Sub procedure Ds1307_set_dayofmonth(dim Dayofmonth_1_31 As Byte)
Set Day Of Month
Dayofmonth_1_31 = 1…31
'------------------------------------------
sub Function Ds1307_get_monthofyear_1_12()as Byte
Get Month Of Year
Return 1…12
1 is “jan” and 12 is “Dec”
'------------------------------------------
Sub procedure Ds1307_set_monthofyear(dim Monthofyear_1_12 As Byte )
Set Month of Year
Monthofyear_1_12 = 1…12
1 is “jan” and 12 is “Dec”
'------------------------------------------
sub Function Ds1307_get_year_0_99()as Byte
Get Year
Return 0…99
0 is 2000 and 99 is 2099
'------------------------------------------
Sub procedure Ds1307_set_year(dim Year_0_99 As Byte )
Set Year
Year_0_99 = 0…99
0 is 2000 and 99 is 2099
'------------------------------------------
Sub procedure Ds1307_external_1hz_on()
External 1hz Clock on
Please Read Ds1307 DataSheet
'------------------------------------------
sub procedure Ds1307_external_4096hz_on()
External 4096hz Clock on
Please Read Ds1307 DataSheet
'------------------------------------------
sub procedure Ds1307_external_8192hz_on()
External 8192hz Clock on
Please Read Ds1307 DataSheet
'------------------------------------------
sub procedure Ds1307_external_32768hz_on()
External 32768hz Clock on
Please Read Ds1307 DataSheet
'------------------------------------------
sub procedure Ds1307_external_off_sqwe_0()
Set External Clock Off
And Digital Level of SQWE pin set 0
Please Read Ds1307 DataSheet
'------------------------------------------
sub procedure Ds1307_external_off_sqwe_1()
Set External Clock Off
And Digital Level of SQWE pin set 1
Please Read Ds1307 DataSheet
'------------------------------------------
sub Function Ds1307_read_ram(dim Ram_byte_index_0_55 As Byte) As Byte
Read byte in ds1307 Ram
Ram_byte_index_0_55= 0…55 address of ram
'------------------------------------------
sub procedure Ds1307_write_ram(dim Ram_byte_index_0_55 , Value As Byte)
Write byte in ds1307 Ram
Ram_byte_index_0_55= 0…55 address of ram
Value = Ram value!    

============================

www.mikroc.ir
E.Rahmanian
2014
============================

ALSO FROM THIS AUTHOR

All in One - 7 function and sub 7seg Lib in avr :)

0

All in One - 7 function and sub 7seg Lib in avr :)

[Learn More]

This Code is 250% Faster! Than Default StrCpy() subroutine for mikroc AVR

0

This Code is 250% Faster! Than Default StrCpy() subroutine for mikroc AVR

[Learn More]

All in One_85Function_Button and keypad1*1 ... 9*9key Lib

0

All in One_Button and keypad1*1 ... 9*9key Lib

[Learn More]