Re: i/o模擬uart 傳接收
|
||||
---|---|---|---|---|
中級會員
|
版主以及各位大大 是否有相關書籍是 i/o模擬RS232傳接收的範例程式或者是觀念 小弟在google找了很久 都沒找到ㄧ本書籍是符合小弟的需求 麻煩各位大大以及版主
發表於: 2008/11/28 11:31
|
|||
|
Re: i/o模擬uart 傳接收
|
||||
---|---|---|---|---|
中級會員
|
你好!
突然發現你的程式很明顯少了 start bit 的部分. 建議你加上 start bit 在實際的傳送資料前面, 再試一下吧!
#include <p18f4620.h>
發表於: 2008/11/25 23:34
|
|||
|
Re: i/o模擬uart 傳接收
|
||||
---|---|---|---|---|
中級會員
|
#include <p18f4620.h>
#define tx PORTCbits.RC3 void Delay(unsigned long int t) { unsigned long int i; for(i=0;i<=t;i++); } void main(void) { unsigned int SD,cnt,i=0; TRISC=0x02; tx = 1; while(1) { SD=0x55; for(cnt=0;cnt<8;cnt++) { tx=SD%2; SD=SD/2; Delay(1); Nop();Nop();Nop();Nop(); } tx = 1; Delay(1000); } } 這各程式是i/o模擬rs-232的傳送 我送0x55 我測試這各程式它的包率是9600 我適用示波器去測量的 可是為什麼我用vb接收的值並不是收到55的訊號而是d5的訊號 麻煩版主以及各位大大 謝謝
發表於: 2008/11/25 21:35
|
|||
|
Re: i/o模擬uart 傳接收
|
||||
---|---|---|---|---|
版主
|
http://checko.blogspot.com/2005/09/ua ... -hardware-1-software.html
http://supp.iar.com/Support/?note=88469 一般 Software UART 發比較簡單,即時的接收比較要考慮。接收我會使用 INT0 做 Low 的中斷觸發後再啟動 Timer 來做計時的接收。而且使用軟體接收最好 Byte 與 Byte 之間有比個 time 的間隔會比較好。 要是不很清楚打 0800-717-718 討論,用寫的比較難以說明其作法。
發表於: 2008/11/25 14:19
|
|||
|
i/o模擬uart 傳接收
|
||||
---|---|---|---|---|
中級會員
|
請問版主以及各位大大 小弟我最近在測試i/o模擬uart 傳接收 到現在還不知道程式架構如何著手 是否有程式範例 包率9600
單晶片是用PIC18F4620 我已經把那ㄧ組usart拿去用藍芽晶片 我還需要另外ㄧ組usart的功能 所以我需要用i/o模擬的方式再模擬一組usart的傳接收 我是用c語言寫的 麻煩各位大大 小弟我感激不盡 謝謝
發表於: 2008/11/25 11:30
|
|||
|