我寫的程序比較簡單,初始化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>