Micro bit Basic Programming Guide Input Function Group Special Analysis 1

Mondo Technology Updated on 2024-01-30

Creative Inspiration Center Basic Programming Guide Input Function Group (Special Analysis) 1

Analysis of relevant problems in programming

OneExplanation of digital and analog quantities and the conversion relationship between them

What is a digital quantity?

A digital quantity is a type of physical quantity. Their changes are discontinuous in time and always occur in a series of discrete moments. This class of physical quantities is called digital quantities. That is, a discrete quantity, which refers to a quantity that is dispersed and has no intermediate value.

A digital quantity is a type of physical quantity.

The change of a class of physical quantities is discrete in time and quantity. Their changes are discontinuous in time and always occur in a series of discrete moments. At the same time, their numerical magnitude and each increase or decrease are integer multiples of a certain minimum quantity unit, and the value less than this minimum quantity unit has no physical significance. This class of physical quantities is called digital quantities.

A numerical quantity, also known as a discrete quantity, refers to a quantity that is dispersed and has no intermediate value. For example, the value that a switch can take is discrete, and can only be on or off, and there is no in-between. However, the value of the volume knob is continuous, and there are an infinite number of values between the maximum and the smallest. For example, 12% volume, 13% volume, or 125% volume.

Digital quantities (discrete quantities) correspond to analog quantities (continuous quantities). The latter are commonly found in the natural world and can be analysed using general mathematical methods. Whereas, digital quantities are used in the information processed by computers. Because the basic working state of the computer is only 0 and 1, and the sampling of external information by the digital computer system cannot be strictly continuous, it must only be completed once in a cycle, so the digital computer system processes all digital quantities. Moreover, numerical quantities cannot be analyzed entirely by ordinary mathematical methods, and there are special mathematical definitions and methods for their analysis.

What is an analogue quantity?

An analog quantity is a quantity in which a variable changes continuously over a certain range;That is, any value (within the value range) can be taken within a certain range (defined domain). A digital quantity is a discrete quantity, not a continuous change quantity, and can only take a few discrete values, such as a binary numeric variable can only take two values.

General analogues.

General analog refers to analog information such as water level, liquid level, pressure, temperature, and flow, which needs to be converted between analog and digital through data acquisition and analog-to-digital converter, and then the collected data is handed over to the CPU for calculation and processing.

Analog electronics is the study of continuously changing electronic signal information, called analogue. Digital electronics is the study of discrete electronic signals of information called digital quantities.

Digital definition.

Physical quantities that are discrete in time and quantity are called digital quantities. A signal that represents a digital quantity is called a digital signal. The electronic circuit that works under the digital signal is called the digital circuit.

For example, when the number of parts output from an automatic production line is recorded with an electronic circuit, a signal is given to the electronic circuit for each part sent to make it record 1, and the signal added to the electronic circuit when there is no part sent out is 0, which is used as a count. It can be seen that the signal of the number of parts is discontinuous in time and quantity, so it is a digital signal. The smallest unit of quantity is 1.

Analog definition.

Physical quantities that are continuous in time and numerically are called analog quantities. The signal that represents the analog quantity is called the analog signal. The electronic circuit that operates under the analog signal is called the analog circuit.

For example, the voltage signal output by the thermocouple during operation is an analog signal, because the measured temperature cannot jump suddenly under any circumstances, so the measured voltage signal is continuous both in time and quantity. Moreover, any value of this voltage signal in the continuous change process is a specific physical meaning, that is, it represents a corresponding temperature value.

Conversion principle. 1.A digital-to-analog converter is a system that converts a digital signal into an analog signal, which can be achieved by low-pass filtering. The digital signal is decoded first, that is, the digital code is converted into the corresponding level to form a stepped signal, and then low-pass filtering is carried out.

According to the theory of signal and system, the digital stepped signal can be regarded as the convolution of the ideal impulse sampling signal and the rectangular pulse signal, then according to the convolution theorem, the spectrum of the digital signal is the product of the spectrum of the impulse sampling signal and the rectangular pulse spectrum (i.e., the SA function). In this way, the reciprocal of the SA function is used as the spectrum characteristic to compensate, and the digital signal can be restored to the sampled signal. According to the sampling theorem, the spectrum manager of the sampled signal wants to obtain the spectrum of the original analog signal by low-pass filtering.

In general, these principles are not directly implemented, because sharp sampled signals are difficult to obtain, so these two filters (SA function and ideal low-pass) can be combined (cascaded), and because the filtering characteristics of these systems are physically unrealizable, they can only be approximate in real systems.

2.An analog-to-digital converter is a system that converts an analog signal into a digital signal, which is a process of filtering, sampling hold, and encoding. The analog signal is filtered by band limiting, and the sample-and-hold circuit becomes a stepped signal, and then the encoder makes each level in the stepped signal become a binary code.

In our Xi content, analog and digital quantities can also be converted into each other, and the specific method is to first determine the range of continuous change of analog quantity, and find the two endpoints of this change quantity;A certain number of variations are split between the two endpoints, and each variation is the corresponding digital value. That is, it can be expressed as a numerical value.

In addition, a certain number of data values can also be set in size, how much. Depending on the number of quantities, the accuracy of the conversion of analog quantities into digital quantities is also determined. It can be understood that a 10 cm ruler has an accuracy of 1 cm if a scale is engraved on the ruler every other centimeter, and if a scale is engraved on the ruler every 1 mm, the accuracy of the ruler is 1 mm, and the number of scales engraved by a ruler with a 1 cm accuracy is 10, and the number of scales engraved by a 1 mm ruler is 100.

It can be seen that the larger the number of scales, the smaller the scale interval of the ruler, that is, the higher the accuracy of the ruler scale. The greater the number of scales. Based on this understanding, the relationship between analog and digital quantities is also the same, in a continuous analog quantity, the more digital quantities are separated, the higher the accuracy of the digital representation, and the closer it is to the meaning expressed by the analog quantity itself.

As with the description of a circle in mathematics, a circle is a figure composed of n polygons, and the more the number of n, the closer it is to the shape of the circle itself, which is a process of infinite proximity.

Related Pages