瀏覽單個文章
geminiz
Major Member
 
geminiz的大頭照
 

加入日期: Jul 2001
您的住址: 西湖國小
文章: 125
引用:
作者booger
還是不懂哪裡錯了


void uart_read_char(char *ch){
...
*ch=SBUF;
uart_write_char(*ch);
}


"*ch=SBUF"
ch is pointing to SBUF which I assume is a memory-mapped register mapped to the output of the UART input buffer. Once you read it the buffer pushes out the valid data, so the output now is the next item in the buffer (invalid data?)

uart_write_char(*ch) then obviously ends up writing the wrong value.


我很久沒寫embedded c了..好像是這樣
舊 2009-08-01, 12:34 PM #8
回應時引用此文章
geminiz離線中