We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm trying to pause at while (TL0 <= 10) {} until I get a count of 10. When I run the program, the program doesn't pause at while (TL0 <= 10) {}. It's like the while is false. Can any one see something I don't? // Setup TH0 Timer0 for 16-bit counter mode TMOD = (TMOD & 0xF0) | 0x05; //Set the counter0 Run control bit. TR0 = 1; while (1) { //reset Tiimer0 (counter) TL0 = 0; // Toggle P3.4 increment the count while (TL0 <= 10) {} //The rest of the code }
Did you try to debug your code step-by-step? Sometimes it helps alot (= Your code seems correct. Maybe is it from hardware? You know, simple button generates alot of pulses when pushed. Do you use software/hardware protection against a jar? Good days!