Browsing this Thread:
1 Anonymous Users
|
Re: USART問題
|
|
資深會員
Joined
: 2004/10/13 6:15 最後登入時間
: 2019/7/25 12:10
From PIC 使用者
Group:
註冊會員
Level : 19 HP : 0 / 470 MP : 152 / 27476 EXP : 81
|
9600 @ 20MHz ←X→ spbg=64 ←X→ 90uS 三者好像對不上,建議參考 datasheet 重算一下,9600@20MHz datasheet 上有算好現成的
極性相反的話,檢查一下是哪裡動了那個控制極性的 bit (TXCKP)
發表於: 2007/6/23 12:06
|
|
|
USART問題
|
|
新會員
Joined
: 2007/5/14 21:36 最後登入時間
: 2007/6/21 11:36
Group:
註冊會員
Level : 1 HP : 0 / 8 MP : 1 / 434 EXP : 34
|
弟利用PIC18F4550 (AP0013)和下列的範例程式作USART傳輸,設定 Baud rate 為 9600, 震盪器是20MHz,configuration bit 中設定divided by 5.
但量測TX端的輸出, 每一個time slot只有90 us左右 (應為104 us);此外,平常維持在低準位,起始和結束位元由低到高,與弟所預期的相反.
請問可能是哪邊出了問題呢? 謝謝各位先進
--------------------------------------------------------------
以下是程式碼
#include <p18cxxx.h> #include <usart.h> #include <stdio.h> #include <delays.h> #include <adc.h> #pragma config LVP=OFF #pragma config WDT=OFF
double adc,Voltage; unsigned char result; void main() {
OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_BRGH_LOW, 64);
while(1){ WriteUSART('A'); while(BusyUSART()); }
CloseUSART();
}
發表於: 2007/6/21 11:53
|
|
You can view topic.
你 不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.