Page 3 of 4

Re: RTC Query

Posted: Fri Mar 15, 2024 11:30 am
by NL_QL_Usr
just as experiment.....

For anyone who wants to give it a try....

Arduino code + Superbasic file

please ignore the weather tningy.... I am not ready for HTTPS yet :)
Would like to see if anyone can add nice things as well...

It works perfect on a Q68
I don`t have a cable for my old ql so I couldn't try it.
Probably the baud rate should than be 9600 max I think

Re: RTC Query

Posted: Fri Mar 15, 2024 12:32 pm
by tofro
NL_QL_Usr wrote: Fri Mar 15, 2024 11:30 am just as experiment.....

For anyone who wants to give it a try....

Arduino code + Superbasic file

please ignore the weather tningy.... I am not ready for HTTPS yet :)
Would like to see if anyone can add nice things as well...

It works perfect on a Q68
I don`t have a cable for my old ql so I couldn't try it.
Probably the baud rate should than be 9600 max I think
If you simply want an NTP client for the Q68, there's a tiny one here: https://github.com/tofro/Q68NTP

Obviously won't help anyone who wants to set their QL clock :)

Re: RTC Query

Posted: Fri Mar 15, 2024 12:51 pm
by NL_QL_Usr
:D

It was not mend for the Q68
But the same code could be used for an awful lot of nice things
On the Q68 my RTC works great!!

Re: RTC Query

Posted: Fri Mar 15, 2024 6:43 pm
by Peter
tofro wrote: Fri Mar 15, 2024 12:32 pm If you simply want an NTP client for the Q68, there's a tiny one here: https://github.com/tofro/Q68NTP
Cool. Which network driver do you use?
tofro wrote: Fri Mar 15, 2024 12:32 pm Obviously won't help anyone who wants to set their QL clock :)
Which brings up the QL ethernet question again - with a CP2200 the Q68 stuff could be mostly re-used.

Re: RTC Query

Posted: Fri Mar 15, 2024 6:59 pm
by tofro
Peter wrote: Fri Mar 15, 2024 6:43 pm
tofro wrote: Fri Mar 15, 2024 12:32 pm If you simply want an NTP client for the Q68, there's a tiny one here: https://github.com/tofro/Q68NTP
Cool. Which network driver do you use?
Martin's. But as NTP is using UDP, Wolfgang's might possibly work as well - Haven't tried, though.

Re: RTC Query

Posted: Sat Mar 16, 2024 7:10 am
by NL_QL_Usr
tofro wrote: Fri Mar 15, 2024 12:32 pm

If you simply want an NTP client for the Q68, there's a tiny one here: https://github.com/tofro/Q68NTP

Obviously won't help anyone who wants to set their QL clock :)
Hey Tofro;

Saw your NTP client very nice!!!!
I have done some asm programming years ago
would be nice to try that again.

But thanks for your code

Re: RTC Query

Posted: Tue Mar 26, 2024 2:14 pm
by t0nyt
I'm nearly in business

Wi-fi modem has arrived and is connected to my wi-fi and QL

And (after issuing a AT&T command to setup the NTP server) I now simply have to issue an ATI7 command to get current date/time

Still trying to find more details on the AT&T command so I can set the best timezone (given BST is on the way) and more importantly setting a better date/time format (my guesses haven't worked so far)

EDIT: sussed the format %dd/%MM/%yyyy %hh:%mm:%ss, now to sort the timezone (as BST is several hours out!)

Now I need to write a basic (or assembler) utility to run at boot to grab the date/time from the modem and set it on the QL

IMG_3759.jpeg
IMG_3759.jpeg (79.59 KiB) Viewed 1244 times
IMG_3757.jpeg

Re: RTC Query

Posted: Tue Mar 26, 2024 4:29 pm
by t0nyt
It works! (Unashamedly stole some code from NL_QL_USR)

It's very rough and ready at the moment, need some more error trapping etc.

Code: Select all

100 OPEN #8,ser2h
110 BAUD 1200
120 PRINT #8,"AT&T" & CHR$(34) & "GMT,%yyyy%MM%dd%HH%mm%ss,0.uk.pool.ntp.org" & CHR$(34)
130 INPUT #8,a$
140 IF a$(1 TO 2)<>"OK" THEN GO TO 130
150 PRINT #8,"ATI7"
160 t$=a$
170 INPUT #8,a$
180 IF a$(1 TO 2)<>"OK" THEN GO TO 160
190 CLOSE #8
200 ye=t$(1 TO 4)
210 mn=t$(5 TO 6)
220 dd=t$(7 TO 8)
230 hh=t$(9 TO 10)
240 mi=t$(11 TO 12)
250 s=t$(13 TO 14)
260 PRINT #0,"Date/Time: " & t$(1 TO 14)
270 SDATE ye,mn,dd,hh,mi,s

Re: RTC Query

Posted: Tue Mar 26, 2024 6:28 pm
by t0nyt
As I use the same QIMSI images for real QL & Q-emuLator I realised I needed a version that wouldn't hang up waiting for an input so have merged the following into my boot file

Code: Select all

500 OPEN #8,ser2h
510 BAUD 1200
520 PRINT #8,"AT&T" & CHR$(34) & "GMT,%yyyy%MM%dd%HH%mm%ss,0.uk.pool.ntp.org" & CHR$(34)
530 a$=GetLine$(8)
540 IF a$="" THEN GO TO 700
550 IF a$(1 TO 2)<>"OK" THEN GO TO 530
560 PRINT #8,"ATI7"
570 t$=a$
580 a$=GetLine$(8)
590 IF a$="" THEN GO TO 700
600 IF a$(1 TO 2)<>"OK" THEN GO TO 570
620 ye=t$(1 TO 4)
630 mn=t$(5 TO 6)
640 dd=t$(7 TO 8)
650 hh=t$(9 TO 10)
660 mi=t$(11 TO 12)
670 s=t$(13 TO 14)
680 PRINT #0,"Date/Time: " & t$(7 TO 8) & "/" & t$(5 TO 6) & "/" & t$(1 TO 4) & "   " & t$(9 TO 10) & ":" & t$(11 TO 12) & ":" & t$(13 TO 14)
690 SDATE ye,mn,dd,hh,mi,s
700 CLOSE #8
710 DEFine FuNction GetLine$(ch)
720 i$=""
730 c$=INKEY$(#ch,100)
740 IF c$="" THEN RETurn ""
750 IF c$=CHR$(10) THEN RETurn i$
760 i$=i$ & c$
770 GO TO 730
780 END DEFine 

Re: RTC Query

Posted: Wed Mar 27, 2024 6:27 am
by NL_QL_Usr
"Glad to be of service" :D