I use Keil sometimes and while using a timer in autoload mode, the TH0 is loaded with the calculated value but TL0 starts incrementing from 00 instead of the calculated value F0.Am I missing something while using or configuring the keil simulator?
The code sent by Erk will work as it functions smoothly in mode 1. After reading the above posts, I think the simulator is designed to function the way it operates. Once it reads the mode, it should load both the registers with the pre-defined values to function in mode 2, but for some reason it doesnt. But the issue is after the roll-over of the TF flag the timer starts again as you step in to execute the next instruction and everything down the lane is stuck.
"After reading the above posts, I think the simulator is designed to function the way it operates. "
tough to think otherwise.
"Once it reads the mode, it should load both the registers with the pre-defined values to function in mode 2, but for some reason it doesnt."
it doesn't because it is not designed to do that, as documented in the datasheet.
the simulator .... it doesn't because it is not designed to do that, as documented in the datasheet.
no simulator is perfect, whatever is documented in the datasheet for the chip may and may not be correctly simulated.
Erik
The code sent by Erk will work as it functions smoothly in mode 1. I can appreciate that when the homewrecker nitpicks everything I post you will have doubts trying it. Well, finally we got you going
Erik,
Too much testosterone there. The homewrecker ain't no girl, trust me on this one. Like lady Gaga :-)
"no simulator is perfect, whatever is documented in the datasheet for the chip may and may not be correctly simulated."
reading comprehension, erik.
that "it" refers to his statement about the chip loading up both TH0/TL0 once set in mode 2. the chip does NOT do that. and the simulator correctly simulates that portion of the functionality.
and his code runs also as expected in the simulator, as it did on real hardware - because I tried. none of what he "observed" could be observed in my set-up, or inferred from the datasheet, or simulations.
I am going to incline to say that this is a user (observational) problem.