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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/14/00 15:05
Read: times


 
#3745 - RE: 8031 delay routine...
cycles
2 DELAY: PUSH B
1 MOV B,#0xF0 ;12 MHz, CHANGE TO 0xC9 FOR 11.0592
2 * ? DJNZ B,*
2 * 512 DJNZ B,* ;NO, THIS ISN'T A MISTAKE
2 POP B
2 DJNZ ACC,DELAY
1 RET
as you see the above executes f0h +512 = 992 times 2 cycles
plus 8 cycles = 1000 cycles which at 12 Mhz [cycle time =
12/freq] equals 1 mS
you use a 7.3728Mhz crystal giving you a cycle time of
12/7.3728Mhz = 1.627uSec. To delay a mS you will need
1000/1.627 = 615 cycles 615-8-512 = 95 cycles su you must
make inst #2 mov B,#95



List of 4 messages in thread
TopicAuthorDate
8031 delay routine...            01/01/70 00:00      
RE: 8031 delay routine...            01/01/70 00:00      
RE: 8031 delay routine...            01/01/70 00:00      
RE: 8031 delay routine...            01/01/70 00:00      

Back to Subject List