| ??? 03/25/00 18:36 Read: times |
#1953 - RE: Need help with code |
Hi Nir,
I have done the same thing which you are going to do. Coded an RTC within the cpu, and I had the same problem as you have. I have used different/direct approach, since I have little knowledge into this field, fortunately it worked and still working fine. While incrementing the 'seconds-counter' the code checks the contents and when it finds that seconds-counter' contents 9, i.e. 0000 1001b, it adds#10h to 'seconds-counter'. if it has to add #10h when first 4bits are #09 then it also checks the higher nibble, that does it reaches #06? if the higher nibble reaches #06 then it resets 'soconds-counter' to #00 and adds #01 to minute counter, and checks through similar algoritham with minutes and hours. Be careful while adding #10h to 'seconds-counter' you have to move the seconds-counter to Acc, Add#10h and then use DAA command to decimal adjust. I was ignoring it before and somehow results was not what I was expecting. Though it seems irrelevant since we are taking care in our algorithm about not exceeding #09 but for the higher nibble accuracy, we have to justify DAA command. I am sure, you will find it very easy and direct, though it took me whole day to make it work. Thanks and email me if you want to see my code. Rauf / Microlink |
| Topic | Author | Date |
| Need help with code | 01/01/70 00:00 | |
| RE: Need help with code | 01/01/70 00:00 | |
| RE: Need help with code | 01/01/70 00:00 | |
| RE: Need help with code | 01/01/70 00:00 | |
| RE: Need help with code | 01/01/70 00:00 | |
| RE: Need help with code | 01/01/70 00:00 | |
RE: Need help with code | 01/01/70 00:00 |



