No.37934 作者:cheungssan 邮件:cheungssan@163.com ID:120870 登陆:1次 文章数:1篇 最后登陆IP: 最后登陆:2009/1/6 11:47:19 注册:2009/1/6 11:47:19 财富:100 发帖时间:2009/1/6 11:50:02 发贴者IP:60.216.167.101 标题:cheungssan:菜鸟求助,一小段串口程序。 摘要:No.37934菜鸟求助,一小段串口程序。 我用的芯片是at91sam7x256,写了一段串口往上位机发送的小程序,但怎么调也是不通,初步估计是在初始化的时候没弄好,但是找不出问题在哪? #include "/include/at91sam7S64/at91sam7s64.h" #include "/include/at91sam7s64/lib_at91sam7s64.h" void AT91F_LowLevelInit(void); void usart0_init(void); void usart0_write(char * tx_buffer, unsigned int tx_counter); #define MCLK 48000000 #define BAUD 19200 int CMain(void) { int index = 500000; AT91F_LowLevelInit(); usart0_init(); while(1) { usart0_write("Hello, World!\n", 14); while(index--); index = 500000; } return 0; } void AT91F_LowLevelInit(void) { //Disables the Watchdog Timer AT91C_BASE_WDTC-> WDTC_WDMR = AT91C_WDTC_WDDIS; //Enabling the Main Oscillator AT91C_BASE_PMC-> PMC_MOR = 0x01 | 0x07 < < 8; while (!(AT91C_BASE_PMC-> PMC_SR & AT91C_PMC_MOSCS)) //Setting PLL and divider AT91C_BASE_PMC-> PMC_PLLR = 24 | (0x28 < < 8) | (124 < < 16) | AT91C_CKGR_USBDIV_1; while (!(AT91C_BASE_PMC-> PMC_SR & AT91C_PMC_LOCK)); ......
>>返回讨论的主题
|