| 1 | /******************************************************************************/ |
| 2 | /* System Level #define Macros */ |
| 3 | /******************************************************************************/ |
| 4 | |
| 5 | /* TODO Define system operating frequency */ |
| 6 | |
| 7 | /* Microcontroller MIPs (FCY) */ |
| 8 | #define XTAL_MHZ 4 |
| 9 | #define _XTAL_FREQ 4000000L |
| 10 | #define SYS_FREQ 4000000L |
| 11 | #define FCY SYS_FREQ/4 |
| 12 | |
| 13 | #include <pic12f1840.h> |
| 14 | |
| 15 | /******************************************************************************/ |
| 16 | /* System Function Prototypes */ |
| 17 | /******************************************************************************/ |
| 18 | |
| 19 | |
| 20 | #if _XTAL_FREQ == 4000000L |
| 21 | #define DelayUs(x) _delay(x) |
| 22 | #else |
| 23 | #define DelayUs(x) __delay_us(x) |
| 24 | #warning "This is slow" |
| 25 | #endif |
| 26 | |
| 27 | /* Custom oscillator configuration funtions, reset source evaluation |
| 28 | functions, and other non-peripheral microcontroller initialization functions |
| 29 | go here. */ |
| 30 | |
| 31 | void ConfigureOscillator(void); /* Handles clock switching/osc initialization */ |