Joined: 24 May 2004 Posts: 76 Location: Swietochlowice, Poland
Posted: Sun Jul 29, 2007 1:33 pm Post subject:
Let's make some calculations:
Fosc = 24MHz = 24 000 000Hz
One machine cycle (1 simple instruction) are executed in 6 states with 2 phases each, so we can simple divide Fosc by 12:
24 000 000MHz/12 = 2 000 000MHz
The period is: 1/2 000 000Hz = 0,000 000 5s for one instruction.
In this case, how many periods (simple instructions) we need to make 1 second delay time?... The answer is:
1/0,000 000 5s = 2 000 000
This empty FOR...NEXT loop:
Code:
For Delayword =1To45440 Next Delayword
is a quite near to execute 2 000 000 intructions. That's all.
ps. This is still not accurate time! In the latest BASCOM-8051 compiler, code above are executed in ~2 272 418 instructions. So the delay time is a bit longer than 1s.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum