we provide information about gadget news and price information and specs samsung, huawei, Tecno Price products, Specifications, Features and more information about software from blackberry and android

Monday, December 3, 2012

LED blinking with 8051

LED blinking with 8051 - Did you know that every day there is always a new technology that is created? if you want to know please refer to the blog Gadget News well now we will discuss first about LED blinking with 8051 as you need now, we have compiled this article carefully, so please see to finish.

Articles : LED blinking with 8051
full Link : LED blinking with 8051
Article Embedded Zone,

You can also see our article on:


LED blinking with 8051


LED blinking with 8051 (P89V51RD2) (using keil and BASCOM)

Hey embedded lovers from today I started to post series of 8051 tutorials and first post is use port as output using led interfacing with keil, BASCOM,Proteus.

This post is introduces you the very basic phenomena of taking an output from the microcontroller 8051,

Hearer we are use P89V51RD2 which is made by Philips using 8051 core which belongs to the family of 8051 series of microcontrollers, is very commonly used by a large community of hobbyist and engineers. Its simplicity and ease of programming with inbuilt features easily makes its position in the top preferred list of microcontroller for both beginners and advanced user.

LEDs are by far the most widely used means of taking output. They find huge Application as indicators during experimentations to check the validity of results at different stages. They are very cheap and easily available in a variety of shape, size and colours.

The principle of operation of LEDs is simple. The commonly available LEDs have a drop voltage of 1.7 V and need 10 mA to glow at full intensity.
The value of resistance R can be calculated using the equation
 
Since most of the controllers work on 5V,
 
470 ohm is commonly used substitute in case 330 ohm, because 330 ohm is not available.

P89V51RD2 is a 40 pin microcontroller which belongs to 8051 series of microcontroller. It has four ports each of 8 bits P0, P1, P2 and P3.The P89V51RD2 has 64K+8K FLASH bytes of programmable flash. The port P0 covers the pin 39 to pin 32, the port P1 covers the pin 1 to pin 8, the port P2 covers the pin 21 to pin 28 and the port P3 covers the pin 10 to pin 17. Pin 9 is the reset pin. The reset is active high. Whenever the controller is given supply, the reset pin must be given a high signal to reset the controller and bring the program counter to the starting address 0x0000. The controller can be reset by manually connecting a switch or by connecting a combination of resistor and capacitor as shown in the circuit diagram. A 11.0592 MHz crystal is connected between pin 18 pin 19. Pin 40 is Vcc and pin 20 is ground. Pin 40 is connected to Vcc.

LEDs are connected to the port P0. LEDs need approximately 10mA current to flow through them in order to glow at maximum intensity. However the output of the controller is not sufficient enough to drive the LEDs, so if the positive leg of the LED is connected to the pin and the negative to ground as shown in the figure, the LED will not glow at full illumination.
To overcome this problem LEDs are connected in the reverse order and they run on negative logic i.e., whenever 1 is given on any pin of the port, the LED will switch off and when logic 0 is provided the LED will glow at full intensity.
As soon as we provide supply to the controller, the LEDs start blinking i.e., they become on for a certain time duration and then become off for the same time duration. This delay is provided by calling the delay function.



ü Circuit diagram:

ü  Code with Keil:
/*
            * Description               :           Source file to use chack pin as output.                                                                                                                      
            * File Name                            :           main.c
            * header files Name   :           Philips/REG51F.H , delay.h
            * compiler                               :           keil uVision4
            * Author                                  :           Biren Ramoliya ( "http://profsmythe.blogspot.com" ),( "Computer Zone" )
            * Last Update              :           11.09.2012, 08:00 AM
*/

/* system file include */
#include <Philips/REG51F.H>
#include "delay.h"

/* define pin and port */
#define led P0                                     //port P0 as output

/* main */
void main()
{
            led = 0x00;                              //led off
            while(1)
            {
                        led = ~led;                   //toggle led
                        sdelay(1);                    //wait 1s
            }
}


ü  Code with BASCOM:

'-------------------------------------------------------------------------------
 '* Description         :  Source file to use chack pin as output.
 '* File Name           :  main.bas
 '* compiler            :  BASCOM 8051
 '* Author              :  Biren Ramoliya ( "http://profsmythe.blogspot.com" ),( "Computer Zone" )
 '* Last Update         :  11.09.2012, 08:00 AM
'-------------------------------------------------------------------------------

'==================== syastem configrasen ======================================

'To use crystalfrequency 11.0592mhz = 11059200hz
$crystal = 11059200

'==================== define Pin and Port ======================================
Led1 Alias P0

'==================== main fxn =================================================

Do

   Led1 = 255                                                 'all led off
   Wait 1                                                     'delay of 1 second

   Led1 = 0                                                   'all led on
   Wait 1                                                     'delay of 1 second

Loop                                                          'contenuas loop

End

'==================== end main fxn =============================================



ü  Video