这是我开发板配套源代码的程序,肯定能用! /******************************************************** 龙丘MC9S08JM60多功能开发板V1.0 Designed by 龙丘 E-mail:chiusir@163.com 软件版本:V1.0 最后更新:2009年3月18日 相关信息参考下列地址: 博客: http://longqiu.21ic.org 淘宝店:http://shop36265907.taobao.com ------------------------------------ Code Warrior 6.2 Crystal: 12.000Mhz busclock:24.000MHz *********************************************************/ #include <MC9S08JM60.h>
unsigned char uart_getkey(void) { while(!(SCI1S1&0x80)) ; //keep waiting when not empty return SCI1D; }
void uart_init(void) { SCI1C2 =0x2c; SCI1BDH=0x00;//16MHz,19200bps,SCI0BDL=0x1a SCI1BDL=0x9c;//12MHz, 9600bps,SCI0BDL=0x4e } //24MHz, 9600bps,SCI0BDL=0x9c void uart_putchar(unsigned char ch) { if (ch == '\n') { while(!(SCI1S1&0x80)) ; SCI1D= 0x0d; //output'CR' return; } while(!(SCI1S1&0x80)) ; //keep waiting when not empty SCI1D=ch; }
void putstr(char ch[]) { unsigned char ptr=0; while(ch[ptr]) { uart_putchar((unsigned char)ch[ptr++]); } }
|