The circuit what you need is very commonly.You can get it on net easily by google.Had you google it?You should choose the type of relay by the voltage and the current rate of you project.
No. The way you've drawn it, the 12V will be shorted to ground when the motor is off. p9 of the ULN2003 needs to be connected to 12Vdc; put a dot, at the wire junction, on the diagram to show this. p8 of the ULN2003 needs to go to ground. You may, or may not, need a pullup resistor to Vdd on p0.0 depending of the variant of the 8051 that you have.
The 8051 has internal pullup resistors that limit the output current to something like a couple hundred microamps depending on the exact chip, when it's output high drops to 2.4V.
Your chip may not even satisfy the input current and voltage requirements of the ULN2003.
The 8051 can sink few milliamps though so a circuit like this is usually used.
No. The way you've drawn it, the 12V will be shorted to ground when the motor is off. p9 of the ULN2003 needs to be connected to 12Vdc; put a dot, at the wire junction, on the diagram to show this. p8 of the ULN2003 needs to go to ground. You may, or may not, need a pullup resistor to Vdd on p0.0 depending of the variant of the 8051 that you have.
The 8051 has internal pullup resistors that limit the output current to something like a couple hundred microamps depending on the exact chip, when it's output high drops to 2.4V.
Your chip may not even satisfy the input current and voltage requirements of the ULN2003.
The 8051 can sink few milliamps though so a circuit like this is usually used.
If you are going to go with the ULN2003, as was mentioned, you need to add a resistor from P0.0 to VCC of the MCU. A 10K value is appropriate. The P0.0 output is open-drain unless the MCU is in external bus mode.
In external bus mode, I don't believe you can hold the output state unless you continually pump the same address/data out over and over again, and without missing a clock cycle.
If you use a port 1-2 output you should still put a 10K pull-up resistor in, because the internal pull-up capability is only marginally strong enough to drive the ULN2003 high.