Single chip microcomputer how to calculate the delay time of different crystal oscillator?

Source: Internet
Author: User

SCM C language, how to calculate the delay time of the delayed function by the number of cycles?

First you need to know that an instruction period is a few seconds algorithm is 1/(Crystal frequency divided by 12) then you need to know how the loop actually executes a few instruction cycles

You can use the Keil inline disassembly command to see if your loop is compiled into a machine language after a few instruction cycles so that you know the delay time, of course, you can take the approximate value, such as for (i=0,i<255,i++) {x=2} here x=2 is an instruction cycle and executed 255 times If your crystal is 12MHZ, then you execute an instruction period of 1us 255 times is 0.255ms

22.1184 one instruction 0.5us 1/(23/12)

Single chip microcomputer how to calculate the delay time of different crystal oscillator?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.