can 912 Any baptized person who is not forbidden by law may and must be admitted to holy communion.
 
can 916 A person who is conscious of grave [mortal] sin may not celebrate Mass or receive the body of the Lord without previously having been to sacramental confession, unless there is a grave reason and there is no opportunity to confess; in this case the person is to remember the obligation to make an act of perfect contrition, which includes the resolve of confession as soon as possible. 
can 919 whoever is to receive the blessed Eucharist is to abstain for at least one hour before holy communion from all food and drink, with the sole exception of water and medicine.

 

(excerpts taken from The Code of Canon Law, copyright © 1983 The Canon Law Society Trust, Canada)