ch376s 串口寫數(shù)據(jù)累加達(dá)到512時數(shù)據(jù)不能寫入

麻煩問一下 ? 我通過串口向u盤里寫數(shù)據(jù),每次寫完后自動換行,但累計到512時不能寫完整,下次在寫數(shù)據(jù)時又正常,但再次累計到512時又出現(xiàn)寫數(shù)據(jù)不完整現(xiàn)象,請問是什么問題 ? 怎樣能解決這個問題?

111111.png

spacer.gif


執(zhí)行WR_REQ_DATA返回的第一個數(shù)據(jù)位可以寫的長度,是要根據(jù)這個值來決定后續(xù)寫多少字節(jié)。


如果用串口和ch376通訊的話是接收write的中斷返回值在決定后續(xù)寫多少個字節(jié)嗎?


不是中斷返回值,是執(zhí)行WR_REQ_DATA返回的第一個字節(jié)表示的數(shù)據(jù)長度。


jie? 老師好:

我也遇到同樣的問題,采用CH376芯片,串口通信方式;要把大容量的存儲器里面的數(shù)據(jù)導(dǎo)出到U盤(平時不插U盤,存儲一段時間后用U盤導(dǎo)出來)。? 28號上午電話溝通可能更好。

?

?

寫TXT文件,23行數(shù)據(jù)出現(xiàn)故障,實際有效數(shù)據(jù)為 31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?20?4F?4E?0D?0A。 合計23個字符;則22*23=506字符。

?

導(dǎo)出到U盤的22行數(shù)據(jù)。這是正確的。

圖片.png

?

----- 串口監(jiān)測到的格式, 下面寫TXT文件是22行-,最后一行是關(guān)閉文件命令----

?

57?AB?01?57?AB?15?06?57?AB?30?57?AB?22?57?AB?31?57?AB?22?57?AB?2F?5C?34?33?32?31?39?37?2D?31?2E?43?53?56?00?57?AB?34?57?AB?22?57?AB2F?5C?34?33?32?31?39?37?2D?31?2E?43?53?56?00?57?AB?32?57?AB?22?

?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?38?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?38?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?38?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?39?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?39?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?30?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?30?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?30?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?31?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?31?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?31?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?32?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?32?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?32?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?33?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?33?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?33?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?34?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?34?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?36?01?57?AB?22?

?

?

?

?

-----? 下面寫TXT文件是23行,在最后一個?57?AB?22命令,應(yīng)該是沒有得到返回數(shù)據(jù)-----

?

57?AB?01?57?AB?15?06?57?AB?30?57?AB?22?57?AB?31?57?AB?22?57?AB?2F?5C?34?33?32?31?39?38?2D?31?2E?43?53?56?00?57?AB?34?57?AB?22?57?AB?2F?5C?34?33?32?31?39?38?2D?31?2E?43?53?56?00?57?AB?32?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?37?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?38?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?38?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?38?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?39?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?34?39?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?30?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?30?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?30?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?31?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?31?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?31?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?32?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?32?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?32?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?33?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?33?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?33?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?34?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?34?2C?4F?46?46?0D?0A?57?AB?3D?57?AB?22?

57?AB?3C?17?00?57?AB?22?57?AB?2D?31?39?2D?31?32?2D?32?37?2C?31?37?3A?30?37?3A?35?34?2C?20?4F?4E?0D?0A?57?AB?3D?57?AB?22

?

?

?



57 ab 22命令應(yīng)該不會沒有返回的。整體流程是對的,但是因為看不到接收的值與中斷,所以需要提醒的是,命令里面查命令中斷狀態(tài)的,57 ab 22執(zhí)行之前,INT引腳必須為低電平,即產(chǎn)生了中斷。


老師好:

串口方式 ,單片機(jī)向U盤寫txt文件。
采用例子程序
中間有加延時 在 57 AB 31 前后也有加延時。 寫模式05返回錯誤代碼。
如果這個問題我這邊處理不好, 那么就用模式06,是否可以?



xWriteCH376Data( 0x05 );監(jiān)測到的串口字符:
57 AB 06 65 57 AB 15 05 57 AB 22 57 AB 30 57 AB 22 57 AB 31 57 AB 22
返回字符
9A 51 15 15 14 14 20 20
----------
xWriteCH376Data( 0x06 );監(jiān)測到的串口字符:
57 AB 06 65 57 AB 15 06 57 AB 22 57 AB 30 57 AB 22 57 AB 31 57 AB 22
9A 51 15 15 14 14 14 14
返回字符





可以。這種情況下推薦用模式6,模式5會存在部分U盤不兼容的情況。


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

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