• 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: PIC18F2620/4620 with ZigBee MRF24J40的USART通訊
#2
版主
版主


查看用戶資訊
這樣看程式很難找出這種不固定的 Bug,建議檢查一下 USART 的狀態旗號是不是有發生 Frame , Overflow 等錯誤,或著你可以用示波器配合中斷的 I/O 輸出訊號去判斷中斷程式的動作次數,也可以檢查一下 Timming 的資料與接收到的姿藥是否相符。

發表於: 2008/5/10 11:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC18F2620/4620 with ZigBee MRF24J40的USART通訊
#1
新會員
新會員


查看用戶資訊
小弟正將RS232通訊功能加入ZigBee firmware
我以interrupt routing server方式將RS232加入ZigBee中斷,
但是module在接收PC的RS232資料時
常常會發生掉Byte或接收成亂碼.....
Ex,我要收19 10 38 30 17 卻常收成19 38 30 17或19 30 17或84 82 DA
拜託各位先進能幫幫忙,
以下是我的source code...

#define CLOCK_FREQ 16000000
#define BAUD_RATE 115200

void ConsoleInit(void)
{
#if defined(USART_USE_BRGH_HIGH)
TXSTA = 0x24;
#else
TXSTA = 0x20;
#endif

RCSTA = 0x90;
SPBRG = SPBRG_VAL=0x08;
}

void UARTIntISR(void)
{
#if RXON
{

if(!vUARTIntStatus.UARTIntRxBufferFull && RCIF == 1)
{
vUARTIntStatus.UARTIntRxOverFlow = 0;
vUARTIntStatus.UARTIntRxBufferEmpty = 0;
vUARTIntRxBuffer[vUARTIntRxBufWrPtr] = RCREG;
RCIF = 0;
vUARTIntRxBufDataCnt ++;

if(vUARTIntRxBufDataCnt == RS485_RX_BUFFER_SIZE)
vUARTIntStatus.UARTIntRxBufferFull = 1;
vUARTIntRxBufWrPtr++;

if(vUARTIntRxBufWrPtr == RS485_RX_BUFFER_SIZE)
vUARTIntRxBufWrPtr = 0;
}

}
#endif
}


THX
Earnie

發表於: 2008/5/10 2:02
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... ]

教育訓練中心

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