Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/04/04 22:32
Read: times


 
#69854 - RE: need help with tutorial
Responding to: ???'s previous message
You say you are using a simulator. Beware that this is not the same as using an actual chip! Simulators do not emulate the hardware exactly. The timers in my simulator (JSim 4.05) increment only every one instruction simulated, as opposed to every 12 clock cycles on a real chip, ie MUCH, MUCH slower. For simulation purposes this can be quite acceptable, but you are folling yourself if you think that your simulator is exactly like running your program on a real chip.

Read the manual of your simulator to see how it simulates timers, and do this little test:

Load this program into your simulator, and open a watch window onto internal RAM. On address 0 you will see r0 of register bank 0. This program will keep changing r0, so you will see when you run the program (if your watch is real time...) that value increment all the time. If you would run this program on a real 8052 at 12 MHz, it would increment every 4 microseconds. I will bet that in the simulator it goes so slow that you can follow the changes with the naked eye.

If you really want to learn 8052, use a real chip. There is no substitute for the real thing.

 			org	0
			ljmp	init

			org	0000bh
			inc	r0			;cycle r0
			reti

			org	00800h

init:			mov	th0,#4			;Load timer.
			mov	tl0,#4
			mov	tmod,#002h
			setb	tr0
			mov	ie,#082h		;ea, et0

			sjmp	$

			end



List of 12 messages in thread
TopicAuthorDate
need help with tutorial            01/01/70 00:00      
   RE: need help with tutorial            01/01/70 00:00      
   RE: need help with tutorial            01/01/70 00:00      
      RE: need help with tutorial            01/01/70 00:00      
   RE: need help with tutorial            01/01/70 00:00      
      RE: need help with tutorial            01/01/70 00:00      
      RE: need help with tutorial            01/01/70 00:00      
   RE: need help with tutorial            01/01/70 00:00      
      RE: need help with tutorial            01/01/70 00:00      
   RE: need help with tutorial            01/01/70 00:00      
      RE: need help with tutorial            01/01/70 00:00      
         Slip of the pen            01/01/70 00:00      

Back to Subject List