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]
Rating:
Author: Ebrahim Rahmanian
Last Updated: 2014-11-20
Package Version: 1.0.0.0
Example: 1.0.0.0
Category: Timers (Real time clock)
Downloaded: 1642 times
Not followed.
License: MIT license
All in One - 31 function and sub , RTC ds1307 1307 in Bascom avr Compiler :)
Do you want to subscribe in order to receive notifications regarding "All in One - 31 function and sub , RTC ds1307 1307 in Bascom Avr Compiler :)" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "All in One - 31 function and sub , RTC ds1307 1307 in Bascom Avr Compiler :)" changes.
Do you want to report abuse regarding "All in One - 31 function and sub , RTC ds1307 1307 in Bascom Avr Compiler :)".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
1409512095_all_in_one___31__other_avr.zip [149.20KB] | Other AVR Compilers |
|
'-----------------------------------------------
1.Edit “Sub Ds1307_config()”
:For ex)
' Soft_I2C config pins---------------------------
Sub Ds1307_config() 'Config ds1307
Waitms 50
Dim A As Byte
Dim B As Byte
Config Scl = Portc.5 'set scl_i2c pin
Config Sda = Portc.4 'set sda_i2c pin 'set i2c speed 100khz Config I2cdelay = 10
End Sub '
------------------------------------------------
2. call Ds1307_config()
3. if is first Run ds1307 then call Ds1307_play() 4.Enjoy! '
------------------------------------------
sub procedure Ds1307_config()
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