First,I/O interface strong push-pull output
Second,PCB Cabling
1, the input end and the output side should avoid adjacent parallel, so as not to produce reflection interference. If necessary, ground insulation should be added, two adjacent layers of the wiring to each other perpendicular, parallel prone to parasitic coupling.
2, ground > power line > Signal line, usually the signal line width is: 8mil~12mil; power cord is 50mil~100mil. The PCB of the digital circuit can be made up of a circuit with a wide ground wire, that is, to make a net to use (analog circuit can not be used in this way)
3, you can use some remote island copper, and then connect it to the ground plane.
4, in the PCB inside the digital and simulated ground is actually separate between them are not connected, just in the PCB and the external interface (such as plug, etc.). Digitally with analog ground a little short, note that there is only one connection point. There is also a non-common on the PCB, which is determined by the system design.
5, there is no local wiring, you can consider the cloth in the VCC layer, and then consider the GND layer.
6, the distance between the two legs of the standard components is 100mil (2.54mm), so the basis of the grid system is generally set to 100mil (2.54 mm) or less than the whole multiple of 100mil, such as: 50mil, 25mil, 20mil and so on. General layout Select 50mil Mesh, cabling select 5mil mesh, hole distance and device distance set to 25mil (allows the device to trace between devices)
7, Serpentine line is simply for the length of matching!! Inductance, filtering will not use such a stupid method.
8, the board side of the copper to be away from the edge of the board 20mil.
9, the PCB board delay is 0.167ns/inch. However, if more than the hole, the device pin more, the network cable set more constraints, the delay will increase.
10, the wider the line diameter, from the power/ground closer, or the higher the dielectric constant of the isolation layer, the smaller the characteristic impedance.
11, the trace on the PCB board can be equivalent to the series and parallel capacitance, resistance and inductance structure. The typical value of the series resistor is 0.25-0.55 ohms/ft. Shunt resistors are usually very high resistance
12, if the use of CMOS or TTL circuit design, operating frequency of less than 10MHz, wiring length should not be greater than 7 inches. The operating frequency should be no more than 1.5 inches in the 50MHz wiring length. If the operating frequency reaches or exceeds 75MHz the wiring length should be 1 inches.
13, RC matching terminal can reduce power consumption, but only for the signal to work relatively stable situation. This method is best suited for matching the clock line signal. The disadvantage is that the capacitance in the RC matching terminal may affect the shape and propagation speed of the signal. The series resistor matching terminal does not generate additional power consumption, but slows down the transmission of the signal. This method is used for bus drive circuits with little effect on time delay. The advantage of a series resistor matching terminal is that it can reduce the number of devices on board and the density of the wires.
14, the installation of the terminal resistor: the vertical installation of the resistance of a mounting pin is very short, can reduce resistance and circuit board thermal resistance, so that the resistance of heat more easily distributed to the air. However, a longer vertical installation increases the inductance of the resistor. The horizontal mounting method has lower inductance due to low installation. However, the thermal resistance will drift, in the worst case, the resistance becomes open circuit, resulting in PCB trace end matching failure, become a potential failure factor.
15, solve the signal integrity problems will improve the electromagnetic compatibility of the PCB board. It is very important to ensure that the PCB board has a good grounding. The use of a signal layer with a ground layer for complex designs is a very effective method. In addition, the minimum density of the outermost signal of the circuit board is also a good way to reduce electromagnetic radiation, this method can be used "surface layer" technology "build-up" design PCB to achieve. The surface layer is achieved by adding thin insulating layers to the common process PCB and the combination of micro-holes used to penetrate these layers, the resistors and capacitors can be buried under the surface, and the trace density on the unit area increases nearly one times, thus reducing the size of the PCB. The narrowing of the PCB area has a huge impact on the topology of the traces, which means that the reduced current loop, the narrowing of the branch trace length, and the electromagnetic radiation are approximately proportional to the area of the current loop, while the small-volume feature means that the high-density pin package can be used, which in turn reduces the connection length, thus reducing the current loop Improve the electromagnetic compatibility characteristics.
16, any high-speed and high-power devices should be placed as far as possible to reduce the power supply voltage instantaneous overshoot.
Third, adding STC models in Kei (new database addition method)
Note: Add a single-chip microcomputer database, can choose STC MCU, and do not affect the original database use.
Operation Steps:
① download The STC database for Keil renamed to STC.CDB and copied to the Keil/uv2 directory. (If it is Kile3, then Uv3,kile4 is UV4)
② Open the tools.ini file under the Keil folder and type C51 under [UV2] (above [CDB0=UV2\STC]). CDB ("STC"), then save the exit and add it. (If it is Kile3, then Uv3,kile4 is UV4)
To use: When setting options for the target, click on the Device page and select STC in database.
When you create a new project, select "STC" in the Select a CPU Date Base file.
Note: The STC database provided by Acer's official website is REG51.H, REG52 and the default header file used. H...... (That is, the right-click Quick Insert Header file is REG51.H, REG52. H...... ),
The right-click Quick Insert header file looks like this:
Four, Max485, Rs485, Max232, Rs232
rs485\rs232: the data transmission between the computer and the computer or the computer and the terminal can adopt two ways of serial communication and parallel communication. The serial communication method is widely used because of its low cost, especially in the remote transmission, which avoids the inconsistency of many line characteristics. In serial communication, both sides of the communication are required to adopt a standard interface, so that different devices can be conveniently connected to communicate. Rs-232-c Interface (also known as EIA Rs-232-c) is currently the most commonly used serial communication interface.
max485\max232: MAX485 is a low-power transceiver for RS-485 and RS-422 communication. The MAX232 chip is a single-supply level shifter chip designed for the RS-232 standard serial port by Maxim Inc., which is powered by a single V-supply.
Five,Memory allocation
In Keil, when defining a variable, be aware of which area is defined, and the system defaults to direct addressing the data area, but the data area is only 128 bytes, which is easy to run out and overflow. 51 single chip microcomputer exceeds 128 bytes of RAM area when defining a variable, be sure to add idata before the variable, indicating that the variable is idata (the Ram area between 128-256).
Encountering logical variables can be defined in Bdata, which can significantly reduce memory footprint (such as bdata bit flag).
For infrequent use and low speed requirements are placed in the xdata area.
If you want to save data space, you must use the large mode to place the variables of the undefined memory location in the data area (it is of course best to specify the memory type for all variables).
But when you use pointers, you specify the pointer to the type. In C51, a generic pointer that defines a memory type occupies 3 bytes, two pointers to the data area occupy only 1 bytes, and a pointer to the XData area occupies 2 bytes (for example, p points to data area char data *p;). You can also specify the memory type of the pointer itself, such as char data *xdata p, which means that pointer p points to the data area variable, which itself is placed in the XData area.
Six,Strcpy () differs from Memcy ()
void Memcy (void *dest,const void*src,siz_tn) is used to copy the first n bytes of the content referred to by SRC to the memory address referred to by dest. Unlike strcpy (), the former memcpy () replicates n bytes intact, and does not stop because it encounters ' .
Seven,the difference between SPI, i²c, and UART bus
SPI : consists of three signal lines (Serial clock (SCLK), serial data output (SDO), serial data input (SDI)). You can implement multiple SPI devices to connect to each other. The SPI device that provides the serial clock is an SPI host or master device (master), and the other device is an SPI slave or slave device (Slave). The master-slave device can achieve full-duplex communication, and when there are multiple slave devices, you can also add a line from the device selection.
I²c : The bus is bidirectional, two lines (SCL, SDA), serial, multi-master (multi-master) interface standard, has the bus arbitration mechanism, is very suitable for the device between the near-distance, non-recurrent data communication. In its protocol system, the transmission of data will bring the device address of the destination device, so the device network can be implemented.
UART : The bus is asynchronous serial port, so generally more complex than the first two synchronous serial port structure, generally by the baud rate generator (generated baud rate is equal to the transmission baud rate of 16 times times), the UART receiver, the UART transmitter composition, the hardware by two lines, one for sending, one for receiving.
Bulls opinion:less than the I²c line, the individual feel more powerful than the UART, SPI, but the technical also more troublesome, because the need to have bi-directional IO support, and the use of pull-up resistor, I think the anti-interference ability is weak, generally used for the same card on the chip between the communication, less for long-distance communication. The SPI implementation is simple, the UART needs a fixed baud rate, that is, the interval of two bits of data is equal, and the SPI does not matter, because it is a clock protocol.
Eight,effect of 0 ohm resistor
1. use as jumper. This is both beautiful and easy to install.
2. connecting the digital and analog circuits, the ground is divided into two networks, in large areas of copper processing, it will be much more convenient. Such occasions, and sometimes electrical sense or magnetic beads, etc. to connect.
3. do the fuse. Because the circuit of the PCB on the fuse current is larger, if there is a short-circuiting over-current and other failures, it is difficult to fuse, may lead to greater accidents. Since the 0 Ohms resistance current capacity is weaker, over-current will be the first 0 ohms fused, thereby disconnecting the circuit, to prevent the occurrence of greater accidents.
4. the location reserved for debugging. Depending on your needs, you can decide whether to install, or other values. It is sometimes marked with a * to indicate that it is determined by debugging.
5. use as a configuration circuit. The function is similar to a jumper or a dip switch, but it is fixed by welding to avoid the normal user to modify the configuration arbitrarily. By installing resistors at different locations, you can change the function of the circuit or set the address.
Nine, filter, decoupling, bypass capacitor action
Filter capacitance: Used in the power supply rectifier circuit, used to filter out the AC components. Make the output DC smoother.
Decoupling capacitance:
1. filter out the high-frequency noise generated by the device, cut off its transmission through the power supply circuit channel;
2. prevent the noise of the power supply from interfering with the circuit: a decoupling capacitor is usually connected in parallel on the VCC pin so that the AC component is grounded from the capacitor. The high frequency switching noise generated by the active device on the switch is propagated along the power cord. The main function of the decoupling capacitor is to provide a local DC power supply to the active device to reduce the spread of the switching noise on the board and to guide the noise to the ground
3. as the energy storage capacitor of this integrated circuit: when the high frequency device is working, its current is discontinuous, and the frequency is very high, and the device VCC to the total power has a certain distance, even if the distance is not long, in the case of high frequency, impedance z=i*wl+r, The inductance of the line can also be very large, causing the device to not be supplied in time when the current is required. The decoupling capacitor can compensate for this deficiency. This is one of the reasons why many boards place small capacitors at the VCC pins of high-frequency devices.
Bypass capacitance: When connected with a resistor, connect at both ends of the resistor to allow the AC signal to pass smoothly.
In electronic circuits, decoupling capacitors and bypass capacitors play an anti-jamming role, where the capacitance is different and the name is not the same. For the same circuit, the bypass (bypass) capacitor is the high frequency noise in the input signal as the filter object, the front stage carries the high-frequency clutter filter, and the decoupling (decoupling) capacitor is also called the decoupling capacitor, is the output signal interference as the filter object.
Tentrivial knowledge
1. Tantalum Capacitor: is a long life, high accuracy, resistance to high temperature, the disadvantage is the small capacity, expensive, not easy to cause waveform distortion phenomenon;
2 capacitance capacity is not higher the better, we also have to consider the capacitance and discharge and other factors, too high capacitor will lead to insufficient discharge and low current;
3. C51 Temporary variables are not all stored with the stack, for a small amount is a register or stack way, a lot of allocated to the RAM address, which is different from the PC or other single-chip computer;
4. The function and variable names in the C language are case-sensitive. However, for compatibility reasons, all names in the target file (object files) appear in uppercase letters, so case-insensitive when referencing an external symbol name in the program;
The number of case in the 5.swtich statement is not qualified, but is limited by the valid memory space and the maximum length allowed by a single function;
6. the number of nested call layers for functions in the function parameter list is up to 10 layers, the containing file can be nested up to 9 layers, conditional preprocessing up to 20 layers, which is the pre-processor limit, the macro can be nested 8 layers, can pass 32 parameters to a macro or function A line or a macro can have a maximum of 2000 characters, even after the macro expands ;
7. When a function is not called in Keil C, the compiler considers it likely to be an interrupt function. The space of the local variables used in the function is not released, that is, as with global variables.
[Turn] Electronic technology • Note 1 (September)