The photoluminescence of erbium-doped semi-insulating polycrystalline and amorphous silicon containing 30 at. % oxygen is studied. The films were deposited on single-crystal Si substrates by chemical vapor deposition, implanted with 500 keV Er to fluences ranging from 0.05 to 6 x 1015 ions/cm2, and annealed at 300-1000 oC. Upon optical pumping near 500 nm, the samples show room-temperature luminescence around 1.54 µm due to intra-4ƒ transitions in Er3+, excited by photogenerated carriers. The strongest luminescence is obtained after 400 oC annealing. Two classes of Er3+ can be distinguished, characterized by luminescence lifetimes of 170 and 800 µs. The classes are attributed to Er3+ in Si-rich and in O-rich environments. Photoluminescence excitation spectroscopy on a sample with 1 X 1015 Er/cm2 shows that ~2% of the implanted Er is optically active. No quenching of the Er luminescence efficiency is observed between 77 K and room temperature in this Si-based semiconductor. The internal quantum efficiency for the excitation of Er3+ via photogenerated carriers is 10-3 at room temperature. A model is presented which explains the luminescence data in terms of trapping of electrical carriers at localized Er-related defects, and subsequent energy transfer to Er3+ ions, which can then decay by emission of 1.5 µm photons.