Microcontroller power dissipation
First you need to look in the data sheet to determine how much power is consumed inside the processor itself. This will almost certainly be a function of the clock frequency but it may also depend on which peripheral devices you are using inside the processor. There may be tables or graphs in addition to some kind of worst-case specification.

Second, add the power used to drive the processor pins. If the load on a pin is capacitive, like the gate of some CMOS logic device, then the power consumption is equal to \$C_{LOAD}f_{SWITCH}V^2\$ where \$f_{SWITCH}\$ is the frequency that the load is switched, not the CPU clock frequency. If the load is resistive then there is a d.c. component as well. Calculate the power consumed by each output pin and add it to the internal power consumption, and you have your answer.