Browsing this Thread:
1 Anonymous Users
|
疑問?!不能動作
|
|
新會員
Joined
: 2007/9/5 21:45 最後登入時間
: 2010/6/27 16:06
Group:
註冊會員
Level : 3 HP : 0 / 55 MP : 6 / 2744 EXP : 20
|
小弟現在寫了一個測試檔 可是都沒反應 請求哪邊出錯
還有 我觀看U2TXREG、U2RXREG裡面都沒有數值
動作說明:TX傳送了 Ox1B, 'I' 的指令給RFID,RFID要回傳卡號給 PIC的RX,判段RX有值會啟動LED全亮
#include <p24FJ128GA010.h> void UARTInit(void);
int main(void) { AD1PCFG = 0xFFFF; UARTInit(); //Initialize the UART converter while(1) { char TxBuffer[2]; TxBuffer[0]=0x1B; TxBuffer[1]='I'; while(U2STAbits.UTXBF); U2TXREG = TxBuffer; while(!U2STAbits.URXDA); LATA = 0xffff; } }
void UARTInit(void) { TRISA = 0xff00; TRISFbits.TRISF5 = 0; //RF5/U2TX為輸出 TRISFbits.TRISF4 = 1; //RF4/U2RX為輸入 U2BRG = 0x0c; //0x0c(19200); U2MODE = 0x8800; U2STA = 0x0400; }
發表於: 2008/8/10 17:16
Edited by linklove99 on 2008年08月10日 17:59:50
|
|
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.