[討論]大家伙幫忙看下我利用串口中斷讀出來的數(shù)據(jù)對不

我寫的程序比較簡單,初始化376,檢測U盤,打開固定文件,讀文件10000字節(jié),關(guān)閉文件,這幾個(gè)函數(shù)順序執(zhí)行,可是我在用串口中斷方式讀取固定文件10000字節(jié)的時(shí)候,出現(xiàn)的情況如圖所示(由于讀文件是由讀塊組成的,圖中是我打印出的每次讀出的塊得長度),我對我讀出的數(shù)據(jù)有所懷疑,雖然字節(jié)總數(shù)是正確的,但是細(xì)看下,還有讀出來的是0字節(jié)或者2字節(jié),我感覺自己可能讀錯(cuò)了,大家伙幫我分析下吧。

readblock -> s是讀塊函數(shù)返回的字節(jié)數(shù) 最后一行是打印的總數(shù),及其最后一次返回的狀態(tài)碼

PM 03:42:34> readblock -> s = 255 PM 03:42:35> readblock -> s = 0 PM 03:42:35> readblock -> s = 255 PM 03:42:36> readblock -> s = 0 PM 03:42:36> readblock -> s = 2 PM 03:42:38> readblock -> s = 0 PM 03:42:38> readblock -> s = 255 PM 03:42:39> readblock -> s = 0 PM 03:42:39> readblock -> s = 255 PM 03:42:40> readblock -> s = 0 PM 03:42:40> readblock -> s = 2 PM 03:42:41> readblock -> s = 0 PM 03:42:41> readblock -> s = 255 PM 03:42:42> readblock -> s = 0 PM 03:42:42> readblock -> s = 255 PM 03:42:43> readblock -> s = 0 PM 03:42:43> readblock -> s = 2 PM 03:42:45> readblock -> s = 0 PM 03:42:45> readblock -> s = 255 PM 03:42:46> readblock -> s = 0 PM 03:42:46> readblock -> s = 255 PM 03:42:47> readblock -> s = 0 PM 03:42:47> readblock -> s = 2 PM 03:42:48> readblock -> s = 0 PM 03:42:48> readblock -> s = 255 PM 03:42:49> readblock -> s = 0 PM 03:42:49> readblock -> s = 255 PM 03:42:51> readblock -> s = 0 PM 03:42:51> readblock -> s = 2 PM 03:42:52> readblock -> s = 0 PM 03:42:52> readblock -> s = 255 PM 03:42:53> readblock -> s = 0 PM 03:42:53> readblock -> s = 255 PM 03:42:54> readblock -> s = 0 PM 03:42:54> readblock -> s = 2 PM 03:42:55> readblock -> s = 0 PM 03:42:55> readblock -> s = 255 PM 03:42:56> readblock -> s = 0 PM 03:42:57> readblock -> s = 255 PM 03:42:58> readblock -> s = 0 PM 03:42:58> readblock -> s = 2 PM 03:42:59> readblock -> s = 0 PM 03:42:59> readblock -> s = 255 PM 03:43:00> readblock -> s = 0 PM 03:43:00> readblock -> s = 255 PM 03:43:01> readblock -> s = 0 PM 03:43:01> readblock -> s = 2 PM 03:43:02> readblock -> s = 0 PM 03:43:02> readblock -> s = 255 PM 03:43:03> readblock -> s = 0 PM 03:43:03> readblock -> s = 255 PM 03:43:04> readblock -> s = 0 PM 03:43:04> readblock -> s = 2 PM 03:43:05> readblock -> s = 0 PM 03:43:06> readblock -> s = 255 PM 03:43:07> readblock -> s = 0 PM 03:43:07> readblock -> s = 255 PM 03:43:08> readblock -> s = 0 PM 03:43:08> readblock -> s = 2 PM 03:43:09> readblock -> s = 0 PM 03:43:09> readblock -> s = 255 PM 03:43:10> readblock -> s = 0 PM 03:43:10> readblock -> s = 255 PM 03:43:11> readblock -> s = 0 PM 03:43:11> readblock -> s = 2 PM 03:43:12> readblock -> s = 0 PM 03:43:12> readblock -> s = 255 PM 03:43:13> readblock -> s = 0 PM 03:43:13> readblock -> s = 255 PM 03:43:14> readblock -> s = 0 PM 03:43:14> readblock -> s = 2 PM 03:43:16> readblock -> s = 0 PM 03:43:16> readblock -> s = 255 PM 03:43:17> readblock -> s = 0 PM 03:43:17> readblock -> s = 255 PM 03:43:18> readblock -> s = 0 PM 03:43:18> readblock -> s = 2 PM 03:43:19> readblock -> s = 0 PM 03:43:19> readblock -> s = 255 PM 03:43:20> readblock -> s = 0 PM 03:43:20> readblock -> s = 255 PM 03:43:21> readblock -> s = 0 PM 03:43:21> readblock -> s = 2 PM 03:43:22> readblock -> s = 0 PM 03:43:22> readblock -> s = 255 PM 03:43:23> readblock -> s = 0 PM 03:43:23> readblock -> s = 255 PM 03:43:25> readblock -> s = 0 PM 03:43:25> readblock -> s = 2 PM 03:43:26> readblock -> s = 0 PM 03:43:26> readblock -> s = 255 PM 03:43:27> readblock -> s = 0 PM 03:43:27> readblock -> s = 255 PM 03:43:28> readblock -> s = 0 PM 03:43:28> readblock -> s = 2 PM 03:43:29> readblock -> s = 0 PM 03:43:29> readblock -> s = 255 PM 03:43:31> readblock -> s = 0 PM 03:43:31> readblock -> s = 255 PM 03:43:32> readblock -> s = 0 PM 03:43:32> readblock -> s = 2 PM 03:43:33> readblock -> s = 0 PM 03:43:33> readblock -> s = 255 PM 03:43:34> readblock -> s = 0 PM 03:43:34> readblock -> s = 255 PM 03:43:35> readblock -> s = 0 PM 03:43:35> readblock -> s = 2 PM 03:43:36> readblock -> s = 0 PM 03:43:36> readblock -> s = 255 PM 03:43:37> readblock -> s = 0 PM 03:43:38> readblock -> s = 255 PM 03:43:39> readblock -> s = 0 PM 03:43:39> readblock -> s = 2 PM 03:43:40> readblock -> s = 0 PM 03:43:40> readblock -> s = 255 PM 03:43:41> readblock -> s = 0 PM 03:43:41> readblock -> s = 17 PM 03:43:42> readblock -> s = 0 PM 03:43:42> ch376byteread() 0x14 <10000>


熱門產(chǎn)品 : USB3.0 HUB控制器:CH634

從你打印的信息上面看 255,2都是正確的,因?yàn)镃H376從U盤讀寫文件的時(shí)候 是分扇區(qū)的(512字節(jié)),但是字節(jié)方式單次只允許使用255字節(jié),所以對CH376來說一個(gè)扇區(qū)需要分3次讀寫完成,即255+255+2,然后才可以對第二個(gè)扇區(qū)進(jìn)行操作。 程序中打印的0字節(jié) 是從哪邊來的? 需要你查查程序。


_study_兄 我仔細(xì)檢查程序了,也不確定怎么著出來的0,我也相當(dāng)納悶~~~ 還有一個(gè)問題,請幫忙解決,我重新發(fā)一個(gè)帖子


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频