Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Using Softcklock (RTC) together with Dcf77.lib?

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
DG7GJ

Bascom Member



Joined: 21 Jan 2010
Posts: 6

blank.gif
PostPosted: Sat Jan 14, 2017 3:39 pm    Post subject: Using Softcklock (RTC) together with Dcf77.lib? Reply with quote

Hello!

I confused since days:
An Softclock with an 32,768kHz Crystal at Timer2 in Asyncron-Modus via "Config Clock = Soft" will rum without problems.
But if I use "Config Dcf77..." the compiler will always ignore the asynchron Timer2 always.

I dosen't matter if I configure the Timer2 with

Code:
Config Timer2 = Timer , Async = On , Prescale = 128         ', Compare = Clear
Enable Timer2


or manuallity with

Code:
Tccr2 = &B00000101                                          
Ocr2 = &B00000000                                          
Assr = &B00001000  


After I confugure the dcf77.lib

Code:
Config Dcf77 = Pina.1 , Timer = 1 , Timer1sec = 2 , Inverted = 1 , Debug = 1 , Check = 2 , Update = 2 , Updatetime = 03 , Powerpin = Pina.0 , Powerlevel = 1 , Gosub = Sectic
 


The RTC will don't work anymore.
The RTC-Sectic looks like from mainklock (external 8MHz Crystal) with subotimal Prescalers.
The RTC-Seconds extremely zu long:
The RTC from the Dcf77.lib will round 54 seconds count in real 60 seconds.

An real Softklock (Timer2 asynchron with 32,768kHz Crystal at TOSC-Pins) will only differ araund +-1seconds over 24 Hours.

The only thing that i Try since many days:

An free running RTC with 32,768kHz Crystal at asynchron Timer2, wich will synchonisize once per Day with the DCF77-Rountine.
How it is possible?

Juergen[/quote]

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1161
Location: France

france.gif
PostPosted: Sat Jan 14, 2017 3:50 pm    Post subject: Reply with quote

first of all try the sample, dcf77 you will find it under datetime sample
then try to add a timer
JP
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Sat Jan 14, 2017 4:21 pm    Post subject: Reply with quote

If you are using dcf77 then there is already a softclock running so I don't think you can run 2 clocks at the same time.
_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1161
Location: France

france.gif
PostPosted: Sat Jan 14, 2017 5:24 pm    Post subject: Reply with quote

Whoooo Evert Smile

2000 post !


Bravo !
JP Wink
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Sat Jan 14, 2017 5:38 pm    Post subject: Reply with quote

Shocked Missed that !
2000 posts in 12 year, that's a lot of hours typing.

What I find even more incredible is my an#148, that has been downloaded now 158000 times.

Thanks JP
Now 2001 posts, time for some champagne.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5920
Location: Holland

blank.gif
PostPosted: Sat Jan 14, 2017 9:20 pm    Post subject: Reply with quote


Well done Evert !

_________________
Mark
Back to top
View user's profile Visit poster's website
mat-sche

Bascom Member



Joined: 02 Apr 2006
Posts: 13

germany.gif
PostPosted: Wed Oct 11, 2017 8:29 am    Post subject: Reply with quote

Evert Smile wrote:
If you are using dcf77 then there is already a softclock running so I don't think you can run 2 clocks at the same time.

Hello,

soooo...... I have the same problem with the dcf77 routine. From time to time my dcf77 receive signal is very bad and I can't update my softclock over the routine. I use the atmega2560 with a quarz on tosc 1/2. It's possible to use it with the dcf77 routine?

thank's and gruesse aus Deutschland Smile
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1161
Location: France

france.gif
PostPosted: Wed Oct 11, 2017 9:41 am    Post subject: Reply with quote

Hi,
the problem is : DCF77 routine used by bascom use or not the soft clock var from Bascom (_sec _min,.... _year) ? yes it does ! I checked.

Because bad reception on DCF77 I don't use it any more, now I use DS3231 RTC, it is very accurate.
And, I think you can use it with DCF77 if you need a better accuracy.
I give you the .inc file, if you want to use it you need to replace the Bascom clock var (_sec _min,.... _year) with your own variables
You can found some shield with DS3231 for less than a good crystal. because some 32...k crystal are very bad, I tested some with a frequency meter

add in you main prog

$lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI
' Configure the SCL and SDA pins
Config Sda = Portd.1
Config Scl = Portd.0
'--------------constant--------------------------------------------------------------------------
Const Ds3231r = &B11010001 'Ds3231 is very similar to DS1307 but it include a precise crystal
Const Ds3231w = &B11010000

and put the GND of M3260 common with DS3231...
JP Wink
Back to top
View user's profile Visit poster's website
mat-sche

Bascom Member



Joined: 02 Apr 2006
Posts: 13

germany.gif
PostPosted: Wed Oct 11, 2017 11:31 am    Post subject: Reply with quote

Hello JP Smile
Thank's for your replay!
Currently I use the ds 1307 RTC-Chip from Dallas.
My Think it was, the best way is I use a softclock with a µC and a high precission quarz on the tosc 1/2 pin from controller and use the dcf signal to update from time to time the internal clock data.
Now I'm looking for a method to change the dcf lib. It's possible this?
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1161
Location: France

france.gif
PostPosted: Wed Oct 11, 2017 5:31 pm    Post subject: Reply with quote

I make a mistake, I reed to fast the .lib file, the var are different but the lib use the
Getdatetime:
Setdate:
Settime:

where these var are called. please read the config clock chapter in the help about these label, my inc file is done with these help file.

I don't know enough assembler and the lib to help you more.

so If you modified the lib, you have to make a copy before !
Let me know for the future.
"bon courage"
JP
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5920
Location: Holland

blank.gif
PostPosted: Wed Oct 11, 2017 7:14 pm    Post subject: Reply with quote

i think this has been asked before and if i remember there is even code for it, but i am not sure.
when using dcf77 there are multiple variables created.
the most important ones :

Dcf_sec As Byte
Dcf_min As Byte
Dcf_hour As Byte
Dcf_day As Byte
Dcf_month As Byte
Dcf_year As Byte
Dcf_weekday As Byte


you can check those and/or fill them. for other dcf variables, check the report.

_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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
You cannot attach files in this forum
You cannot download files in this forum