Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

NTP function

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
jboavida

Bascom Member



Joined: 12 Feb 2005
Posts: 94
Location: Portugal

portugal.gif
PostPosted: Wed Feb 22, 2017 1:20 pm    Post subject: NTP function Reply with quote

Hi,
I'm using the NTP function provided by Micheal (aka Six1) from this post.

http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=11141

I can get the current time from the NTP servers. I had try 3 or 4 different and all work ok.

Well almost Smile I can get sync time correctly at first time (after power up).

Then if I sync again after 2 hours I get the same time as before (does not update).


Example:

Power on

Get NTP -> 09:05:21 -> Correct

After 2 hours:

Get NTP -> 09:05:21 -> incorrect -> same as last sync


Power off and on again

Get NTP -> 11:05:21 -> Correct

What i'm doing wrong?

Tks

Joaquim
Back to top
View user's profile Visit poster's website MSN Messenger
jboavida

Bascom Member



Joined: 12 Feb 2005
Posts: 94
Location: Portugal

portugal.gif
PostPosted: Wed Feb 22, 2017 8:06 pm    Post subject: Reply with quote

Got it. In the test code "M128_Protocols_Test.bas" file there was a missing "Enable Interrupts".
The NTP function "Check_Time" compares the "Local _time" with "Ntp_request_time".
"Local _time" var is increased by one in a timer interrupt every second. Since interrupts were not enabled, the timer event never fired, so the var was never increased.
So, same time forever...

Code is ok...

Joaquim
Back to top
View user's profile Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP 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