[問題] 8051(w77e516)雙uart設定問題

看板C_and_CPP作者 (PP)時間11年前 (2014/07/11 10:13), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Keil C 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 因為第一次用到雙UART的ic 而在DATASHEET上寫到 However the serial ports on the W77E516 can operate in different modes in order to obtain timing similarity as well. Note that the serial port 0 can use Timer 1 or 2 as baud rate generator, but the serial port 1 can only use Timer 1 as baud rate generator. 想問說如何設定Serial 0用timer 2 而Serial 1使用timer1 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) void InitialUart(void) { SCON = 0x50; T2CON=0x30; TH2 = 0xff; TL2 = 0xc4; RCAP2H = 0xff; RCAP2L = 0xc4; TR2 = 1; TI = 1; } void InitialUart1() { SCON1 = 0xd0; //mode 3 PCON ^= 0x80; TMOD |= 0x20; TH1 = 251; TR1 = 1; TI1 = 1; } 補充說明(Supplement): 在mcu一開始initial後,會先執行InitialUart()再執行InitialUart1() 而且的程式一開始只有用到uart0的部份 但是把uart1加進來之後,我外部lcd就不能顯示原本正常的功能了 然後有把資料丟到uart1的sbuf1,我量io腳也沒有輸出 想問一下是哪邊設定有錯… 這個東西我卡快一個禮拜了QQ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.121.175 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1405044824.A.F29.html
文章代碼(AID): #1JlqXOyf (C_and_CPP)