I saved this, one of the best explanations of it i have ever read
The ECU "learns" about your engine as you drive the car. The "learning" is actually a process that the ECU uses to track the tolerance changes of the sensors and actuators on the engine. Two examples of these values are the position of the idle-air bypass valve (automatic choke) at idle with the A/C on, and the trim gain on the injectors. The ECU stores these "learned" values in battery backed-up RAM so that it doesn't have to start from scratch the next time you turn your engine over.
"Resetting the ECU" is the process of clearing all the long term memory from the ECU's memory. These variables trim idle speed, fuel, spark, and more. The ECU will also store trouble codes for diagnostic capability. By resetting the ECU, the trim values will be set to some neutral default value and all of the trouble codes will be cleared.
To "reset" the ECU, all you have to do is remove the source of backup power. To keep the memory alive while the car is off, the ECU has a direct line, through a fuse, that goes right to the battery. This is usually the same line and fuse that supplies backup power to your radio so it doesn't forget all of its settings. Your ECU has now lost all of its long term memory values and will "reset" them all to defaults when it next powers on. By the way, the factory radio's memory lasts for a minute or two, so you probably will not lose your saved stations.
There is quite a bit of mythology revolving around resetting the ECU. Many people mistakenly believe that they need to reset the ECU after installing major engine modifications. Others believe resetting will resolve engine problems. Neither are correct.
The ECU is always tracking the engine's sensors and actuators. Resetting the ECU does not cause the ECU to learn engine changes any faster. The ECU is always tracking the gradual changes in the engine sensors and actuators. The ECU never gets satisfied with a setting, and is always updating the trim values. It will discover whatever change you made to your engine and make the appropriate changes. In fact, unplugging the ECU will most likely increase the learning curve of the new part.
There are only two reasons why you would want to reset your ECU. One is to clear a CHECK ENGINE light or error code after fixing the problem that caused the error. The other is to reset the spark advance trim value. The advance trim controls how much the timing is retarded from what the factory engineers considered optimum. This particular trim value is the only one the ECU "resets" to a non-neutral MAX value. If you are driving on low grade gas, the pinging picked up by the knock sensor causes this trim value to be lowered, and your timing to be retarded. If you go to the track and put good gas in the tank, you might not want to wait for the ECU to learn about the new gas and advance the timing. So resetting the ECU in this case makes sense. However, in the process, you will lose your idle and fuel trims (probably not too important for drag racing, though).
Won't clearing the trouble codes make the car run better? If the ECU notices a problem with a sensor, it will flag a code and possibly turn on the CHECK ENGINE light. Should the problem go away, the ECU will turn off the light and start using the sensor as normal once again. The code will be stored inside for later diagnostic retrieval. But that code being stored does not affect the ECU operation in any way.
I reset the ECU, and now the car runs rough! Why? The engine may run rough or idle poorly right after ECU reset. The ECU now has default numbers in its trim memory - it has to adjust them to match the tune of your engine and its sensors and actuators. It might take a day or two of driving in traffic before the engine will settle down again. Now you know why the ECU remembers these values in the first place!