• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






如何順利接收N筆資料
#1
高級會員
高級會員


查看用戶資訊
當傳送端傳送兩筆資料

而接收端部分 我想把第一筆資料存在A暫存器 把第二筆資料存在B暫存器
MOVF    RCREG,W
MOVWF    A
MOVF    RCREG
,W
MOVWF    B

結果會變成 A B 兩暫存器 都存到第二筆資料

如果在存完第一筆資料後 呼叫一個延遲 然後再存第二筆資料 就會正確
MOVF    RCREG,W
MOVWF    A
CALL        DELAY
MOVF    RCREG
,W
MOVWF    B

如果要存N筆 不就要呼叫N-1筆的延遲

這樣不就很麻煩

可否有解決方法 謝謝

發表於: 2006/3/22 23:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 如何順利接收N筆資料
#2
資深會員
資深會員


查看用戶資訊
usart嗎?!
開啟接收中斷
中断發生後把資料丟到 FSR
然後FSR指標+1
離開中斷繼續做自己的事
一直下去就可以連續接收了

建議不要用延遲的
雖然好寫但是浪費時間
接收越多筆浪費越多時間
程式都掛在那個迴圈裡等待
沒意義...

發表於: 2006/3/23 0:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 如何順利接收N筆資料
#3
高級會員
高級會員


查看用戶資訊
感謝前面的回答

在請教一下 FSR 要怎麼用

從來沒用過 不知道怎麼下手

謝謝

發表於: 2006/3/23 0:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 如何順利接收N筆資料
#4
資深會員
資深會員


查看用戶資訊
#DEFINE  DATE_00  EQU   11A0H
#DEFINE  DATE_01  EQU   11A1H

          
MOVLW   11H                ;設定存取位址
          MOVWF   FSR1H              
;
          
MOVLW   0A0H               ;
          
MOVWF   FSR1L              ;

中斷的副程式
          MOVFF    RCREG
,INDF1    ;要存入的值放入虛擬暫存器
          INCF       FSR1L      
或是
          LFSR       1
,DATE_00      ;設定存取位址
中斷
          MOVFF    RCREG
,INDF1    ;要存入的值放入虛擬暫存器
          INCF       FSR1L

FSRxH跟FSRxL指向變數位址
把值丟到虛擬暫存器 INDFx
就可以存到變數中

發表於: 2006/3/23 8:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 如何順利接收N筆資料
#5
高級會員
高級會員


查看用戶資訊
翻了書 和 搜尋之前的相關討論 大概知道如何用FSR

再這裡有一個奇怪問題想再問一下

如果要重複使用相同位址的暫存器 要怎麼寫??

例如 一次傳送八筆資料存到FSR所指定的位址(0X20 到 0X27) 而下一次再傳送八筆資料時 希望再存在(0X20 到 0X27) 不知道要怎麼寫 請教各位高手一下 謝謝

附上 中斷儲存程式
MOVF       RCREG,W
MOVWF      INDF
INCF       FSR
,F

發表於: 2006/3/23 8:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 如何順利接收N筆資料
#6
版主
版主


查看用戶資訊
剛開始時 FSR=0x20 收到一筆資料後 FSR+1 後去檢查 FSR 是否 >= 0x28 , 若是則 FSR指標重新設為 0x20,一直循環下去。

發表於: 2006/3/23 9:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 如何順利接收N筆資料
#7
高級會員
高級會員


查看用戶資訊
謝謝 jubel 和 版主 給的回答


發表於: 2006/3/23 13:11
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... ]

教育訓練中心

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