📄 crystal.h
字号:
// Easy method: Set FREQ to crystal speed in Hz
// Set speed value to UBRRL value for given crystal at 19.2k data rate.
//#define FREQ 6000000 // 19200 has huge error rate
//#define FREQ 7372800
//#define FREQ 8000000
#define FREQ 12000000 //19200 has good error rate
/* - These are mathematically correct, preprocessor doesn't round right
#define N2400 ((FREQ/16)/2400)-1
#define N4800 ((FREQ/16)/4800)-1
#define N9600 ((FREQ/16)/9600)-1
#define N14400 ((FREQ/16)/14400)-1
#define N19200 ((FREQ/16)/19200)-1
#define N28800 ((FREQ/16)/28800)-1
#define N38400 ((FREQ/16)/38400)-1
#define N57600 ((FREQ/16)/57600)-1
#define N76800 ((FREQ/16)/76800)-1
#define N115200 ((FREQ/16)/115200)-1
*/
#if (FREQ != 7372800)
#define PATCH
#endif
#if (FREQ == 7372800 )
#define N2400 191
#define N4800 95
#define N9600 47
#define N14400 31
#define N19200 23
#define N28800 15
#define N38400 11
#define N57600 7
#define N76800 5
#define N115200 3
#endif
#if (FREQ == 8000000 )
#define N2400 207
#define N4800 103
#define N9600 51
#define N14400 34
#define N19200 25
#define N28800 16
#define N38400 12
#define N57600 8
#define N76800 6
#define N115200 3
#endif
#if (FREQ == 12000000 )
#define N2400 312
#define N4800 155
#define N9600 77
#define N14400 51
#define N19200 38
#define N28800 25
#define N38400 19
#define N57600 12
#define N76800 9
#define N115200 38 // 5 is the 'correct' speed here, but the error rate is too high and doesn't work
#endif
#if (FREQ == 6000000 )
#define N2400 155
#define N4800 77
#define N9600 38
#define N14400 25
#define N19200 19
#define N28800 12
#define N38400 9
#define N57600 6
#define N76800 4
#define N115200 2
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -