zerog2k / stc_diyclock

STC DIY Clock redux (STC15F204EA, STC15W404AS, STC15W408AS)
MIT License
171 stars 66 forks source link

Some optimisations... #4

Closed jjmz closed 8 years ago

jjmz commented 8 years ago

Hi,

I just discovered your code after buying a DIY STC clock too... Surprise, it was using a STC15, which I long time ago already used (since I am the guy who did the tests with the STC15+NRF24L01 modules on jjmz.free.fr...).

So I tested your code, and it is just great - when I will have more time, I will try to modify it to display day-of-week as text, and perhaps some more other things.

I noticed that you were perhaps short on memory to try more things, so here are some modifications you could pick to save some memory : use 'callee_saves' for functions that are not modifying lots of registers, don't use struct as function parameters - it generates quite long 8051 code.

I have not finished with the 'rtc' and 'config' structs at fixed memory location, but since those are using bit fileds, it could take advantage of the 0x20-0x3F memory range of the 8051 that is also accessible as bits.

JJ

PS: I wasn't aware of the stcgal project to program the STC from Linux. I learnt about it though your project. With it, I will perhaps continue my tests on the STC15LC204+NRF modules... Thanks.

zerog2k commented 8 years ago

Thanks JJ. Look forward to more PRs ;) Also, just noticed that another guy, @dev26th has done some optimizations, and more interestingly, a DCF77 implementation (not useful for North American folks like me, but perhaps you - assuming you are in FR). https://github.com/dev26th/stc_diyclock

Perhaps he can cherry pick and PR some of the DCF77 (and any other optimizations not already tackled by you.)

jjmz commented 8 years ago

I will have a look at the fork with the DCF77 -I have a DCF77 module around, I will try to connect it. In the meantime, I am continuing to optimise the code even more... Really funny to return to sdcc/8051 coding. I have changed ds1302.c quite a lot, with inline asm version of send/read-byte, and a 12/24 switch function that preserves the hour setting. I think I have not destroyed any functionality in your code. I will issue a PR in a few days, if you want.