Set up interrupt vectors.
Declare constants.
Initialize ports and external interrupts.