A loose or corroded ground terminal on the driver's side of the cylinder head can cause a rough idle, misfires, and there may be trouble codes. Restore the ground to the cylinder head.Google+
Car Problem Reports
Mazda Protege Idles Rough, Misfires, and Possible Check Engine Light
Mazda Protege Problem
Engines Affected: 1.5L 4 Cylinder, 1.6L 4 Cylinder, 1.8L 4 Cylinder, 2.0L 4 Cylinder
Average Mileage: 144,931 mi (60,000 mi - 243,000 mi)
Visitor, 2002 Mazda Protege, 2.0L 4 Cylinder, 156,000 mi
Check engine light flashes somethings then stops..does it randomly more on the highway. Then sometimes check engine light stays on. Seems to lose power only when check engine light flashes
Visitor, 1990 Mazda Protege, 1.8L 4 Cylinder, 60,000 mi
Idles Rough, Misfires, and Possible Check Engine Light.
Visitor, 2000 Mazda Protege, 1.6L 4 Cylinder, 128,000 mi
Rough idling, sputtering upon startup. Rough when driving. Blinking check engine light.
Visitor, 2000 Mazda Protege, 1.6L 4 Cylinder, 243,000 mi
Car has rough Idol and often stalls when stopped. Haven't fixed yet but this sounds like a possible solution.
Visitor, 1993 Mazda Protege, 1.8L 4 Cylinder, 170,000 mi
Idles Rough, Misfires, and check Engine Light gas out tail pipe ...bad smell