Basic Knowledge Q&A on Microcontroller Programming

Wu Jianying Microcontroller Development Board Address

Store:Wu Jianying’s Shop

Address:https://item.taobao.com/item.htm?_u=ukgdp5a7629&id=524088004171

Basic Knowledge Q&A on Microcontroller Programming

1. How Long Can 8-bit Machines Last!

Answer: Currently, the main MCU products are still in the 8-bit field, mainly applied in six major markets: automotive applications, consumer electronics, computers and PC peripherals, telecommunications, office automation, and industrial control. Among these, the automotive market is primarily in Europe and America, while the Asia-Pacific region focuses on consumer electronics, with large quantities and low unit prices as the product mainstream. Currently, there is still a significant price difference between 16-bit MCUs and 8-bit products, and new application fields are still being developed. The industry estimates that at least until 2005, 8-bit MCUs will still be the mainstream of MCU products.

2. Is learning ARM and embedded systems more promising than learning other general microcontrollers? What knowledge should a beginner have?

Answer: Generally, there is a hierarchical difference between 8-bit microcontrollers and ARM-based embedded systems. ARM is suitable for more complex high-end products, such as PDAs and mobile phones. In contrast, 8-bit microcontrollers, due to their simple architecture and relatively fewer hardware resources, are suitable for general industrial control and consumer appliances. For a beginner in microcontroller programming, starting with HOLTEK series or 8051 8-bit microcontrollers for practice is advisable. Additionally, beginners should possess knowledge related to software programming, as microcontroller programming is generally based on assembly language, with different syntax for various manufacturers, but mostly based on RISC architecture, where RISC (Reduced Instruction Set Computer) represents all MCU instructions. These are composed of simple instructions, allowing the MCU’s circuits to be optimized as much as possible, thereby improving execution speed. Furthermore, beginners should have knowledge of microcontroller I/O interface applications, which involves the use of peripheral application circuits and various components, in conjunction with their studies in electronics and circuit theory.

3. Which MCUs conform to the 44PIN 80 series 8-bit microcontrollers?

Answer: The 44PIN 80 series 8-bit microcontrollers include Z8674312FSC, Z86E2112FSC, Z86E2116FSC.

4. Please introduce the testing methods for MCUs.

Answer: MCUs undergo different testing methods at each stage from production to packaging and shipment, mainly including two types: mid-test and final test.

Mid-test refers to the WAFER test, which includes product functionality verification and AC/DC testing. There are numerous projects, with several key items for HOLTEK products as follows:

Continuity Testing: Checks whether each I/O pin’s protective diode functions correctly.

Function Testing: Tests the product using the test data (TEST PATTERN) provided by the product designer, checking whether the results match the state during simulation.

STANDBY Current Testing: Measures the leakage current of each pad during HALT mode when each pin remains unchanged at logic high, low, or high impedance.

Power Consumption Testing: Measures both static and dynamic power consumption of the entire IC.

Input Voltage Testing: Measures the input voltage response characteristics at each input pin.

Output Voltage Testing: Measures the output voltage levels at each output pin.

AC frequency characteristics testing, also involves external injection of a certain frequency to check if the output matches.

To ensure long-term and stable quality for IC production, reliability testing is also performed, including ESD testing, LATCH UP testing, temperature cycling testing, high-temperature storage testing, humidity storage testing, etc.

The final test is the testing of packaged products, known as PACKAGE testing. This involves testing all products that passed the mid-test after packaging, primarily using automated testing equipment, but the test items remain the same as WAFER TEST. The purpose of PACKAGE TEST is to determine whether any damage occurred during the packaging process.

5. Can a microcontroller be used to detect the charging and discharging time of a mobile phone battery and the voltage and current changes during charging and discharging, and use an I/O port to display the results on a computer?

Answer: Most smart chargers on the market use MCUs to control charging current and voltage. As for displaying on a computer, it seems impractical; it may only be applicable in specialized battery testing instruments. For general mobile phone users, who would need to use a computer for display while charging? To connect a microcontroller to a computer, the simplest way is to use serial communication, but an RS-232 chip is required.

6. How should one approach ARM programming?

Answer: Taking the embedded system concept as an example, embedded processors can generally be divided into three categories: embedded microprocessors, embedded microcontrollers, and embedded DSP (Digital Signal Processor).

Embedded microprocessors correspond to the CPUs of general-purpose computers. In applications, microprocessors are generally mounted on specially designed circuit boards, retaining only the functions related to embedded systems on the motherboard, thus meeting the requirements for small size and low power consumption. Current embedded processors mainly include: PowerPC, Motorola 68000, ARM series, etc.

Embedded microcontrollers, also known as microcontrollers, integrate the CPU, memory (a small amount of RAM, ROM, or both), and other I/O interfaces into a single integrated circuit. Common examples include HOLTEK MCU series, Microchip MCU series, and 8051, among others.

Embedded DSPs are specifically designed for rapid processing calculations of discrete-time signals, improving compilation efficiency and execution speed. DSPs are increasingly entering the embedded market in fields such as digital filtering, FFT (Fast Fourier Transform), spectral analysis, and image processing.

7. In RF control with MCUs, the clock (crystal oscillator) and data lines may radiate base frequencies or their harmonics, which are amplified by low-noise amplifiers (LNA) before entering mixing, resulting in in-band spurs that cannot be filtered out. Besides layout and selecting low-radiation MCUs, what other methods can reduce this?

Answer: There are many considerations when designing high-frequency circuits, especially for GHz-level high-frequency circuits, where the length of electronic component pads and printed patterns significantly affects circuit characteristics. In recent years, there has been a trend of high-frequency circuits sharing the same circuit board with digital circuits, forming a so-called mixed circuit system. Such designs often lead to instability in high-frequency circuit operation when digital circuits are active, primarily due to noise generated by digital circuits affecting normal operation of high-frequency circuits. To avoid the above issues, aside from attempting to separate the two circuit blocks, thoroughly reviewing the design concept before designing the circuit board is essential. Fundamentally, when designing high-frequency circuit boards, the following three principles must be adhered to:

High quality.

No shortcuts.

No rushing.

Here are some suggestions for designing high-frequency circuit boards:

(1) The length of printed patterns affects circuit characteristics. Especially for transmission lines in GHz-speed digital circuits, strip lines are typically used, and adjusting the wiring length compensates for transmission delay, indicating that the placement of electronic components has a significant impact on circuit characteristics.

(2) Ground should be large. A copper foil surface should have a ground layer, and a better ground connected via is a common feature of high-frequency circuit boards and high-speed digital circuit boards. Additionally, high-frequency circuit boards should avoid using narrow printed patterns for ground connections.

(2) The ground terminals of electronic components should connect to the circuit board ground with the shortest length. Specifically, vias should be placed near the ground terminals of electronic components to allow the shortest connection to the circuit board ground.

(3) Signal lines should be designed with short wiring. Avoid arbitrarily increasing wiring length; minimize wiring length.

(4) Reduce coupling between circuits. Especially important is circuit separation between filters and amplifiers; this is equivalent to counteracting cross talk in audio circuits.

(5) MCU circuit layout considerations: The oscillation circuit should be as close as possible to the IC oscillation pins; maintain sufficient distance between the oscillation circuit and VDD & VSS; when the oscillation frequency exceeds 1 MHz, capacitors osc1 & osc2 are unnecessary; the power supply and ground connections should be as short as possible, and lines should be as wide and evenly spaced as possible, with 104/103/102 ceramic capacitors added at node locations.

8. What precautions should be taken when using the Intel series 96 microcontroller 80c196KB development system?

Answer: The software of a real-time system consists of a real-time operating system and application programs. The interface between the application program and the operating system is implemented through system calls. For MCU systems using the 80C196KB operating system, only internal RAM can be used as TCB and all system memory (including various control tables) and each task’s working and data units. Therefore, the following points must be noted:

(1) Allocate individual stack areas for each task, which serve as both the working unit and the protection unit for the task control block.

(2) The system’s task control block only stores the stack pointers for each task, while the status of the tasks is stored in the task stacks. When a task exits, its status is pushed onto the stack via an interrupt, and its stack pointer is saved in the system’s TCB; then, the stack pointer of the highest priority ready task is retrieved and loaded into SP; finally, an interrupt return instruction is executed to switch to the new task.

(3) Try to implement the data and working units of each task using stacks, allowing tasks to use the same subroutine. Parameter passing can be implemented using stacks instead of absolute address RAM, enabling reentrant subroutines that can be called by multiple tasks and allow recursive calls.

9. When sampling voltage on the demo board, if it is unstable and the results fluctuate, how can this be eliminated?

Answer: Generally, simulators operate in a stable environment (usually 5V). When using the simulator’s A/D, pay attention to whether its A/D reference voltage is provided internally or needs to be supplied externally. A/D conversion requires a continuous clock cycle, so during simulation, do not use single-step debugging, as this may cause inaccurate A/D sampling values. To stabilize A/D sampling, a capacitor can be added at the A/D input for filtering; median filtering methods can be used in software processing.

10. In a vehicle-mounted DVD system, how should an electronic anti-shock system be designed?

Answer: In vehicle-mounted DVD systems, it is best to choose high-end DVD players, as they typically employ electronic anti-shock systems (ADVANCEDESP). When the read count in the memory buffer decreases, advanced electronic anti-shock designs will read at double the normal speed to reduce noise, preventing skipping even during continuous shaking. Now, let’s discuss what electronic anti-shock means. Simply put, electronic anti-shock is a process of storing and releasing signals. First, the CD reads the signal in advance, which is what we see as the machine accelerating, then stores the signal in RAM, and the sound we hear when the anti-shock is activated comes from the RAM. Without anti-shock, the signal is read 1:1, so when impacted, it results in skipping. With anti-shock enabled, the sound released from RAM continues to play even when the machine is impacted, while the optical head quickly resets and retrieves the signal, thus preventing skipping. This is the general situation. However, this method does not fully meet user requirements, as the time provided is usually only 3 seconds, leading to a relatively high chance of skipping. Increasing RAM would raise costs, as RAM can be expensive, especially high-quality RAM.

If you like this article, please like it!

Basic Knowledge Q&A on Microcontroller Programming

Basic Knowledge Q&A on Microcontroller Programming

Technology Comes from Accumulation, Success Comes from Persistence

——Microcontroller Detailed Explanation by Wu Jianying

Leave a Comment