Preview

89s52 C Program

Good Essays
Open Document
Open Document
1000 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
89s52 C Program
Simple C program for 89S52
Here is a very simple but complete example program to blink a LED. Actually it is the source code of the example project that we are going to construct in the next part of the tutorial, but for now it is important to concentrate on the programming to summarize the notions discussed above.
-------------------------------------------------
#include <REGX52.h>
-------------------------------------------------
#include <math.h>
-------------------------------------------------

------------------------------------------------- delay(unsigned int y){
-------------------------------------------------
unsigned int i;
-------------------------------------------------
for(i=0;i<y;i++){;}
-------------------------------------------------
}
-------------------------------------------------

------------------------------------------------- main(){
-------------------------------------------------
while(1){
-------------------------------------------------
delay(30000);
-------------------------------------------------
P1_0 = 0;
-------------------------------------------------
delay(30000);
-------------------------------------------------
P1_0 = 1;
-------------------------------------------------
}
-------------------------------------------------
}
After including basic headers for the SFR definitions of the 8952 microcontroller (REGX52.h) and for mathematical functions (math.h), a function named ‘delay’ is created, which is simple a function to create a delay controlled via the parameter ‘y’. Then comes the main function, with an infinite loop (the condition for that loop to remain will always be

You May Also Find These Documents Helpful

  • Satisfactory Essays

    NT 1310 Unit 8 Lab 1

    • 595 Words
    • 2 Pages

    The most critical part, the Cable and Fiber Preparation where the fiber is mounted, is the ferrule. The Ferrule is a long, thin cylinder with the fiber mounted in the center hole. The center hole is sized to match fiber's cladding diameter which is usually 125um. When fiber connector ferrules are made from several types of materials including ceramic(Zirconia), stainless steel and plastic. The ferrule's job is to center and align the fiber and protects it from mechanical damage. The end of fiber is at the end of the ferrule, where the fiber end is polished smooth either flat or with a curvature. The ferrule is mounted in the connector body and then the connector body is attached to the fiber optic cable structure. Finally, a strain-relief rubber boot protects the connector-cable junction.…

    • 595 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    nt 1310 unit 9

    • 2641 Words
    • 8 Pages

    A laser transmitter projects a beam of laser light outward while raising and lowering the beam. The beam may define a conical surface of varying inclination. The transmitter includes a laser source that directs a beam generally vertically, and a beam diverting element. The beam diverting element is positioned in the path of the beam, intercepting the beam and redirecting it. The beam emerges from the transmitter as a non-vertical beam that is raised and lowered. The diverting element may include a pair of mirrors configured as pentagrams,…

    • 2641 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    Nt1310 Unit 9

    • 553 Words
    • 3 Pages

    Compared to a C-H bond, a C-D bond will vibrate where in the infrared spectrum?…

    • 553 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Unit 6 Programming

    • 420 Words
    • 5 Pages

    print (” These are not primary colors . I can ’ t mix them !”)…

    • 420 Words
    • 5 Pages
    Satisfactory Essays
  • Better Essays

    Bagranoff, N. A. (2008). Core concepts of accounting information system. John Wiley & Sons, Inc.…

    • 1050 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    dss 001

    • 395 Words
    • 2 Pages

    The Proposer must address ALL Mandatory Requirements section items and provide, in sequence, the information and documentation as required (referenced with the associated item references). The RFP Coordinator will review all general mandatory requirements, including but not limited to the following:…

    • 395 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The section tag represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a heading. Examples of sections would be chapters, the tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site's home page could be split into sections for an introduction, news items, contact information.…

    • 235 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    The digital divide is considered the gap between those who are technologically inclined and those who aren’t. The internet has many uses and can simplify the way many everyday tasks are carried out. There are different points-of-view of how this affects our society and how the divide is gauged as well as how to bridge the divide internationally.…

    • 1309 Words
    • 2 Pages
    Powerful Essays
  • Satisfactory Essays

    Chemalite Case Study

    • 395 Words
    • 2 Pages

    Problem Set #2: Chemalite Case 1. Record the effects of Chemalite’s 1991 events on the BSE worksheet Cash Flow type (O, I, F) Event Cash A/R 375,000 F P1 (7,500)…

    • 395 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Quadrature phase shift keying (QPSK) has twice the bandwidth efficiency of BPSK since two bits are transmitted in a single modulation symbol. In the phase of the carrier takes on one of four equally spaced values, such as 0, π/2,π and 3π/2, where each value of phase corresponds to a unique pair of message bits. The Quadrature phase shift keying (QPSK) signal for this set of symbol states may be defined as…

    • 1665 Words
    • 7 Pages
    Better Essays
  • Satisfactory Essays

    Pc Structure

    • 510 Words
    • 3 Pages

    | * 64 KB Main Memory * 1.3 microseconds clock cycle time * 246 Instructions…

    • 510 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    classic pic programmer

    • 1104 Words
    • 5 Pages

    This is my own version of the classic PIC 16C84/16F84 programmer. The design is originally by David Tait. I've made a few changes, redrawn the schematic and done a board layout. All the files you will need are linked below, including software you'll need to operate it. The software is not by me, I'm just including it for your convenience, and you should follow any usage requests the authors have made.…

    • 1104 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    astable

    • 6202 Words
    • 23 Pages

    References: 2. Input pulses advance counter in binary sequence up to count of a (count = 1001)…

    • 6202 Words
    • 23 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Lighting and Sign

    • 388 Words
    • 2 Pages

    Make a report to introduce the LED sign you make. The planning and report worksheet is attached, use it to finish you report.…

    • 388 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Assembly Format

    • 372 Words
    • 2 Pages

    Good Morning to one and all present here. I am Shivangi Goswami of Class 8 A standing before you to conduct today’s assembly. One man with courage is a majority. This famous quote was said by Thomas Jeffery, meaning one man who has courage can do anything and is capable enough to do any task at hand. So friends today the theme of our assembly is courage.…

    • 372 Words
    • 2 Pages
    Satisfactory Essays