Functions of the Engine Control Module
The engine control module basically controls the intersection of the engine's necessary ingredients to make energy -- fuel, air and spark. That sounds simple, kind of in the same way an engine itself sounds simple if you break it down into really basic terms. But the ECM accomplishes its considerable chore by constantly monitoring a vast network of sensors around the car to ensure conditions are within normal operating range. When something goes wrong, the ECM adjusts conditions or, if it can't, the car won't run properly or at all. When there's a problem, the ECM stores a trouble code so it can be diagnosed by a mechanic (with a scanner specifically designed for that purpose) and triggers the check engine light so the driver knows something's wrong.
Newer engine computer systems also feature lightweight, low-cost memory systems that can be easily accessed by the dealership to fix programming issues and update specifications (kind of like running a system or software update on your computer).
One of the most recent tasks (in the last decade or so, anyway) delegated to the engine computer came about only as automotive companies switched from mechanical throttle control to electronic throttle control. Previously, when your foot made contact with the gas pedal, it was connected to a cable that went directly to the engine so the engine could decide how much fuel to inject, based on whether you caressed the pedal, mashed it to the floor, or most likely, somewhere in between. Now, an electronic sensor at or near the gas pedal sends a signal via electrical wire to the engine management system, which evaluates your throttle contact and then sends a signal to the engine to adjust fuel dosage.
Part of the ECM's start-up procedure is to calibrate the position of the throttle at idle -- in other words, remind itself, and the throttle, how the engine should run when it's not being given any gas. This helps control and prevent an uneven idle. If all the sensors involved don't agree on the right position, the computer will send a signal to the engine and transmission to run in Limp Mode (preventing the driver from achieving high speeds that could get out of hand) and also sends an alert to the instrument cluster. The idea is to allow it to run well enough to get to a repair shop, but not strand you on the side of the road.
The ECM also makes sure the car meets emissions standards, by monitoring and regulating the fuel mixture to ensure the engine isn't running too rich and emitting pollutants beyond the established parameters. And with all those sensors already in place, the ECM is often responsible for managing features like anti-skid brakes, cruise control and theft protection.
That sounds like a lot to keep straight, doesn't it? So, on top of it all, the engine control module, unit, or what have you, runs through a recalibration test every time you turn on the car, just to make sure signals don't get crossed.