ASM (NOP); specific delay

Source: Internet
Author: User

ASM ("NOP") is an inline assembler short instruction delay, in which the function of ASM () refers to the internal parameters of functions translated into assembly instructions, the role is in the C language environment directly using assembly instructions to execute. NOP is an empty waiting assembly instruction, this instruction executes, the monolithic computer is doing nothing, only has a time delay effect.
CC2530 belongs to 8051 series MCU, ASM ("NOP") executes an empty instruction (one cycle instruction), occupy time is a machine period, crystal oscillator is 32Mhz.
So the machine cycle =12*1/32=0.375us. That is, an ASM ("NOP") is delayed by 0.375us.

Popular Science clock cycle, machine cycle, instruction cycle, bus cycle
Clock Cycle
The clock cycle is also known as the oscillation cycle, defined as the countdown to the clock pulse (it can be understood that the clock cycle is the reciprocal of the external crystal oscillator, such as 12M Crystal oscillator, its time period is 1/12 us), is the most basic computer, the smallest unit of time.
Within a clock cycle, the CPU completes only one of the most basic actions. For a single chip, if the use of 1MHZ clock frequency, the clock cycle is 1us; if the 4MHZ clock frequency, the clock cycle is 250us. Because the clock pulse is the basic work pulse of the computer, it controls the working rhythm of the computer (so that every step of the computer is unified to its pace). Obviously, the higher the clock frequency for a computer of the same model, the faster the computer will work. The concrete calculation is 1/fosc. In other words, if the crystal oscillator is 1MHz, then the clock cycle for 1us;6mhz words, is 1/6us.
The 8051 SCM defines a clock cycle as a beat (expressed in P) and two beats defined as a state cycle (in s).
Machine Cycle
In a computer, for ease of management, the process of executing an instruction is divided into several stages, each of which completes a task. For example, fetching instructions, memory reading, memory writing, and so on, each of these tasks is called a basic operation. The time required to complete a basic operation is called the machine cycle. In general, a machine cycle consists of several S-cycles (state cycles).
A machine cycle of 8051 series MCU is composed of 6 s cycles (state cycle). As mentioned earlier, a clock cycle is defined as a beat (expressed in P), two beats are defined as a state cycle (in s), and the 8051 SCM Machine Cycle consists of 6 state cycles, i.e. one machine cycle = 6 state cycles = 12 clock cycles. The specific calculation is: Clock cycle X cycles. If the single-chip computer is 12 cycles, then the machine cycle is Tx12. Assuming the crystal frequency of 12M, single-chip computer for 12 weeks, then the machine cycle is 1us.
For example, an external 24M crystal oscillator, one of his machine cycle =12/24m seconds; 52 series SCM One machine cycle equals 12 clock cycles. Set the crystal frequency of 12MHz, 52 single-chip microcomputer is 12T MCU, that is, frequency to 12. 12M through the division into 1M, by the t=1/f, that is, a machine cycle into 1us.
instruction Cycle
The time required to execute an instruction is generally composed of several machine cycles. instruction is different, the required machine cycle is different. Typically, instructions that contain a machine cycle become single cycle instructions, such as Clr,mov and so on. An instruction that contains two machine cycles is called a dual-cycle instruction. There are also 4 cycle instructions, such as multiplication and division instructions. For some simple single byte instruction, in the fetch instruction period, the instruction is taken out to the instruction register, the decoding executes immediately, no longer need the other machine cycle. For some more complex instructions, such as transfer instructions, multiplication instructions, two or more machine cycles are required.
Bus Cycles
Because the memory and I/O ports are hooked up on the bus, CPU access to the memory and I/O interfaces is done via the bus. The time required for a CPU to access the external (memory or I/O interface) of the microprocessor via the bus is often called a bus cycle.
To sum up, the clock cycle is the smallest unit, the machine cycle requires 1 or more clock cycles, and the instruction cycle requires 1 or more machine cycles; the machine cycle is the time to complete a basic operation, which may sometimes include bus reads and writes, and thus contains bus cycles, but sometimes it may not be related to the bus read and write, so There is no clear and mutually inclusive relationship. Instruction cycle: is a key indicator of the CPU, the time to take out and execute an instruction. In general, the machine cycle is the unit, the single instruction execution cycle, the double instruction execution cycle and so on. Most of the current processor directives (ARM, DSP) take the single instruction execution cycle. Machine Cycle: A time unit that completes a basic operation, such as a reference period and a cycle of taking. Clock cycle: The reciprocal of the working frequency of the CPU's 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.