• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: 卡住了~~RS232傳輸問題~~
#4
版主
版主


查看用戶資訊
如果你不了解 Master 大哥的意思,建議你用最簡單的傳字串方式,因為字串最後一定是 NULL (0x00) 來做結尾,因為你是使用PIC18F 的元件,所以C18 就已經提供了一些函數可供使用。只要 VB 收到 0x00 就代表資料結束了。

itoa( ), ltoa( ) 將 int 或 long 的數值(hex) 轉成10進制的ASCII code 字串。
putsUART( ) 將字串自UART 送出。

有關使用方式請參考 C18 clib 與 Peripheral Libraries 的說明。

發表於: 2008/10/22 8:36
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 卡住了~~RS232傳輸問題~~
#3
新會員
新會員


查看用戶資訊
救世主感謝您的解答

不過小弟還是有些疑問
您所說的解決方法是寫在 microchip 程式內就要把資料做處理還是說到vb在處理

我現在傳輸部分的程式:

<Header>


temp_tx3 += 48; //將temp_tx3 轉成ASCII
WriteUSART(temp_tx3); //傳出temp_tx3資料
while(BusyUSART());
temp_tx2 += 48; //將temp_tx2 轉成ASCII
WriteUSART(temp_tx2); //傳出temp_tx2資料
while(BusyUSART());
temp_tx1 += 48; //將temp_tx1 轉成ASCII
WriteUSART(temp_tx1); //傳出temp_tx1資料
while(BusyUSART());
temp_tx0 += 48; //將temp_tx0 轉成ASCII
WriteUSART(temp_tx0); //傳出temp_tx0資料
while(BusyUSART());

<END> <------- 加在這邊傳出去結果也是一個一個字串而不是 一整個data

因此想懇請 救世主 解救小弟一下

四個位元分別轉成 ascii的方式傳出 我不太了解 您所說的
<Header><Data0~N><END> 是怎麼處理

以上面的程式來看,RS232傳出去的值都是各個分離的值
小弟 我也試著在前面加入ASCII 碼 裡面的 檔頭&結束字串
但是還是會跟之前的問題一樣

不知道 救世主大人 是否能在幫小弟解個疑惑

發表於: 2008/10/21 16:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 卡住了~~RS232傳輸問題~~
#2
資深會員
資深會員


查看用戶資訊
將資料用封包方式傳送。如

<Header><Data0~N><END> 比如Header = 0xFF, END = 0xFE, Ctr = 0xFD
Ctr是幹嘛的?就是當資料出現上面上個數值時,多插入一個Ctr辨識告知VB程式這是資料,不是封包的頭尾。

透過這種方式檢查加上DATA部分再作個Checksum,資料就不容易出錯了。

發表於: 2008/10/20 19:42
不要問我哪裡來,我只是個流浪天涯的工程師
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


卡住了~~RS232傳輸問題~~
#1
新會員
新會員


查看用戶資訊
小弟我是PIC新手 目前使用APP025為實驗板

目的:將類比訊號 透過 APP025 的RS232傳輸到PC

電腦端: 使用VB寫了 RS232的接收程式

目前問題:PC端 將APP025傳出的數值存入筆記本檔案 但是會
產生斷點問題

原本傳出為 0001
但接收端會收成 00
01

這樣判斷起來 就變成兩個數字了

不知道這個方法有沒有人遇過,可以提供小弟一些解決的方法


PS:我用TIMER1當作AD 與 RS232傳輸的時脈


懇請高人幫忙解答一下

發表於: 2008/10/20 17:53
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







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.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------