mitxela.com forum
Welcome. Please log in or register.

Timezone indicator modification
slate Posted: 30 Sep 2023, 07:56 PM
Avatar


Member
Posts: 5
Joined: 30-September 23
WOW this clock is amazing. Mitxela, you've really created something incredible here. Just finished initial assembly and setup (still have to 3D print colon LED cover/holders) and I'm so impressed with the accuracy and fit/finish of this design.

One change I wanted to make is to replace the timezone indicator with a capital T to conform to the ISO standard (I know the T isn't required to conform but the timezone indicator isn't too useful to me).

I'd like to modify the code to illuminate all four timezone indicator LED's instead of just the bottom/top two. Any ideas for doing so?

(User posted image)


-------------
[top]
mit Posted: 1 Oct 2023, 01:40 PM
Avatar
yeah whatever

Admin
Posts: 538
Joined: 4-May 16
One or two people have made the same modification before. I'm not sure if they sent any pictures of the result. I don't remember publishing any alternate version of the code, but the change should be simple enough.

The source for the clock is here: https://github.com/mitxela/PrecisionClockMkII/blob/master/GPSClock.asm

The timezone indicator lights are controlled by the values in registers labelled dGMT and dBST. The value needs to be exactly 0x80 (or 0b10000000) to light up.

There is a lot of code within #ifdef blocks that only gets used for certain timezones, but if you search for INDICATE_UTC which is one of the alternate LED modes you can see that both registers are either cleared, or loaded with 0x80 via r20 (the dGMT and dBST registers are not immediate and have to be loaded via a mov instruction)

One method would be to find each relevant place where the lights are set, and replace it with, e.g.

ldi r20,0b10000000
mov dBST,r20
mov dGMT,r20

Alternatively, since you just want the lights to be on permanently, you could look for where dGMT and dBST get used. I think it is just the four occurances between line 500 and 524. It's being ORed with r19, so you could replace each of those with

ori r19,0b10000000


-------------
[top]
slate Posted: 1 Oct 2023, 09:13 PM
Avatar


Member
Posts: 5
Joined: 30-September 23
Awesome, thank you. I'll give that a shot and report back.

-------------
[top]
slate Posted: 2 Oct 2023, 01:41 AM
Avatar


Member
Posts: 5
Joined: 30-September 23
I've got the code modified using your first suggestion but I'm having trouble getting the environment setup on Windows. I've got a Mac as well but this is my first time compiling assembly to Hex so any suggestions are welcome. I installed Microchip Studio and make (and changed the makefile to suit the ISP programmer I'm using) but the compilation fails with

"process_begin: CreateProcess(NULL, perl -lne "m[ifdef TZ_(\w+)] and print lc(\"build/$1.hex\")" GPSClock.asm, ...) failed."

-------------
[top]
mit Posted: 3 Oct 2023, 10:21 AM
Avatar
yeah whatever

Admin
Posts: 538
Joined: 4-May 16
I can't help you with Microchip Studio, I've not used it. I would suggest just using avrasm.exe and following the instructions in the readme. You can use WSL on windows which might be easier. Or avoid the makefile and just build the version you want directly by setting the definitions, all that perl script is doing is looping over each time zone.

-------------
[top]
slate Posted: 4 Oct 2023, 04:50 AM
Avatar


Member
Posts: 5
Joined: 30-September 23
Success, will post a photo when I've got the 3D printed inserts finished.

Wow that was a pain in the ass, here's how I did it on Windows. Tried using WSL but I could tell it was going to be more trouble than it was worth when I'd already gotten avrasm2 to function in the Windows command line.

Modified the GPSClock.asm file per your suggestion using the first method of replacing all instances of clear dBST or clear dGMT with mov dBST ,r20 and mov dGMT ,r20. I was also having trouble passing time zone definitions from the command line through avrasm2 so I just removed all #ifdef statements that weren't relevant and left the #define portion of us_pacific.

Final compile command was:
C:\Users\User\Downloads\PrecisionClockMkII-master\PrecisionClockMkII-master>avrasm2 -fI -o us_pacific.hex -I "C:\Program Files (x86)\Atmel\Studio\7.0\packs\atmel\ATtiny_DFP\1.10.348\avrasm\inc" -i"tn2313def.inc" GPSClock.asm


After that compiled (with 3 warnings) I used avrdude to flash to the attiny. Booted it up and all four timezone LED's lit up and GPS eventually synced and grabbed the right date/time.

Thanks again for your help (and for forcing me to solve some of this on my own).

-------------
[top]
mit Posted: 6 Oct 2023, 09:02 AM
Avatar
yeah whatever

Admin
Posts: 538
Joined: 4-May 16
Glad you got it working. Yes, please share some pictures when the inserts are done, it would be great to see the results.

-------------
[top]

Sign in to post a reply.