2
#include <p18f45k22.h>
#include <usart.h>

char uart_rd;

void main(void)
{

ANSELC = 0;

Open1USART(USART_TX_INT_ON &             // disables transmission interrupt     
           USART_RX_INT_OFF &// disables reception interrupt                            
           USART_ASYNCH_MODE & // sets USART to asynchronous mode  
           USART_EIGHT_BIT&  // sets USART to use 8-bit data mode 
           USART_CONT_RX &   // sets the port in continues receive mode 
           USART_BRGH_HIGH,   // uses the low speed Baud rate formula 
          52 // sets Baud to 9600 BPS using 8MHz in calculation (actual baud rate is 9600.614)
            );  

while (1) 
{ 
putrs1USART ("Hello world!\n"); 
} 

} 

我没有在超级终端上得到任何东西。我是否需要从代码中添加或删除任何内容。

帮助表示赞赏。

干杯

4

0 回答 0