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

    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

    intel SWOT 1990

    • 1591 Words
    • 7 Pages

    Carter is one of the main strength of the company. He was very reactive and could propose new strategy just few days after losing the sue against AMD…

    • 1591 Words
    • 7 Pages
    Better Essays
  • Good Essays

    Binary Code

    • 627 Words
    • 3 Pages

    The first known occurrence of the binary numeral system is around the 8th century BC. It was created by the ancient Indian writer Pingala. He came across this as a method to describe prosody. This type of numeration system is a descendant of the Old Kingdom’s Eye of the Horus. A full set of eight trigrams and sixty four hexagrams, which are analog to the three bit and six bit binary numerals, are known to the ancient Chinese as I Ching. The Chinese scholar Shao Yong developed values for binary numbers 0-63 in the I Ching hexagrams arrangement. In 1605 Francis Bacon introduced a system by which letters of the alphabet could be reduced to sequences of binary digits.…

    • 627 Words
    • 3 Pages
    Good 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
  • 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

    Pc Structure

    • 510 Words
    • 3 Pages

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

    • 510 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    9 Windows System Operator

    • 395 Words
    • 2 Pages

    quite bulky. Also, they are not made by recycling materials so they are not very…

    • 395 Words
    • 2 Pages
    Satisfactory 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