Source code or firmware depends from particular circuit design. Each uC can support many circuits designs and application situations where can be used, from situation to situation depends how source code should be. You didnt specify circuit or anything else which can give us to conclude what you want. Post circuit and describe software and circuit needs.