P Peter Nabil New Member Feb 12, 2005 #1 hi every one i have a 89c51 microcontroller and i need to make a program to make a delay for 1ms would u help me plz
hi every one i have a 89c51 microcontroller and i need to make a program to make a delay for 1ms would u help me plz
Josephselim New Member Feb 13, 2005 #2 Dear Peter in order to calculate the time delay you have to tell us what is the speed of your crystal oscillator that you use
Dear Peter in order to calculate the time delay you have to tell us what is the speed of your crystal oscillator that you use
J Jay.slovak Active Member Feb 13, 2005 #3 For 8051's you should asume 12 clocks per instruction. So If you have 51 running @ 12Mhz, it gives you 1us per instruction. Just make a program that will have 1000 instructions to make 1ms delay. Use DJNZ and JMP instructions...
For 8051's you should asume 12 clocks per instruction. So If you have 51 running @ 12Mhz, it gives you 1us per instruction. Just make a program that will have 1000 instructions to make 1ms delay. Use DJNZ and JMP instructions...
B bmcculla New Member Feb 13, 2005 #4 Just use a timer - this sort of stuff is why they're put into microcontrollers.
P Peter Nabil New Member Feb 14, 2005 #5 Hi Josephselim,Jay.slovak( nice photo by the way )and bmcculla thanks for your support but i managed to do a one second delay using NOP instructions thank u again bye
Hi Josephselim,Jay.slovak( nice photo by the way )and bmcculla thanks for your support but i managed to do a one second delay using NOP instructions thank u again bye
J Jay.slovak Active Member Feb 14, 2005 #6 BTW, How many NOPs did you use? Because 1s = 1000000 NOPs ! Or have you used a cycle....? Just curious.
BTW, How many NOPs did you use? Because 1s = 1000000 NOPs ! Or have you used a cycle....? Just curious.