Hi, Can anyone please give a C program for 8051 that can drive two DC motors with time delay?? That is two motors have to run for 5secs and stop for 5 secs. I have a program to interface the motors using l293d but cannot understand how to implement the timer for running and stopping.
</i PLEASE HELP>
People can give the code, Its simple just try yourself, people are there to help you.
Write a delay instead of timer(for your application),
Use simple instructions to build delay, how??
Ex: MOV R0,#01h - > 1 X 1.085uSec (1 Machine cycle)
MUL AB - > 4 X 1.085uSec (4 Machine cycle)
Since the above code will take 5.425uSec, Just calculate how many times do you need to execute the above code to get 5Sec delay
All the best
Ex: MOV R0,#01h - > 1 X 1.085uSec (1 Machine cycle) how do you know, there is no info re clock speed or processor for a 8051f120 it coud be 30ns
Most of the basic 8051 family controllers are based on 11.0592MHz clock, so i calculated machine cycles according to that frequency and given the example.
...are based on... are based on the crystal oscillator used. Important note: CPU clock frequency = crystal oscillator frequency/12 and CPU clock time period = 1/CPU clock frequency
Also, i would prefer using a timer to generate a delay as compared to generating a delay by using a software code.
@Rajat Saha refer to any text book. Mazidi is good for starters.
CPU clock frequency = crystal oscillator frequency/12 here you go again,
for the old steam driven '51 that is true, but for most modern derivatives it is BLATANTLY FALSE