[問題] PIC18F2321(C18)_使用USART問題請教
請教版上前輩~我在使用PIC18F2321時,用USART傳輸,傳三個BYTE(0x41,0x42,0x44)
但使用終端機看,只收到2BYTE資料(0x42,0x44),第一BYTE都會不見。(0x41)
不知道是否程式設定上有問題??
還請版上前輩給予指導,謝謝大家
使用Crystal:4MHZ,鮑率;19200。 (電腦終端機使用COM1,鮑率用19200)
程式如下;
----------------------------
#include <p18f2321.h>
#include <delays.h>
#include <usart.h>
#pragma config OSC=HS, BOR=OFF, BORV=2, PWRT=ON, WDT=OFF, LVP=OFF
void main()
{
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_ON &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
12 );
WriteUSART(0x41);
while(BusyUSART());
WriteUSART(0x42);
while(BusyUSART());
WriteUSART(0x44);
while(BusyUSART());
while(1)
{
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.116.80.6
推
10/10 10:27, , 1F
10/10 10:27, 1F
→
10/10 10:28, , 2F
10/10 10:28, 2F
→
10/10 11:40, , 3F
10/10 11:40, 3F
→
10/10 11:41, , 4F
10/10 11:41, 4F
推
10/10 12:22, , 5F
10/10 12:22, 5F
→
10/10 23:01, , 6F
10/10 23:01, 6F
→
10/10 23:03, , 7F
10/10 23:03, 7F
→
10/10 23:04, , 8F
10/10 23:04, 8F
推
10/11 04:20, , 9F
10/11 04:20, 9F
推
10/11 04:23, , 10F
10/11 04:23, 10F
推
10/11 09:52, , 11F
10/11 09:52, 11F
→
10/11 09:52, , 12F
10/11 09:52, 12F
→
10/11 10:58, , 13F
10/11 10:58, 13F
→
10/11 10:58, , 14F
10/11 10:58, 14F
→
10/11 12:14, , 15F
10/11 12:14, 15F
→
10/14 23:48, , 16F
10/14 23:48, 16F
ASM 近期熱門文章
PTT數位生活區 即時熱門文章