vincer's profilevincer's moodPhotosBlogListsMore ![]() | Help |
|
January 08 xmodem protocolXmodem通信协议: 协议的细节这里不涉及,只说明一下编程注意的事项。数据包有两种:128bytes和1024bytes,tr800模块只支持128bytes。没有采用校验和,而是采用CRC(CCITT)校验。由于RAM有限及通信特性,Uart接收采用FIFO结构。 协议格式: <SOH><blk
#><255-blk #><--128 data bytes--><CRC hi><CRC lo> Flow Diagram SENDER RECEIVER Program Tips: *
When the receiver wishes to <nak>, it should call a "PURGE" subroutine,
to wait for the line to clear. Recall
the sender tosses any characters in its UART buffer immediately upon completing
sending a block, to ensure no glitches were mis-interpreted. * The most common technique is for "PURGE" to call the character receive subroutine, specifying a 1-second timeout,and looping back to PURGE until a timeout occurs. The <nak> is then sent, ensuring the other end will see it.(关键:实现PURGE-字符接收子程序设定1s超时) *
You may wish to add code recommended by John Mahr to your character receive
routine - to set an error flag if the UART shows framing error, or
overrun. This will help catch a few more
glitches - the most common of which is a hit in the high bits of the byte in
two consecutive bytes. The <cksum>
comes out OK since counting in 1-byte produces the same result of adding 80H +
80H as with adding 00H + 00H. key:协议的流程、时间次数控制、出错处理。 TrackbacksThe trackback URL for this entry is: http://wzhvincer.spaces.live.com/blog/cns!32C0531362E6C4C0!209.trak Weblogs that reference this entry
|
|
|