FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    51 Details of Single Chip Microcomputer 1S Time Design Description

     

    #include SBIT P1_0 = P1 ^ 0; Void delay (); // Be sure to consistent with the case here, there will be warnings or errors void main () { While (1) // Started a loop { P1_0 = 0; DELAY (); // There is no parameter to add () otherwise Warning P1_0 = 1; DELAY (); } } Void delay () / / 12M crystal 1S delay { UNSIGNED CHAR H, I, J, K; For (h = 5; h "0; H -) For (i = 4; i "0; I -) For (j = 116; j "0; J -) For (k = 214; k "0; k -); // The last must be; } / / ===================== // Principle, using the H, I, J, and K cycle instructions to consume a certain time to reach the delay, why use the loop delay method, and the four variables of H, I, J, K, and in 1 second in 12M crystal. The value of each variable is in the above code? This is to start from the cycle of the microcontroller, the single chip has an instruction cycle, the machine cycle, the state period, the clock cycle; Clock cycle: Also on the oscillation cycle of the crystal oscillator as an example, the clock cycle is 1/12000000 = 1/12 elw; Machine cycle: 1 machine cycle = 6 status cycles = 12 clock cycles = 1us Instruction Period: The time required for the single chip performs a command is called an instruction cycle, and the instruction cycle is not necessarily the same as the machine cycle, and the machine cycle required for different instructions is not necessarily the same (1-4), and the single-chip performs a single-cycle instruction. It takes 1us to execute a two-cycle instruction requires 2us, and the for loop requires 8 instruction cycles; Specifically perform the time of the FOR cycle consumption, you can pass the code measurement in KEIL: #include SBIT P1_0 = P1 ^ 0; Void delay (); void main () { While (1) // Started a loop { P1_0 = 0; DELAY (); P1_0 = 1; DELAY (); } } Void delay () { UNSIGNED Char H; For (h = 1000; h "0; h -); // This is broken } Circular 1000 times of execution of time points 0.00042850S - 0.00019600S = 0.00023250S = 232.5Us; 1 cycle consumption is about 0.2us, 1S = 1000000US, 1000000US / 0.2US = 500000 times, while 5 * 4 * 116 * 214 = 496480; because unsigned characters Unsigned Char size is 1 byte, the range is 0 ~ 255, so it can only be completed, approximation Get a 1S delay. , Read full text, original title: 51 single-chip 1S delay program design Article Source: [Micro Signal: Changxuemcu, WeChat Public Number: Study Mechanical Machine] Welcome to add attention! Please indicate the source of the article.

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us