From the Chilton manual for '01-04 Honda Civic & CR-V:
When the battery is disconnected.. it is imperative that you perform the "PCM idle learn procedure
1. Make sure that all electrical components (air-conditioning system, lights,rear window defogger, sound system, etc.) are turned OFF.
2. Start the engine, bring it up to 3000 rpm and hold it there, with no load (in PARK or NEUTRAL), until the radiator fan comes on, or until the engine coolant temperature reaches 194-degrees F.
3. Allow the engine to idle for at least 5 minutes with no load on it and the throttle fully closed.
Note: if the radiator fan comes on during this five-minute period, don't include the time during which the fan runs as part of the five minutes.