Tuesday, 29 September 2015

ULN 2003 Relay Driver Circuit For 8051 Microcontroller


We can not Directly drive the Relay through Microcontroller. Because the Microcontroller Gives only Regulating Pulse ( Drive Pulse to ON/OFF ) (0 or 1). Which is not capable to drive the Relay coil directly. The Relay coil (12 volt) can energies at +12volt supply, at this time the coil take dc current approx 20-25 ma.
Thus the total Power required by Relay coil for energies is,

Power =  Volt * Current
           =   12 * 0.020
           =   0.240 mw

Microcontroller does not Provide sufficient Current for this Operation. It provide only a few micro-ampere or Milli-ampere current for such any application control like as LED, 16*2 LCD display, Transistor drive,etc.

Thus the Relay Operate with 240 milli-watt power. The Microcontroller give only a few micro-watt or milli-watt power which is only Describe as Signal.
ULN2003
Thus we require a second part which can deliver the power as per requirement of Relay coil, and operate by Microcontroller Signal pulse.

ULN2003 ic is introduce for this purpose. it is CMOS ic, which is specially design for relay drive with including free welling Diode and Buffer Circuit. The ic UlN2003 is capable for operate seven no of Relay with seperately operation.
It has also seven separate Input for drive the seven Relay separately.

Circuit Diagram: 

 
circuit diagram of UlN2003 Interfacing with 8051 Microcontroller
circuit diagram of UlN2003 Interfacing with 8051 Microcontroller



Friday, 25 September 2015

How to Use Port Pin of 8051 Microcontroller as Input or Output

The Port0, Port1, Port2, Port3 of 8051 Microcontroller is individually use as Input or Output as per Requirement of User Program. We can use this Port Pins either Input or Output.

Port Pins Use as Input Pin of 8051 Microcontroller: 

First all of this, We can decide which Pin is use for Input Pin. Suppose, the Pin P1.0 is use for Input Pin. So, In the Program We set First this Pin as High Logic by using following Instruction set....

org 0000h
 port_ini:
      setb p1.0               //   P1.0 is set high for Input   //  
.
.
.
Program
.
.
.
end


Note:-  Which Pin or Port is use for Input of 8051 Microcontroller is First set for 1 of it by Software (Program). So the Microcontroller is Understand that this Port or Pin used for Input and take Data by this Pin or Port. As same Which Pin or Port is use for Output of 8051 Microcontroller is First clear for 0 of it by Software or Program, So that the Microcontroller is Understand that this Pin or Port used for Output.


Circuit Diagram:

Input Method of 8051 Microcontroller
Input Method of 8051 Microcontroller

Here Pull up Register is Connected to the Pin P1.0 because it make a Strong Input Signal as the Form of Voltage and Current. here the Input is given to the NPN Transistor to drive the P1.0 Pin as High or Low.

When the Input Signal is High (1) , +VCC is Connected to the Base of Transistor. Thus the Transistor Conduct and the Pin P1.0 is becomes Low (0). We can also use PNP Transistor in the place of NPN Transistor per our Requirement of Input Logic. We can also use Optocoupler at the place of Transistor. It is Best Suitable where Isolation is Require between the Control Circuit and Driver Circuit.


Port Pin use as output Pin of 8051 Microcontroller:

All Processor and Controller is work only on Logic Levels. It can not Provide Sufficient Signal as the form of Voltage and Current. So, it can not drive Directly heavy Load. The 8051 Microcontroller Belong to them. So, the Driver Circuit or Topology is Require for Operation. We can use Transistor, Optocoupler, amplifier Circuit, IGBT, MOSFET as a Driver as per Load Requirement. 

Here Simple Driver Circuit by Only One Transistor is connected to the Microcontroller which is Capable to Drive Load like as Relay, Led, Buzzer.

Circuit Diagram:

Output Method of 8051 Microcontroller
Output Method of 8051 Microcontroller




 Now, First all of this We decide that which Pin is Used for Output pin of Microcontroller. Suppose P1.0 Pin of Microcontroller is use for Output Pin, Thus, clear this Pin by Software or Program by giving CLR P1.0 Instruction to the Microcontroller. So the Microcontroller set this Pin as Output Pin.

org 0000h
Port_ini:
        clr P1.0         //   Initialize P1.0 as Output Pin  //
.
.
.
Program
.
.
.
end  


Here, Pull up Register is Require to make a Logic Signal Strong as form of Voltage and Current by that the Sufficient Current and Voltage is Provide to Drive the Transistor. When P1.0 is set to High (1), the Transistor give the Base Voltage and it is conduct. Thus the Load connected to the transistor is active by passing Collector Current through the Load. When P1.0 is clear(0), the Transistor remains off and thus load also remains Off  because the absence of Collector Current. We can also use the PNP Transistor for opposite the above Work Logic as per User requirement.

Thursday, 24 September 2015

Interfacing 16*2 LCD With 8051 Microcontroller

What Is  16*2 LCD ?


The LCD ( liquid crystal display) is device to good communicate between user and machine. It display the Software status, Errors, Indicators, Data as per user program by which a good Control method and a good communication occurs between user and electronics system and make a more user Friendly and attractive.
16*2 LCD Display
16*2 LCD Display

Features:

Lcd displays are widely used because of its low current consumption as compared to seven segment displays. And another, it is more attractive to the seven segment display (SSD).

16*2 LCD is mostly used to interfacing of 8051 Microcontroller.


 How 16*2 LCD Interface With 8051 Microcontroller ?


Pin Description and  Details of 16*2 LCD
Pin Description and  Details of 16*2 LCD

 Applications:

  1. Digital Voltmeter / Ammeter.
  2. Digital Speedometer / odometer.
  3. Home Automation System.
  4. Display for Music Player.
  5. Status Indicator Display.
  6. Digital Clock. 

Command to Operate 16*2 LCD Display Module:

      
            Hex Code                            Work Function
               38h         -        Initialize 2 line display of 5*7 Matrix.
               01h         -        Clear Display
               02h         -        Cursor Return to Home        
               04h         -        Decrement Cursor ( in Left Side )
               05h         -        Shift Display Right
               06h         -        Increment Cursor ( in Right Side )
               07h         -        Shift Display Left Side
               08h         -        Display Off & Cursor Off
               0ah         -        Display Off & Cursor On
               0ch         -        Display On & Cursor Off
               0eh         -        Display On & Cursor On
               0fh          -        Display On & Cursor On and Blinking
               10h         -        Move Cursor One Position Left Side
               14h         -        Move to Cursor One Position Right Side
               18h         -        Shift Entire Display Left Side
               1ch         -        Shift Entire Display Right Side
               80h         -        Move Cursor to Beginning of 1st Line
               c0h                  Move Cursor to Beginning of 2nd Line


How 16*2 LCD Display Work? How We can Display Message on 16*2 LCD? How to Initialization of 16*2 LCD? LCD Initialization........

  1. Give the Supply and Wait for a Second to Stabilize the Display.
  2. Give the Instruction 38h for Initialize 2 Line display of 5*7 Matrix LCD.
  3. Wait for a few millisecond (approx 5ms) to Complete Operation and LCD take Action as per given Command.
  4. Give 0fh Command to Display ON & Cursor ON and Blinking.
  5. Wait for some time (approx 5 ms).
  6. Give command 01h to clear the Display of LCD.
  7. Wait for some time (approx 5ms).
  8. Give command 06h for making Increment Cursor mode of LCD. By this, cursor should increase after every Character is Written to display automatically.
  9. Wait for some time (approx 5 ms).   
  10. Give the command 80h for Cursor take position at 1st Line 1st Character.
This above 10 step is Require and Basic Common Instruction for 16*2 LCD Initialization. Thus it write to start up of every Program Related to the LCD Projects. Then the User can Program to display the Data or Information on LCD as per requirement of User. This is Explain with a Short Program example of to Display the "Welcome to Here" on the LCD Display.

Circuit Diagram: 

 
Circuit diagram of LCD interfacing with 8051 Microcontroller
Circuit diagram of LCD interfacing with 8051 Microcontroller

Assembly Language  Program to Display "Welcome to Here" in 16*2 LCD Display:

org 0000h

port_ini:
mov p1,#00h
setb p3.4
setb p3.5
setb p3.6
acall delay_1s

Lcd_ini:
mov a,#38h
acall command
mov a,#06h
acall command
mov a,#0ch
acall command
mov a,#01h
acall command
mov a,#80h
acall command
acall delay_1s
Display:
mov a,#'W'
acall write
mov a,#'e'
acall write
mov a,#'l'
acall write
mov a,#'c'
acall write
mov a,#'o'
acall write
mov a,#'m'
acall write
mov a,#'e'
acall write

mov a,#14h
acall command

mov a,#'t'
acall write
mov a,#'o'
acall write

mov a,#14h
acall command

mov a,#'H'
acall write
mov a,#'e'
acall write
mov a,#'r'
acall write
mov a,#'e'
acall write

here:
sjmp here

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

command:
mov p1,a
clr p3.4
clr p3.5
setb p3.6
acall delay
clr p3.6
acall delay
acall delay
ret

write:
lcall ready
mov p1,a
setb p3.4
clr p3.5
setb p3.6
acall delay
clr p3.6
acall delay
acall delay
ret

ready:
setb p1.7
clr p3.4
setb p3.5
wait:
clr p3.6
acall delay
setb p3.6
jb p1.7,wait
ret

delay:
mov r0,#1ch
rep:
djnz r0,rep
ret
delay_1s:
mov r3,#08h
df1s:
mov r2,#0ffh
d1s:
mov r1,#0ffh
de1s:
djnz r1,de1s
djnz r2,d1s
djnz r3,df1s
ret

end

Sunday, 13 September 2015

Programmer Circuit of P89V51RD2

Programmer Circuit of Phillips P89V51RD2 Microcontroller and other family ic of 8051 series Microcontroller by using ISP (In-Application Programmable) Programming Method.


Here in this circuit the TX and Rx data transmission pins p3.0 and p3.1 of  P89V51RD2 Microcontroller is used 
for programming by ISP method via serial RS232 communication.

Here noted that EA pin of P89V51RD2 Microcontroller must 

be connected to +VCC of power supply.

The circuit diagram:

Programmer Circuit of  P89V51RD2 Microcontroller
Programmer Circuit of  P89V51RD2 Microcontroller

Here max232 ic used for converts the voltage levels from RS232 to TTL  voltage levels and vice verse, because we know that the RS232 is not computable with the TTL logic levels. Hence the converter need for it.



What is RS232 Standard? 


In the early 1960s a standards committee today know as the electronic industries association (EIA) , developed a common interface standard for data communications equipment to ensure reliable communications and second to enable to interconnection of equipment produced by different manufacturers and fostering the benefits of mass production and competition. From this idea, the RS232 standard was born. It specified signal voltages, signal timing, signal function, a protocol for information exchange and mechanical connectors.


Step for Programming:


Here are the steps to program P89V51RD2 by ISP method using RS232


Click the below link for download flash magic software:


For windows xp / vista / 7 / 8

for mac OS x10.6+
http://www.flashmagictool.com/download.html&d=Flashmagic.app.dmg

Flash Magic For Programming P89V51RD2 Microcontroller
Flash Magic For Programming P89V51RD2 Microcontroller

Download and Open flash magic software
Connect programmer circuit to your computer via DB9 socket and power up your circuit.

step-1:


choose following data
device : P89v51rd2
com port  :  com1
Baud Rate : 9600
Interface : None(ISP)
Oscillator(MHZ) : 12.000
Step-1 For Programming Microcontroller
Step-1 For Programming Microcontroller


Step-2 :


Don not check the Erase all Flash code . it will erase all data 
include the Boot loader program 
 data in micro controller so, do not check it.
If you reprogramming the Micro controller you will check the Erase blocks used by hex file.
Step-2 For Programming Microcontroller
Step-2 For Programming Microcontroller


Step-3:

 

 Select the hex file, which you want to programing in to the

 Microcontroller.

Step-3 For Programming Microcontroller
Step-3 For Programming Microcontroller



Step-4 :

 
Check the verify after programing and other may use as per 
 
 user want. 
Step-4 For Programming Microcontroller
Step-4 For Programming Microcontroller



Step-5:


Click the start button for starting the programing of 

Microcontroller. 
Step-5 For Programming Microcontroller
Step-5 For Programming Microcontroller




Related Links:

Product Page: http://www.semiconductors.Philips.com/
 

Data Sheet: P89V51RB2_RC2_RD2-03.pdf
 

Boot Loader: p89v_lv51rd2_bl_upd_v5.zip
 

Flash Magic ISP Software: http://www.esacademy.com/

Search Keywords :


1. Programmer Circuit of P89v51rd2           Microcontroller

2. Programming Method of Microcontroller

3. Phillips P89v51rd2 Microcontroller

4. Development of Microcontroller

5. Basic of Microcontroller