Using Microcontroller AT89S52 to blink LED and implemented on breadboard

For the project only thing we want to do is to make the LED blink, this is a very simple project let you easy into the world of micro-controller. We also work in C programming to control LED blinking to ON and OFF.
Trying to use the breadboard go to implemented the simple project.

Pin Configurations of AT89S52

Figure about Anode and Cathode pin of LED

Schematic


Implement on breadboard

Watch the completed video for the LED blink


#include <regx52.h>
#include <intrins.h>
#include <stdio.h>

void delay(unsigned int ms){
 while(ms--){
  _nop_();
 }
}

void main(){
    while(1){ 
    P1_0 = 1; // 1 = OFF
    // 11.059MHZ, 12/11.059 = 1.085us
    // delay 1ms, 1000us/1.085us = 921.65us = 922us
    // 1 second = 1000ms
    delay(922*1000);
    P1_0 = 0; // 0 = ON
    delay(922*1000);
    }
}

Comments

Popular Posts