- #include <c8051f040.h>
- void init_sysclk( ) {
- char save = SFRPAGE;
- SFRPAGE = CONFIG_PAGE;
- OSCXCN = 0x77; // start up oscillator in crystal oscillator mode
- while (!(OSCXCN & 0x80)); // wait for crystal startup
- // set the system clock source to the external source
- CLKSEL = 0x01;
- SFRPAGE = save;
- }
Raw Paste