比如com口来的数据是
$3a瑂*
转换为二进制:
24 06 33 07 05 01 01 61 17 08 AC 73 1A 00
我如何能将这些数据读取出来?读取出来后是字符串还是数组?
另外还涉及到的问题就是数据写入,如何将数据打包再写入?
还有可能就是碰到多个串口如何自动变化com口?
(波特率2400)
------解决方案--------------------
你这个问题主要是串口通讯的问题,帮你找了两个网址,自己去看下吧
http://bbs.lzjtu.edu.cn/bbsanc.php?path=%2Fgroups%2Fsci.faq%2FComputer%2FProgramOld%2FDatabase%2F3%2F2%2F1%2F52.txt
http://topic.csdn.net/u/20071011/18/fdd22298-4a23-40cc-9817-03056f725991.html?1451975628
------解决方案--------------------
- C/C++ code
type commprop from structure integer wPacketLength integer wPacketVersion long dwServiceMask long dwReserved1 long dwMaxTxQueue long dwMaxRxQueue long dwMaxBaud long dwProvSubType long dwProvCapabilities long dwSettableParams long dwSettableBaud integer wSettableData integer wSettableStopParity long dwCurrentTxQueue long dwCurrentRxQueue long dwProvSpec1 long dwProvSpec2 character wcProvChar[1]end typetype commtimeouts from structure long ReadIntervalTimeout long ReadTotalTimeoutMultiplier long ReadTotalTimeoutConstant long WriteTotalTimeoutMultiplier long WriteTotalTimeoutConstantend typetype dcb from structure long DCBlength long RaudRate long fBinary long fParity long fOutxCtsFlow long fOutxDsrFlow long fDtrControl long fDsrSensitivity long fTXContinueOnXoff long fOutX long fInX long fErrorChar long fNull long fRtsControl long fAbortOnError long fDummy2 integer wReserved integer XonLim integer XoffLim character ByteSize character Parity character StopBits character XonChar character XoffChar character ErrorChar character EofChar character EvtChar character wReserved1end type