Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Syssec works strange

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
Gyurma

Bascom Member



Joined: 10 Mar 2005
Posts: 17
Location: Budapest

hungary.gif
PostPosted: Mon May 07, 2007 5:14 pm    Post subject: Syssec works strange Reply with quote

Hi!

If the input parameter type is different (but the input time value is the same) then Syssec time is different.
For example:

Target = SYSSEC()
Target = SYSSEC(strTime, strDate) 'strtime, strdate is actual

There are some hours difference between the 2 SYSSEC time!

Does anybody know something about this?
Back to top
View user's profile Visit poster's website
oe9vfj

Moderator



Joined: 17 Jun 2004
Posts: 269
Location: Austria, Hard

austria.gif
PostPosted: Mon May 07, 2007 6:16 pm    Post subject: Reply with quote

Are you sure, that this two statements use same time/date parameter.

SYSSEC() uses the CLOCK variables _Sec, _Min, _Hour, _Day, _Month, _Year which are updated by the CLOCK routine.

strDATE and strTime are user-defined variables which must be filled by the user-prgram. If the values in strTime and strDate differs to _Sec .. _Year you will get different SYSSEC.

You make then to same values with
strTime = Time$
strDate = Date$

If you have further problems, please provide a code snippet, which produces the error.

_________________
regards Josef

DOS - File System for BASCOM-AVR on http://members.aon.at/voegel
Back to top
View user's profile Visit poster's website
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Mon May 07, 2007 7:13 pm    Post subject: Reply with quote

Hi,

Works here. Try the sample below.

Best regards,

Luciano

Code:
$regfile = "m128def.dat"
$crystal = 4000000
$baud = 9600

$hwstack = 32
$swstack = 16
$framesize = 40

Dim strDate as String * 8
Dim strtime as String * 8
Dim lSysSec as Long

Config Clock = Soft
Config Date = Mdy , Separator = /

Date$ = "01/01/00"
Time$ = "00:00:00"

Enable Interrupts


Do
    Waitms 500
    Print Date$ ; Spc(3) ; Time$
    lSysSec = Syssec()
    Print lSysSec
    Print "========================================"

Loop until lSysSec = 5

Time$ = "23:59:55"

Do
    Waitms 500
    Print Date$ ; Spc(3) ; Time$
    lSysSec = Syssec()
    Print lSysSec
    Print "========================================"

Loop until lSysSec = 86399


strTime = "00:00:00"
strDate = "01/02/00"
lSysSec = SysSec(strTime , strDate)
Print lSysSec ; Spc(3) ; strDate ; Spc(3) ; strTime ; " (First second day 2)"
Print "========================================"

End


The output:
Code:


01/01/00   00:00:00
0
========================================
01/01/00   00:00:01
1
========================================
01/01/00   00:00:01
1
========================================
01/01/00   00:00:02
2
========================================
01/01/00   00:00:02
2
========================================
01/01/00   00:00:03
3
========================================
01/01/00   00:00:03
3
========================================
01/01/00   00:00:04
4
========================================
01/01/00   00:00:05
5
========================================
01/01/00   23:59:55
86395
========================================
01/01/00   23:59:56
86396
========================================
01/01/00   23:59:56
86396
========================================
01/01/00   23:59:57
86397
========================================
01/01/00   23:59:57
86397
========================================
01/01/00   23:59:58
86398
========================================
01/01/00   23:59:59
86399
========================================
86400   01/02/00   00:00:00 (First second day 2)
========================================
 
Back to top
View user's profile
Gyurma

Bascom Member



Joined: 10 Mar 2005
Posts: 17
Location: Budapest

hungary.gif
PostPosted: Fri May 11, 2007 9:40 am    Post subject: Reply with quote

Hi!

I have user clock. I give the time values to the clock variables (_sec, _min, ...) and then make SYSSEC() and it's good now. I don't know what was the problem with the first try with StrTime and StrDate but this is good now and simple. I can compare two time value and when they are similar, SYSSEC value is also similar so it works good.


THX for the replies!
PEACE! Wink
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive 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