那位大侠能指点一下为什么我的程序运行出来是乱码啊?不胜感谢!
#include <hidef.h> /* common defines and macros */ #pragma LINK_INFO DERIVATIVE "mc9s12dg128b" #define SCI0CR2 (*((volatile unsigned char*)(0x00CB))) #define SCI0SR1 (*((volatile unsigned char*)(0x00CC))) #define SCI0BDH (*((volatile unsigned char*)(0x00C8))) #define SCI0BDL (*((volatile unsigned char*)(0x00C9))) #define SCI0DRL (*((volatile unsigned char*)(0x00CF)))
void uart_init(void) { SCI0CR2=0x0C; SCI0BDH=0x00; SCI0BDL=0x9C; } void uart_putchar(unsigned int ch ) { while(!(SCI0SR1&0x80)) { ; } SCI0DRL=ch; } void SciSendStr(unsigned int *buf) { unsigned int *p; p=buf; while(*p!='\0') { uart_putchar(*p++); } } main() { uart_init(); SciSendStr(12,33,35); while(1); } |