The prerequisites for the reception of Holy Communion are 1) being in the state of grace, 2) having fasted for one hour (for the sick 15 minutes if possible, no fast if fasting is not possible), and 3) devotion and attention.
1. State of Grace. As St. Paul notes in his letter to Corinth, reception after examining oneself is a prerequisite for worthy reception, otherwise Communion has the opposite from the desired effect of union with our Lord. This is why, out of respect for Christ and our own good, the Church obliges us to be in the state of grace when we receive. It should be noted, however, that some Catholics have the mistaken notion that they cannot go to Communion unless they go to Confession first. This is incorrect. Both the theology of the Church and her law oblige Confession ONLY when there is mortal sin. Confessions of devotion, however, are highly recommended. Thus, two errors are to be avoided, liberalism and rigorism.
1 Cor. 11:27-29
Therefore whoever eats the bread or drinks the cup of the Lord unworthily will have to answer for the body and blood of the Lord. A person should examine himself, and so eat the bread and drink the cup. For anyone who eats and drinks without discerning the body, eats and drinks judgment on himself.
Can. 916 A person who is conscious of grave sin is not to celebrate Mass or to receive the Body of the Lord without prior sacramental confession unless a grave reason is present and there is no opportunity of confessing; in this case the person is to be mindful of the obligation to make an act of perfect contrition, including the intention of confessing as soon as possible. [This is a truly exceptional permission that needs to be properly understood. It requires moral or physical impossibility to go to Confession and the necessity to receive Communion - such as a priest who MUST celebrate Mass.]
1. A member of the Christian faithful is obliged to confess in kind and in number all serious sins committed after baptism and not yet directly remitted through the keys of the Church nor acknowledged in individual confession, of which one is conscious after diligent examination of conscience.
2. It is to be recommended to the Christian faithful that venial sins also be confessed.