??? 11/12/06 07:26 Read: times |
#127808 - Yes ... but WHAT fixed it??? Responding to: ???'s previous message |
Dan said:
Ok. I fixed it. I simply removed the first three lines of code from the bin_to_bcd routine where r2, r3, and r4 were (needlessly) initialized to 0.
However, I still don't understand why this fixed it. Even though there is no need to initialize r2, r3, r4 to 0, I don't see why it would prevent 1's in the LSB once those registers are re-assigned values. Also, what I said about the previous code working in my counter circuit still stands, which confuses me even more. I am confused also. Contrary to what Charles said, I think your bin_to_bcd routine works properly. I assembled it and stepped through the code in a debugger and saw that it was doing the right thing. I also don't understand why removing the initialization of r2, r3, or r4 would make any difference. Further, I don't see why it would work with numbers from the counter but not with numbers grabbed from Timer 0. I suggest that you put the initialization of r2, r3, and r4 back in and check if it still works. I bet it will. You may never know what was wrong before, but I bet it didn't have anything to do with the initialization of r2, r3, and r4. -- Russ |