check engine comes on periodically while im driving

sometimes when i am driving either on the highway or around town it doesnt matter my check engine light comes on, but just for 10-20 seconds, then shuts off...is there any way to check the code even while the light isnt on? how do you go about doing so
 
And yeah, you dont need to physically have the CEL illuminated at the time to retrieve the code - it is still stored in the KAM.

It is likely an O2, EVAP or EGR code.

Good luck.
 
When I swapped mid pipes, I must have not seated the O2 sensor correctly. On advice from these boards, I disconnected the battery for 20 mins to erase everything, reseated the sensors, and have not had the problem again.

adam