A brief discussion on the instruction cycle of MSP430 single-chip microcomputer

Publisher:快乐的旅程Latest update time:2016-08-18 Source: eefocusKeywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The relationship between the MSP430 clock cycle (oscillation cycle), machine cycle, and instruction cycle

The clock cycle is also called the oscillation cycle: it is defined as the reciprocal of the clock pulse (the clock cycle is the reciprocal of the crystal oscillator directly used by the internal CPU , such as a 12M crystal oscillator, its clock cycle is 1/12us), and is the most basic and smallest time unit in the computer . In one clock cycle, the CPU only completes one most basic action. The clock pulse is the basic working pulse of the computer, which controls the working rhythm of the computer. The higher the clock frequency, the faster the working speed.

 

Machine cycle: In computers, the execution process of an instruction is often divided into several stages, and each stage completes a task. Each task is called a basic operation, and the time required to complete a basic operation is called a machine cycle. A machine cycle of the 8051 series microcontroller consists of 6 S cycles (state cycles). One S cycle = 2 clock cycles, so one machine cycle of the 8051 microcontroller = 6 state cycles = 12 clock cycles.

 

Instruction cycle: The time required to execute an instruction, which is basically composed of several machine cycles. Different instructions require different machine cycles.

 

Specialized knowledge:

 

In 430, one clock cycle = the inverse of the MCLK crystal oscillator. If MCLK is 8M, then one clock cycle is 1/8us;

 

One machine cycle = one clock cycle, that is, each action of 430 can complete a basic operation;

 

One instruction cycle = 1 to 6 machine cycles, depending on the specific instruction.

 

In addition: instruction length is just a storage unit and has no necessary relationship with time.

MSP430 can choose to use up to 3 oscillators depending on the model. We can choose the appropriate oscillation frequency according to the needs and turn off the oscillator at any time when not needed to save power. The three oscillators are:

(1) DCO digital controlled RC oscillator. It can be turned off when not in use inside the chip. The oscillation frequency of DCO will be affected by the ambient temperature and the operating voltage of the MSP430, and the frequency generated by the same model of chip is also different. However, the adjustment function of DCO can improve its performance. Its adjustment is divided into the following three steps: a: Select BCSCTL1.RSELx to determine the nominal frequency of the clock; b: Select DCOCTL.DCOx to make a rough adjustment in sections based on the nominal frequency; c: Select the value of DCOCTL.MODx for fine adjustment.

 

(2) LFXT1 is connected to a low-frequency oscillator. Typically, it is connected to a 32768HZ clock oscillator. In this case, the oscillator does not need to be connected to a load capacitor. It can also be connected to a 450KHZ~8MHZ standard crystal oscillator. In this case, a load capacitor is required.

(3) XT2 is connected to a standard crystal oscillator of 450KHZ~8MHZ. At this time, a load capacitor needs to be connected and can be turned off when not in use.

Low frequency oscillators are mainly used to reduce energy consumption, such as in battery-powered systems . High frequency oscillators are used to respond quickly to events or for the CPU to perform large amounts of calculations. Of course, the high-end 430 also has frequency-locked loop (FLL) and FLL+ modules, but you don't need to consider that much at the beginning.

MSP430 has three clock signals: MCLK system main clock; SMCLK system sub-clock; ACLK auxiliary clock.

(1) MCLK system main clock. In addition to the CPU operation, this clock can also be used by peripheral modules. MCLK can select the clock signal generated by any oscillator and divide it by 1, 2, 4, or 8 as its signal source. 

(2) SMCLK system sub-clock. For use by peripheral modules. It can be divided by the registers of each module before use. SMCLK can select the clock signal generated by any oscillator and divide it by 1, 2, 4, or 8 as its signal source.

(3) ACLK auxiliary clock. For use by peripheral modules. It can be divided by the registers of each module before use. However, ACLK can only be divided by 1, 2, 4, or 8 by LFXT1 as a signal source.

After PUC reset, the signal sources of MCLK and SMCLK are DCODCO, and the default oscillation frequency is 800KHZ. The signal source of ACLK is LFXT1.

The MSP430 contains a crystal oscillator failure monitoring circuit to monitor the clock signals output by LFXT1 (working in high-frequency mode) and XT2. When the clock signal is lost for 50us, the monitoring circuit captures the oscillator failure. If the MCLK signal comes from LFXT1 or XT2, the MSP430 automatically switches the MCLK signal to DCO to ensure that the program continues to run. However, the MSP430 does not monitor the LFXT1 working in low-frequency mode.

 

In order to achieve detailed clock, you can set the registers related to the clock. In the low-end 430, there are three registers: DCOCTL, BCSCTL1 and BCSCTL2. For the high-end 430, you need to consider several registers such as SCFI0, SCFQCTL, FLL_CTL0, FLL_CTL1 and BTCTL. For detailed settings, see DataSheet.

 

 

After the microcontroller is powered on, if the clock system is not set, the default 800 kHz DCOCLK is the clock source of MCLK and SMCLK, and LFXT1 is connected to a 32768 Hz crystal and works in low-frequency mode (XTS=0) as the clock source of ACLK. The instruction cycle of the CPU is determined by MCLK, so the default instruction cycle is 1/800 kHz="1". 25μs. To get an instruction cycle of 1μs, the DCO frequency needs to be adjusted, that is, MCLK=1 MHz, and only the following settings are required: BCSCTL1=XT20FF+RSEL2;

 

// Turn off XT2 oscillator and set DCO frequency to 1 MHz

 

DCOCTL=DCO2

Keywords:MSP430 Reference address:A brief discussion on the instruction cycle of MSP430 single-chip microcomputer

Previous article:Keystroke program without delay debounce
Next article:1602 LCD display program written by MSP430

Recommended ReadingLatest update time:2024-11-16 14:50

Single chip microcomputer controls MC55 module to realize remote wireless data transmission
GPRS (General Packet Radio Service) is the abbreviation of General Packet Radio Service, which is a data transmission technology based on the Global System for Mobile Phones (GSM). GPRS network not only has the advantages of wide coverage, fast data transmission speed, high communication quality, always online and flo
[Microcontroller]
Single chip microcomputer controls MC55 module to realize remote wireless data transmission
Realization of the communication test system between computer serial port and single chip microcomputer
1 Introduction After use and development, there are many serial communication interface standards, but they are all improved on the basis of RS-232C. The RS-232C standard is a communication protocol developed by the American EIA (Electronic Industry Association) and BELL Company and announced in 1969. Therefore, as a
[Microcontroller]
Realization of the communication test system between computer serial port and single chip microcomputer
The first routine for the PIC microcontroller
I spent a long time looking for software online today. I downloaded MPLAB from the official website, but it was troublesome to register with PICC. The software used today is Protues simulation.   The first program lights up a lamp. The circuit is very simple. The program is posted below.   #include pic.h //Include h
[Microcontroller]
Simplifying CAN in Automotive Applications with Highly Integrated 8-bit MCUs
ByEdwin Romero The Controller Area Network (CAN) protocol is a specification designed in the mid-1980s for the automotive industry to reduce the complexity (weight, quantity and cost) of wiring for data transmission in increasingly connected applications. CAN's advantages have also been accepted and absorbed by o
[Automotive Electronics]
Simplifying CAN in Automotive Applications with Highly Integrated 8-bit MCUs
DCU, MCU, MPU, SOC and automotive electronic architecture in autonomous driving
In recent years, the concept of SDV (Software Define Vehicles) has gradually been recognized by vehicle manufacturers. The root cause lies in the change of the problem of "how to differentiate cars". With the innovation of automotive electronic architecture brought about by electrification, the automotive hardw
[Automotive Electronics]
Temperature Detection and Display Design Based on AT89C52 Single Chip Microcomputer
Due to the continuous development of high-tech, the miniaturization and digitization of instruments have been realized. In the 1990s, high-precision, high-performance, and multi-functional instruments and meters have adopted microprocessor devices. As a development trend and significant sign of various new technolog
[Microcontroller]
Temperature Detection and Display Design Based on AT89C52 Single Chip Microcomputer
Design of infrared remote control system for lamp head based on single chip microcomputer
1 Principle of infrared remote control system The structure of infrared remote control circuit is generally divided into three types, namely: single-channel remote control switch circuit, single-channel step-by-step remote control circuit and multi-channel remote control circuit. This design adopts a single-cha
[Analog Electronics]
Design of infrared remote control system for lamp head based on single chip microcomputer
Design of automatic horn tone player based on AT89C51 microcontroller
1 Introduction The daily routine of institutions and colleges requires timing and beep prompts. The author uses AT89C51 microcontroller and LM386 audio power amplifier to form an automatic timing and beep player. It is low cost, effective and worthy of promotion. 2 Main features and pin functions of AT89C51 AT89
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号