Lỗi not enough ram khi nap code 8051

It will eventually happen that you are trying to figure out why something is not working and you want to measure a signal inside your PCB. Before designing the PCB, you should think which points will be important to troubleshoot your circuit and, in case they are not easily accessible, add a test point somewhere connected to them. There are various forms of test points, but the ones that form a loop are great for test probes with hooks.

Give space between components

It is tempting to pack the components as close as possible, only to realize that there is no room for the routing of wires. Give some space between components so that wires can spread. The more pins the component has, the more space it will need. Spacing will not only facilitate auto-routing as it will make soldering easier.

Lỗi not enough ram khi nap code 8051

Place components with the same orientation

Components generally have a standard pin numbering, with pin

1 in the upper-left corner. If all components are oriented equally, you will not make mistakes when soldering or when inspecting a component.

After laying out all the components, print out the layout. Place each component on top of the layout paper to see if they match. Sometimes datasheets may have errors.

Exchange wiring directions between layers

Draw vertical traces on one side and horizontal traces on the other. This facilitates wiring of lines that have to cross over the others. For multiple layers, alternate between directions.

Select the width of lines depending on current

Larger width reduces resistance, which in turn reduces the heat caused by dissipation. The width of the lines should be sized according to the estimated current that flows through them. You can use this online calculator to calculate their width. Therefore, power lines should be wider because all the current is supplied by these wires.

Know the specifications of the manufacturer

Each manufacturer has its own specifications, such as minimum trace width, spacing, number of layers, etc. Before starting design, you should consider what you need and find a manufacturer that meets your requirements. Your requirements also include the grade of materials of the PCB. There are grades ranging from FR-1 (paper-phenolic mixture) up to FR-5 (glass cloth and epoxy). Most PCB prototyping manufacturers use the FR-4, but FR–2 is used in high-volume consumer applications. The type of material affects the circuit board’s strength, durability, moisture absorption and Flame Resistance (FR).

Avoid 90º angles with traces

Sharp right angle turns are difficult to keep the trace width constant. This is a reason of concern for narrow traces, where a small difference makes a significant fraction of the trace. A better approach is to do two 45º bends.

Lỗi not enough ram khi nap code 8051

Use the silk layer

This layer is pretty standard in professional PCB manufacturers and it is extremely useful for labeling. Label your components (the PCB layout software usually does this) and add some information regarding what the board is about, a revision number, and the author/owner.

Use the schematic vs. layout comparison

Many PCB layout softwares have a comparison tool between schematic and layout. Use it to guarantee that your layout is matching the schematic.

Create a ground plane

Especially in analog circuits, it is important that “ground” means the same voltage throughout the PCB. If you use traces to route the ground signal, their resistance will create voltage drops that will make different “grounds” in the PCB have different potentials. To avoid that, you should create a ground plane, i.e., a large area of copper (or even better, reserve a layer for the plane) where the components connecting to ground can do it directly through vias. The ground plane can be completely filled with copper (better for heat dissipation) or in a square grid like the picture below.

Lỗi not enough ram khi nap code 8051

One of the downsides of a plane is the difficulty to solder a component, since the heat gets dissipated quickly through the plane. To avoid this, the contacts to planes can be made through thin traces, like the picture below.

Lỗi not enough ram khi nap code 8051

Place bypass capacitors

Bypass capacitors are used to filter AC components from your constant power supply. They reduce noise, ripples and other unwanted AC signals. They do so by bypassing these AC fluctuations to ground, which gives them the name. Therefore, they are usually connected between wherever voltage we want to filter (supply voltage, reference signals, etc.) and ground.

A good place to choose for these capacitors is at the power inlet to your PCB: the wires connecting the power supply to your PCB are usually long and act as antennas, collecting lots of RF signals. Another effective place is close to the ICs (as close as possible to the power and ground pins), to reduce any noise added inside your PCB. The same holds true for reference pins, or any other pin where you need a very stable voltage.

Lỗi not enough ram khi nap code 8051

The values of the capacitors depend on the frequencies of the AC components. Each capacitor has its own frequency response determined by its resistance and Equivalent Series Inductance (ESL) that is tuned to a range of frequencies. For example, to filter low frequencies you need a larger capacitor. As a rule, a capacitor of 0.1-1µF suffices for the mid-range frequencies, if you have slow fluctuations, you may choose around 1-10µF and for high-frequency noise you can use 0.001-0.1µF capacitors. You can also use any combination of bypass capacitors to remove a wider range of frequencies. For chips that drive a lot of current, you may put 10 µF – 100 µF capacitors to work as buffers. If the value of the capacitor allows, use monolithic ceramic capacitors because they are small and cheap.

Route the differential signal traces in parallel

Differential signals are often used to improve immunity to noise and amplify the dynamic range. This is only effective if the traces of both signals follow similar paths, so that the noise disturbs both paths equally. To that end, the two lines of a differential signal should be made parallel to each other and as close as possible.

Lỗi not enough ram khi nap code 8051

Consider spots of heat

Heat can degrade performance of circuits and even damage them, if not well dissipated. Consider which components consume more power and how the heat produced is being diverted by the package. The datasheet has a parameter called “Thermal Resistance” that states how much temperature increases per Watt of power given certain conditions. The conditions can be for example with a copper area of x by y mm underneath the IC. For stronger heat dissipation, you should add heat sinks or even a fan to cool down the IC. Furthermore, keep critical parts of the circuit board isolated from these heat sources.

Lỗi not enough ram khi nap code 8051

Make parallel footprints for hard to find components

Often times, you are using components that are usually unavailable for sale, or the prices of two components with the same functionality fluctuate and you would like to buy the cheapest. These are cases where you would prefer to change component depending on external factors, even if they do not have the same footprint, but keep the design of the circuit board unchanged. If board area is not of much concern, you can prepare your design with more than one footprint in parallel for a specific block, so that you mount the part that you have available at the moment and keep the others empty.

Tips for power circuits

Keep power and control grounds separate

Large voltage and current spikes from power circuits can generate disruptive interference in the control circuits, which are usually low voltage and current. For each power supply stage, you should keep power ground and control ground separate. If you tie them together in the PCB, do it in a point near the end of the supply path (most notably near the PCB ground connection).

Use an inner layer for the control ground

In case you are thinking about using a multilayer circuit board, use the top layer for power traces, the bottom layer for control traces and an inner layer for the control ground. The large ground plane in the middle layer will offer a small impedance path for any interference from the power circuits and protect the control paths from it.

Make power traces wider to withstand higher currents

This is actually a general tip, but it is more important for power circuits. You should size the width of the wire of each power path according to the current that flows through it. Failing to do so can generative excessive heat and burn the wires. You can use this online calculator to calculate their width.

Tips for mixed-signal circuits

Keep digital and analog grounds separate

As for the case of power circuits, you should keep the digital and analog grounds separate. The reason is the same: voltage and current spikes from digital circuits can generate interference (noise) in the analog circuits, affecting their performance. If you tie them together in the PCB, do it in a point near the end of the supply path (most notably near the PCB ground connection). Although there are other points of view to this problem, this is the most accepted.

Protect analog grounds from noise

Any interference in the analog ground has the same effect as it would be in the signal lines (all that matters is the differential voltage between any point and ground). You want a large ground plane to reduce its resistance, but that also makes it more susceptible to capacitive coupling to lines routed above or beneath it. To that end, analog ground should only have analog lines crossing it and the same for digital. That reduces the capacitive coupling between analog and digital circuits.

Tips for PCB mounting

Solder from small to large components

If you start soldering large components, they will block access to solder the next components. You should start from the small components, such as Surface Mount Devices (SMD) and end with the large components, such as through-hole capacitors or terminal blocks.

Be aware of cold solder joints

A cold solder joint is when, while making a solder joint, a hot solder flows onto a cold joint, and gives a greyish blob of solder that is not well adhered to the joint. It can also happen when not enough heat was applied for the solder to melt properly or the surface being soldered was not clean enough. Sometimes it can be seen with bare eyes (you will crack the solder joint if you try to move the pin), other times looks like a well done solder. The effects of these solder joints can be static noises, intermittant cutouts and others. To solve this, you can either remelt the existing solder or suck it out, clean the spot and solder again. To avoid cold solder joints, first heat the joint with the tip of the soldering iron, then touch the joint with the solder. The hot joint will melt the solder and it will flow and engulf the joint properly. A nice way to avoid cold solder joints, and facilitate soldering in general, is to use flux.

Lỗi not enough ram khi nap code 8051

Use flux for easy soldering

Soldering flux is a chemical agent that makes soldering a piece of cake. It does so by improving the wetting characteristics of the liquid solder. Just add some flux in the surface to be soldered and the hot solder will immediately glue to the pin.

See it in action in these video

Do not trust the multimeter continuity test

A normal multimeter has a continuity test mode that beeps when the resistance between the two probes is small. This is commonly used to test continuities, because you don’t need to jump between looking at where you put the probes and at the value on the multimeter. However, a resistance of a few ohms still beeps, although it is a sign of bad soldering. Assuming low resistance lines and a few solder points, the resistance should be below 1 ohm. Use the resistance measurement mode to guarantee that the resistance between two points is as low as it should be, which also means good solder joints.