Appendix – Looking ‘Under the Hood’
8 - 34 Gettings Started with the MSP430 - Using Energia (Arduino)
Two ways to change the MSP430 clock source
There are two ways you can change your MSP430 clock source:
Modify the initClocks() function defined in wiring.c
Add the necessary code to your Setup() function to modify the clock sources
Advantages
Do not need to re-modify wiring.c after updating to new revision of Energia
Changes are explicitly shown in your own sketch
Each sketch sets its own clocking, if it needs to be changed
In our lab, it allows us to demonstrate that you can modify hardware registers – i.e.
processor specific hardware – from within your sketch
Disdvantages
Code portability – any time you add processor specific code, this is something that will
need to be modified whenever you want to port your Arduino/Energia code to another
target platform
A little less efficient in that clocking gets set twice
You have to change each sketch (if you always want a different clock source/rate)