 Welcome, Myself Giridhar Jain, Assistant Professor in Electronics and Telecommunication Engineering, Valchin Institute of Technology, Sholapur. Now today I am going to explain you interfacing with microcontroller89C51. Now learning outcomes of this session are, at the end of this session, students will be able to draw circuit for minimum system using microcontroller89C51. Second is, students will be able to draw interfacing circuits for 89C51 with switches, LEDs, matrix keyboard, relay, buzzer and 7-segment display. Contents of this session are, what is microcontroller89C51, minimum system for using 89C51, interfacing circuits for interfacing of switches, LEDs, matrix keyboard, buzzer, relay and 7-segment display. So, first let us discuss and understand what is a microcontroller89C51. So, microcontroller89C51 is a 8-bit microcontroller and it has, it is available in 14-pin DIP and other packages. So, we will discuss 14-pin DIP package. Now memory available with this 89C51 is RAM for temporary storage of variable during programming 128 bytes and the flash APROM 4 kilobytes for storing the program code. Then IO pins, input output pins which are available with this microcontroller are 32 and they are configured in 4 ports, port 0, port 1, port 2 and port 3 and each port is having the 8 lines. Along with these port lines, they are assigned alternate functions which are given in detail in pin diagram. Timer and counters available with this IC are 2 in number and 16-bit. So, 16-bit to counters oblique timers, interrupts. There are 2 external interrupts, INT0 and INT1 and there are 3 internal interrupts. Oscillator, there is a built-in oscillator, you have to connect external clock, external crystal and the capacitors. So, this figure shows the pin diagram of 89C51. So, if you look at the pin diagram, this is a 40-pin DIP. So, pin number 1 to pin number 8, that is for port 1, bit 0 to 7, pin number 9 is reset. Then starting from pin number 10 to 17, that is port number 3, then crystal wall, crystal 2 and crystal 1 and pin number 20 is ground. On this line, these 8 lines are for port 2 and this is VCC and these 8 lines are port 0 and here is PSEN, external access bar and programming. So, this is pin details of 89C51 in 40-pin DIP. So, what is a minimum system for using 89C51? Means for example, we want to design some application using 89C51, what is the minimum requirement? So, minimum requirement first is power supply. So, use power supply 5 volt, then second is the power on reset. So, pause this video and think on this question, what is power on reset? So, minimum requirement is VCC, pin number 40 is connected to plus 5 volt, 20 is connected to the ground, then this is a pin number 9 is a reset. So, pin number 9, which is a reset of this microcontroller is active high. Means whenever there is a logic 1, microcontroller will reset. Power on reset means whenever power supply is given to the microcontroller, microcontroller should reset automatically and for that a power on circuit is to be designed. So, this is a power on circuit which consists of one capacitor of 10 microfarad and resistance of 10 K connected as shown in the circuit. So, initially when supply is made on voltage across capacitor CH0, therefore voltage at pin number 9 is 5 volt that is logic 1, therefore microcontroller is reset. Then capacitor C charges through resistance R, when capacitor C is fully charged to 5 volt, then voltage at pin number 9 that is reset becomes 0 and the microcontroller comes into a run mode. Now, next facility required is oscillator. So, for oscillator there is a built-in oscillator for this microcontroller between XTAL 1 and XTAL 2 you have to connect a crystal. Here we have connected crystal of 12 megahertz and two capacitors are connected as shown in figure of 33 picofarad. So, this is a circuit for designing a minimum system for any application this is a essential and along with this EA bar if we are not using connected to 5 volt and PSEN also connected to the 5 volt. Now, interfacing of switches, so this is a minimum system as we have discussed just now and these are the switches S1, S2 and S3 are the push to on switches, they are connected to the port 1, P1.0, P1.1 and P1.2 as shown in figure. So, whenever switch S1 is pressed now by default when microcontroller is reset output at all the lines is logic 1. Now, when this push button is pressed then this port line is getting connected to the ground therefore, P1.0 is connected to the ground. So, in the program we read P1.0 and if we read 1 that means the switch S1 is open and if we read logic 0 that means switch S1 is pressed interfacing of matrix keyboard. So, this figure shows the interfacing of matrix keyboard. So, there are 12 switches configured in 4 rows and 3 columns as shown in figure. So, here to read or to check any switch press in this row what you have to do you have to output logic 0 at this port line means this row is activated and then read this columns. So, which column reads 0 that switch is pressed means for example, if this column reads 0 then this switch is pressed. Now, same procedure can be repeated for the remaining columns. So, particular column can be activated by outputting 0 at that column interfacing of LEDs. Now, already I have mentioned that by default when microcontroller is reset all IOL lines goes output at all IOL line is logic 1 therefore, see here when microcontroller is reset no LED will glow now to glow or to make a particular LED on output logic 0 at that port line. So, if I output 0 at this port line then this LED will glow. So, this is current limiting resistor and this is a LED. So, this is the way of interfacing LEDs means to turn on the LED output logic 0 at the respective port line. Now, next is interfacing of relay and buzzer now buzzer is buzzer will give you the audio indication which is required in many applications. So, how this buzzer is interfaced now for interfacing buzzer our requirement is when 0 is outputted at that port line then buzzer should read. So, here a PNP transistor is used and these are the two resistances. So, whenever there is a logic 0 output this transistor becomes on and the buzzer gets connected to the 5 volt and buzzer will read. Now, next interfacing is relay. So, electro mechanical relay can be used for making the load on and off and the interfacing circuit is same as that of buzzer only instead of relay a buzzer is used and this is protection diode and this is a LED indication. Now, last is interfacing of 7 segment display now here 4 7 segment displays are connected in multiplex mode common anode type displays are used these are these transistors are used to drive this segment drive the 7 segment. So, if I output 0 here so, this is connected to P 0.4 so, output 0 so, that this transistor will become on and this display is selected and the 7 segments of all the displays are connected together and they are driven by 7447 BCD to 7 segment decoder. Now, input BCD is taken from output of microcontroller. So, see here P 0.0, 1, 2 and 3 so, these 4 lines are used to output BCD and whatever display is selected by outputting 0 at this port line P 0.4 to 7 a particular display will be activated and whatever BCD is outputted here so, that will be displayed. So, this is interfacing of 7 segment display in a multiplex mode so, with this we can design the many applications because in many applications we require interfacing of switches, LEDs, keyboard, buzzer and 7 segment displays. Now, differences are 80 the 8051 microcontroller architecture programming applications by ILA and secondly data sheets of 8951. Thank you for watching this video.