Microscopic description of the excitation of giant resonances in heavy ion collisions