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?
all you need to do is to load his code into the compiler and run it through. I see no problem in it compiling, but the discussion is about simulating
Erik
PS I got rid of the simulator ages ago when it took me through some frustrating sequences. If I can't emulate/ICE/JTAG/... I do not do.
"I can easily see such "slipping through the cracks"."
that's the problem throughout the whole discussion. his code absolutely works: either in simulation or on actual hardware.
and his code has identical return mechanism to yours. so if his code couldn't return, yours couldn't either.
all you need to do is to load his code into the compiler and run it through.
the problem is NOT the code.
How does this simulator help in debug mode when it gets stuck at some point for such a small program? The issue is not the size of the program, but whether the particular operation were correctly implemented when the simulator was made. You are/were making a somewhat 'exotic' piece of code. Using reload "without making use of the feature" and I can easily see such "slipping through the cracks". I (and I guess most) have never used reload and stop together. Reload is usually used with a "timer tick" that you never stop.
Even though I understand that the simulator is not designed to operate in a specific way for certain modes does not mean that it should get stuck at certain instruction and does not return to the main program or execute the next set of instructions. If you run the code u will find that its stuck in the while loop with timer getting loaded and overflow repeatedly and the program does not return to main. I dont think any datasheet specifies such abnormal operation. How does this simulator help in debug mode when it gets stuck at some point for such a small program?
"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.
Erik,
Too much testosterone there. The homewrecker ain't no girl, trust me on this one. Like lady Gaga :-)
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
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.
"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 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.
his code is actual and complete,
You're either deluding yourself, or you're deliberately talking nonsense. I'm sure of that because it's blatantly clear that you have no way of knowing what you just claimed.
'will continue, a running timer (0 or 1) will (eventually) set TF to 1.'
that's the point of the entire discussion, erik: his code, as well as yours, SHOULD work. but he reported it didn't work.
it does work, I have a sneaky suspicion that autoload mode confuses the simulator. Not the first time the simulator has 'simulated' instead of 'replicated'. If it confuses the chip the chip is defective.
why on earth not just see what happens with non-autoload the OP has it right at his fingertips and trying it instead relying on bile from the homewrecker would take, at most 5 minutes.
"He may be Jack Sprat."
Or maybe even a Zeusti.
But he/she definitely also hides behind the names Qili, Millwood, and fdan00 on other forums to name a few.
Tamir; Ashley is a guy or a shim. He may be Jack Sprat. Bradford
"I am beginning to suspect that Ashley is Jack Sprat's mother in law..."
tammy, as long as i am not YOUR mother or mother in law, i'm ok, :)