本帖最后由 wzy8430121 于 2018-3-31 17:14 编辑
测量IO口没有波形输出..
目前用的内部晶振64M
目前只是测试发送..........
但是很奇怪的是 debug 发现 while(!TXSTA5bits.TRMT); 能通过.......TX IO口却没波形
void Open5USART(void)
{
TRISEbits.TRISE2 = 0;
TRISEbits.TRISE3 = 1;
RX5PPS = 0X23;
TX5PPS = 0X22;
UART5MD = 0;
TXSTA5bits.CSRC = 0;
TXSTA5bits.TX9 = 0;
TXSTA5bits.TXEN = 1; // Enable transmitter
TXSTA5bits.SYNC = 0;
TXSTA5bits.BRGH = 1;
RCSTA5bits.RX9 = 0;
RCSTA5bits.CREN = 0;
RCSTA5bits.SPEN = 1; // Enable receiver
BAUDCON5bits.BRG16 = 1;
BAUDCON5bits.SCKP = 0;
SP5BRG = 1665; // HFINTOSC with HFFRQ = 64 MHz 9600
PIE4bits.RC5IE = 0; // Interrupt on receipt
PIE4bits.TX5IE = 0; // Interrupt on transmission
}
void main()
{ ANSELE = 0x00;
Open5USART();
while(1)
{
while(!TXSTA5bits.TRMT);
TX5REG = 0X55;
delay_100ms(20);
}
}
|