如何使用RS232将数据块写入设备 [英] How do I write blocks of data to device using RS232

查看:166
本文介绍了如何使用RS232将数据块写入设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用RS232实现从主机(PC)到目标设备的固件下载。我使用natice C#串口包装器来初始连接到设备。我对C#语言很陌生。起始地址,文件中的块数在二进制文件中都可用。我使用以下方法从文件中获取字节



I am trying to implement the Firmware Download from host(PC) to target device using RS232. I am using the natice C# serial port wrapper for the initial connection to the device. I am pretty much new to C# language. Start address, number of chunks in the file is all available in the binary file. I used the below approach to get the bytes from the file

FileData = System.IO.File.ReadAllBytes(file_path);

         nChunks  = BitConverter.ToUInt32(FileData, 8);
         nChunks = FileData.ElementAt(8);

         StartAddress= BitConverter.ToUInt32(FileData, 12);





但我不确定如何将固件二进制块写入目标设备位置寻址并启动设备。在这方面可以帮助一些人



But I am not sure of the way to write blocks of the firmware binary to the target device location starting from the address and start the device. Can some one help in this regard

推荐答案

请看这里: https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.writeline%28v=vs.110 %29.aspx [ ^ ]


这篇关于如何使用RS232将数据块写入设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆