Re: PCB layers
does any one know how do you decid how many layers you need in an application.
lets say for start that it has anlog and digital parts....
You decide how many layers you need depending on what you are trying to do with the circuit. You might need only a single sided board for a simple project, or you might need 4, 6, 8, 10, etc. layers for more complex circuitry.
The number of signal layers and the number of planes are each used in symetric pairs in a multilayer board. For multilayer boards, in general, you typically would have a ground plane, and a power plane. The power plane can be split to supply more than one voltage. These two plane layers would typically be in the center of your stackup.
The next layers out from the center would be signal layers. Critical signals would be run on the layer adjacent to the continuous ground plane - the trace width and the distance between the signal layer and plane would be chosen to give you the desired impedance for the signal traces. Less critical signals such as display traces, relay control, etc. could be on the layer adjacent to the power plane layer.
Analog and digital traces would be laid out such that they are separated physically, and do not share any areas of the adajcent plane. The reason for this is to avoid having shared signal return paths which could couple noise from digital to analog circuitry. Try to visualize each signal path as a complete loop consisting of the trace on the signal layer, and the return part of the loop through the adjacent copper on the plane.
Additional planes, and signal layers, would be added in pairs as needed to accomplish the desired routing.
There is no cookbook answer - you use your engineering knowledge to figure out what will give you the best results for your project - signal by signal.