⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.c

📁 * Use 10 MHz crystal frequency. * Use Timer0 for ten millisecond looptime. * Blink "Alive" LED e
💻 C
字号:
#ifndef SERIAL_C#define SERIAL_C// standard header files for ascii IO functions,// ascii manipulation functions#include  <stdio.h>     #include <ctype.h>#include  <stdlib.h>    void serial_init (char brg, char lo_speed);void serial_init(char brg, char hi_speed){  // setup Async communication   TX9 = 0;  TXEN = 1; // transmit enable  SYNC = 0; // async mode   if (hi_speed)   BRGH = 1; // hi speed mode   else BRGH = 0; // lo speed mode   SPBRG = brg;    bitset(TRISC, 7); // RC7 input    bitclr(TRISC, 6); // RC6 output   RX9 = 0;  // 8-bit reception    SPEN = 1; // serial port enable    CREN = 0; // clear enable first   CREN = 1; // now enable first #if   defined(__18CXX)  stdout = _H_USER;   //do not use default MCC18 usart functions                      // as we want to redefine them#endif  }#if   defined(__18CXX)#ifndef LCD_PUTCHvoid putch(char c);void _user_putc (auto char c) {    putch (c);}#endif#endif #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -