网上搜索一番,主要有VSPM和VSPD,前者是在WIN7前使用稳定,后者在WIN7中使用稳定。我的电脑是WIN7_64的,所以选用了VSPD7。于是下了个VSPD7.1的安装包,安装完成后,利用软件界面就可以创建相应的虚拟COM口了。具体如何使用,可以参看这篇文章《虚拟串口VSPD的使用方法》。记住一点,VSPD的COM通信是成对的,一个用于接收数据,一个用于发送数据。
有了虚拟COM口后,就是写一个DEMO进行测试。具体可以参看这篇文件章《win7系统下用vspd软件进行串口编程实例》。
当虚拟COM口可以实现通讯之后,就想着我们的程序是依赖于这个VSPD安装包的,那如果我们是否可以不依赖呢?有两种方案:
方案一:自己写一个虚拟COM的驱动,然后里面实现。有兴趣的可以参看该文《开发虚拟串口驱动程序》。
方案二:VSPD安装包是一个安装程序,为了实现虚拟COM,必然会有相应的驱动。如果我们能够找到这个驱动并安装,之后用相应的接口来调用,或是可行。
方案一想了,但自认还没有这个能耐,于是果断放弃,退而选方案二。那么方案二要实现,首先要解决的问题是接口的调用,因为驱动程序即使不能做到自己安装,但还是可以通过VSPD安装包的安装来解决,那么VSPD中有没有提供这样的接口呢?
查看VSPD的用户手册(User Manual),里面果然有相应的接口(在Using serial port driver in your program下的Functions中),于是有C#写了相应的调用,下面是代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Add
using System.Runtime.InteropServices;
namespace Anser.U2Simulator.Model
{
public class VSPD
{
//[DllImport("VSPDCTL.dll", EntryPoint = "CreatePair", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]
//public static extern bool CreatePair(byte[] comName1, byte[] comName2);
/// summary
/// CreatePair creates a pair of virtual serial ports with given names.
/// It accepts two null-terminated strings determining which ports should be created as input.
/// For example, "COM5" and "COM6".
/// /summary
/// param name="comName1"A null-terminated string that defines the name of the first port in a pair/param
/// param name="comName2"A null-terminated string that defines the name of the second port in a pair/param
/// returnsCreatePair returns TRUE if virtual serial pair was created successfully and FALSE otherwise/returns
[DllImport("vspdctl.dll")]
public static extern bool CreatePair(string comName1, string comName2);
/// summary
/// DeletePair deletes a pair of virtual serial ports with a given name.
/// As input it takes name of any virtual serial port in a pair.
/// For example, if you want to remove pair named "COM5"-"COM6",
/// you can pass either "COM5" or "COM6" as argument to DeletePair function.
/// /summary
/// param name="comName" A null-terminated string that defines one of the two port names in a pair you want to delete /param
/// returnsDeletePair returns TRUE if virtual serial pair was successfully deleted and FALSE otherwise/returns
[DllImport("vspdctl.dll")]
public static extern bool DeletePair(string comName);
/// summary
/// DeleteAll deletes all virtual serial ports currently present in a system. It accepts no arguments at input.
/// /summary
/// returnsDeleteAll returns TRUE if all virtual serial pairs were successfully deleted and FALSE otherwise/returns
[DllImport("vspdctl.dll")]
public static extern bool DeleteAll();
[DllImport("vspdctl.dll")]
public static extern bool SetStrictBaudrateName(string comName, bool isStrictBaudrate);
[DllImport("vspdctl.dll")]
public static extern bool SetStrictBaudrateHandle(IntPtr handle, bool isStrictBaudrate);
/// summary
/// SetStrictBaudrate enables/disables full baudrate emulation,
/// needs the name of one of the paired virtual ports and boolean parameter
/// that defines if strict baudrate emulation should be enabled or not.
/// /summary
/// param name="comName"A null-terminated string that defines one of the two port names in a pair /param
/// param name="isStrictBaudrate"A boolean variable which should be TRUE
/// if you want to enable strict baudrate emulation and FALSE if you want to disable it/param
/// returnsSetStrictBaudrate returns TRUE if strict baudrate emulation was successfully enabled and FALSE otherwise/returns
[DllImport("vspdctl.dll")]
public static extern bool SetStrictBaudrate(string comName, bool isStrictBaudrate);
/// summary
/// SetBreak enables/disables line break emulation in virtual serial ports.
/// /summary
/// param name="comName"A null-terminated string that defines one of the two port names in a pair/param
/// param name="isBreak" A boolean variable should be TRUE if you want to emulate connection break and FALSE if you want to re-establish it /param
/// returnsSetBreak returns TRUE if line break emulation was successfully enabled and FALSE otherwise./returns
[DllImport("vspdctl.dll")]
public static extern bool SetBreak(string comName, bool isBreak);
/// summary
/// QueryBus: QueryBus sends request to get complete information from the virtual serial bus installed by VSPD.
/// /summary
/// param name="inBufferPtr"A pointer to VSBUS_QUERY or VSBUS_QUERY_EX structures.
/// If you want to get information about all current virtual serial ports
/// then use VSBUS_QUERY structure
/// and if you want to get extended information
/// about single virtual serial pair then use VSBUS_QUERY_EX structure./param
/// param name="inBufferSize"/param
/// param name="outBufferPtr"/param
/// param name="outBufferSize"A pointer to either PORT_INFORMATION or PORT_INFORMATION_EX structures list.
/// If you have used VSBUS_QUERY than you should get PORT_INFORMATION list
/// and if you used VSBUS_QUERY_EX then you should get PORT_INFORMATION_EX./param
/// returns/returns
[DllImport("vspdctl.dll")]
public static extern bool QueryBus(IntPtr inBufferPtr, long inBufferSize, IntPtr outBufferPtr, long outBufferSize);
/// summary
/// SetWiring sets custom signal lines wiring (pinout).
/// /summary
/// param name="comName"A null-terminated string that defines one of the two port names in a pair /param
/// param name="bufferPtr"A pointer to VSERIAL_WIRING structure /param
/// param name="bufferSize"Size of Buffer parameter in bytes /param
/// returnsSetWiring returns TRUE if signal lines wiring was created successfully and FALSE otherwise/returns
[DllImport("vspdctl.dll")]
public static extern bool SetWiring(string comName, IntPtr bufferPtr, long bufferSize);
/// summary
/// SetAccessList restricts access to created virtual serial ports for various applications.
/// /summary
/// param name="comName" A null-terminated string that defines one of the two port names in a pair /param
/// param name="bufferPtr"A pointer to PROGRAM_ACCESS array /param
/// param name="bufferSize"Size of Buffer parameter in bytes /param
/// returnsSetAccessList returns TRUE if port access list was created successfully and FALSE otherwise/returns
[DllImport("vspdctl.dll")]
public static extern bool SetAccessList(string comName, IntPtr bufferPtr, long bufferSize);
//[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi,Pack=1)]
public struct _VSBUS_QUERY
{
/// summary
/// VSBUS_QUERY structure size
/// /summary
ulong Size;
/// summary
/// Has QUERYTYPE_PORTS = 1 value. Can be extended in the future.
/// /summary
ulong QueryType;
};
private const int MAX_PORTNAME_LEN = 6;
public struct _VSBUS_QUERY_EX
{
/// summary
/// VSBUS_QUERY_EX structure size
/// /summary
ulong Size;
/// summary
/// 1:query all virtual ports.
/// 2:query particular virtual pair
/// 3:query particular virtual pair; name of the application, which created the port, is returned.
/// /summary
ulong QueryType;
/// summary
/// Unicode name of any port in the pair you want to delete.
/// For instance, if "COM6-COM7" virtual serial ports pair was created,
/// then to remove it, PortName's value should be COM6 or COM7.
/// /summary
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PORTNAME_LEN)]
string PortName;
}
}
}
你是想检测串口与PLC的数据还是,用串口调试工具与PLC通讯,如果是检测串口与PLC的数据,那就需要串口检测软件,如果是用串口调试工具与PLC通讯,那就需要知道pLC的通讯协议
CEIWEI 已经发布了最新的CommMonitor串口监控11.0软件,可以试试, 不要下载破解版,不稳定,可能会有病毒木马。
11.0 更新日志
1. 支持会员手机号注册登录,不在限制使用电脑,任意电脑帐号登录,详情请查看“会员管理”,会员帐号功能适用于CommMonitor串口监控、USBMonitor监控、CommTone串口调试、虚拟串口等所有CEIWEI软件都可以在任意电脑上登录使用;但同一帐号,同一时间在线只能一台电脑。
2. 支持监控正在使用中(已打开)的串口;
3. 支持第一次管理员权限安装后,非管理员权限运行程序;
4. 支持中文 Unicode 字符串解码;
5. SDK 支持阻止串行端口写入数据包,并可以将写入的数据包拦截后再修改,然后再写入到串行端口,或是你主动写入任意的数据包,从而改变串行端口数据的输出;
6. SDK 支持 OCX/DLL 调用方式,详情参看 MFC-DLL/DelphiDLL Demo 示例。
需要知道协议的格式,最好找一个能够解析协议数据的软件,例如格西烽火软件等,在连续测试中,可以减少计算其中特定数据的时间。
破除梯控方法如下。
到淘宝上买一个M1卡全扇区加密破解器。推荐型号。proxmark3淘宝上一搜索一大把,然后再买好UID或者FUID或者。CUID复制卡。准备好母卡,确保没有在梯控或者门禁上刷过,或者母卡在设备上刷过最后一次,如果有复制过卡片刷过母卡就无效。
母卡在设备上刷过最后一次,母卡在设备上刷过最后一次,重要的事情多说两遍。打开破解软件,选择好串口,选择好串口后选择一键自动解析。
相关知识:
电梯是人们在楼宇中最主要的搭乘工具,但并不希望任何人都可以任意通过电梯进入。通过梯控系统管理电梯运行,便于管理电梯乘坐权限。可将闲杂人员阻止在电梯之外,提高了物业的安全等级。控制电梯外的电梯召唤按钮电梯门口安装读卡器,连接电梯控制器。
当用户刷卡有效时,才能启动电梯召唤按钮。此种控制模式较为简单,无法限制用户所能到达的楼层。控制电梯轿厢内的楼层按键必须刷有效卡后,对应楼层按键才能使用,否则任意楼层按键均处于无效状态。
移动的电视机顶盒到期后可以刷机成别的盒子吗 只要你的移动机顶盒的型号已经有了破解的软件,就可以刷成普通的可以安装第三方软件的盒子。但是如果你的盒子型号太偏的话,没有大神出刷机固件的话,还是不能刷成功的...
虎牙直播除了充值 有没有其他得免费礼物的方法?不要瞎说 知情者告诉一声 拜托啦! 观看时间久的话是可以领取宝箱的 宝箱里有数量不定的虎粮和银元宝的破解虎牙免费刷礼物工具 有这种软件,就是不容易找到,有...
破解内购,锁定三网,去除发短信功能,建议开飞行模式直接购买即可成功,安全又快捷。是什么意思? 飞行模式又叫航空模式,是在乘坐飞机时必须关掉手机,以免手机信号的发射和接受对飞机飞行造成影响,有某些手机里...
黑客帝国攻略(最好有图) 这次继《黑客帝国2》的电影推出后,游戏也立马发行,在电影中不清楚的情节,在游戏中会给大家一个交待,而且这次原班电影人马出演游戏中的过场真人动画达到1个多小时(图1:原班电影人...
放置奇兵九游版下载地址 1、剑御江湖九游版特色丰富多彩的剧情任务等你挑战;各具特色职业技能释放华丽无比;真实玩家竞技比拼实力秀操作。放置奇兵有几个版本如何下载 1、玩家在游戏中能不断的完成更多全新的体...
哪些破解游戏软件可以在线玩贴吧 葫芦侠是一款可以玩破解版游戏的软件。葫芦侠辅助工具,是一款针对手机游戏的(单机游戏)应用程序,它可以帮助玩家减少游戏中的时间。咪噜游戏、巴兔游戏。巴兔破解版游戏盒子是一...