| ??? 01/25/03 22:21 Read: times |
#37270 - Basic Delay Commands Use |
Hi all,
Iam new user of 8051 controller and its assembly and want to learn the basic concepts and formula for working out with the controller. Now I need your help on the following:- Lets say that i have to write a program for creating 1 Second Delay... Now Please check what iam saying:- Firstly i will see what value of crystal iam using , lets say that iam using 12 Mhz cyrstal , now firstly i will calculate the number of instruction cycles required to create 1 second delay and this i will do the following:- 1) 12 ( value of crystal that is used) / 12 ( as indicated in the tutorial on this website that one machine cycle = 12 pulses) = 1 micro-second. 2) Now i will divide the given delay time which is one 1 second and divide it by 1 micro-second , the answer comes out to be 1000000 instruction cycles. 3) NOw since we know that in case of 8051 only 256 instruction cycle for one register is possible. So we will break 1000000 in our program as follows:- MOVE R0,#0 MOVE R1,#0 MOVE R2,#07 DELAY; DJNZ R0,$(it means that in reisgter Ro the decrement starts from 256 and $ sign continue to execuite the same line instruction untill zero is achieved i.e. 256 instruction cycles are complete) DJNZ R1,$ ( again the same and total makes it 256 x 256 =65536 instructions cycle) DJNZ R2,DELAY ( Now 65536 x 7 = Now i don't understand teh logic how this 1 second delay program is written, now please if possible explain me some step wise forumla which can help me in future problems. Thanks |
| Topic | Author | Date |
| Basic Delay Commands Use | 01/01/70 00:00 | |
| RE: Basic Delay Commands Use | 01/01/70 00:00 | |
| RE: The Generic delay loop | 01/01/70 00:00 | |
| RE: Basic Delay Commands Use | 01/01/70 00:00 | |
RE: Basic Delay Some Way | 01/01/70 00:00 |



