7-Segment LED display is the combination of 8 LEDs in a special digital display format. I have explained the 7-segement LED displays in earlier post and simple digit display on it. Now, i want to discuss the interfacing of different 7-segment displays with 8051 microcontroller. Interfacing: - As you can see above circuit diagram in which three 7-segments are connected to port P1, P2, P3 and the common cathode are connected to the port P0.1, P0.2 and P0.3. Now, we have to run a counter from 0-999. So, the basic concept is that you implement binary to hexadecimal conversion code in which MSB and LSB are extracted. Now, take MSB as hundredth digit and LSB as ones place digit. Code: #include"REGx52.h" #define seg_data P1 #define seg_data1 P2 #define seg_data2 P3 sbit seg1=P0^1; sbit seg2=P0^2; sbit seg3=P0^3; int num=0; int ones=0,tens=0,hundreds=0; void display_digit(int ); void delay(); void display_digit1(int ); void display_digit2(int ); void main() {...
A relay is an electrically operated switch or an electro-mechanical switch. Relays are used where it is necessary to control an electronic circuit by a low-power signal or where several circuits must be controlled by one signal. Principle: Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and most have double throw (changeover) switch contacts. Program: Theory: A relay is used for electronic to electrical interfacing i.e. it is used to switch on or off electrical circuits operating at high AC voltage using a low DC control voltage. A relay generally has two parts, a coil which operates at the rated DC voltage and a mechanically movable switch. The electronic and electrical circuits are electrically isolated but magnetically connected to each other. In this R1 and R2 are the connection of relay made with LPC2148 and signal a...