The invention discloses an interface automatic switching device, which comprises a host interface, an interface switching module, a level detection switching control module, an external interface and at least two external interface communication modules. An interface automatic switching method is also disclosed. By detecting the signal voltage value of the external interface and judging whether the signal voltage value is zero, further judging whether the signal voltage value is within the preset voltage threshold range, and finally judging the logic level of the external interface, the type of the external interface can be judged. According to the type of external interface, switch to the corresponding external interface communication module, so that the external interface communicates with the host interface through the corresponding external interface communication module, and realize the compatible communication of the interface. The interface automatic switching device of the invention has the advantages of accurate judgment of interface type, good compatibility, wide applicability, low cost of only one host interface, and good economic and social benefits.
【技术实现步骤摘要】
一种接口自动切换装置及方法
本专利技术涉及串口通信领域,特别涉及一种接口自动切换装置及方法。
技术介绍
在工业领域上,大多数产品具备对外通信的RS232接口或RS485接口。在需要通讯时,尤其是在现场有多台设备需要互相通信的情况下,外部设备往往有多个不同种类和用途的接口,而当前的主机设备要么是RS232接口,要么是RS485接口,不是完全兼容模式,用户需要在不同的接口间频繁的进行切换,费时费力。若不小心切换错接口,接口类型不一致导致设备不能正常通信,还有可能会烧毁接口。目前的解决方法有:通过单串口扩展或多串口的硬件,在单板上增加多个接口;在单个接口中,定义多个接口线;通过处理器接受命令或硬件跳线帽切换接口。但是,现有技术仍存在一定缺陷。若通过增加串口插座来扩充接口,会占用多余的面板空间;若定义多个接口线,即不再遵循国际标准,维护起来很不方便,用户很难区分该用哪个串口线连接;若通过处理器或硬件跳线帽切换接口,还需要进行人工配置和切换,程序繁琐。
技术实现思路
本专利技术旨在至少在一定程度上解决相关技术中的技术问题之一。为此,本专利技术的一个目的是提供一种接口自动切换装置及方法,兼容性好、适用性广且成本低。本专利技术所采用的技术方案是:一种接口自动切换装置,包括主机接口、接口切换模块、电平检测切换控制模块、外部接口以及至少两种外部接口通信模块;所述电平检测切换控制模块用于检测所述外部接口的信号电压值以判断所述外部接口的类型,并根据所述外部接口的类型控制所述接口切换模块切换至相应的外部接口通信模块;所述主机接口与所述接口切换模块连接,所述接口切换模块与所述外部接口通 ...
【技术保护点】
1.一种接口自动切换装置,其特征在于,包括主机接口、接口切换模块、电平检测切换控制模块、外部接口以及至少两种外部接口通信模块;所述电平检测切换控制模块用于检测所述外部接口的信号电压值以判断所述外部接口的类型,并根据所述外部接口的类型控制所述接口切换模块切换至相应的外部接口通信模块;所述主机接口与所述接口切换模块连接,所述接口切换模块与所述外部接口通信模块连接,所述外部接口通信模块与所述电平检测切换控制模块连接,所述电平检测切换控制模块与所述外部接口连接,所述电平检测切换控制模块的输出端与接口切换模块的输入端连接。
【技术特征摘要】
1.一种接口自动切换装置,其特征在于,包括主机接口、接口切换模块、电平检测切换控制模块、外部接口以及至少两种外部接口通信模块;所述电平检测切换控制模块用于检测所述外部接口的信号电压值以判断所述外部接口的类型,并根据所述外部接口的类型控制所述接口切换模块切换至相应的外部接口通信模块;所述主机接口与所述接口切换模块连接,所述接口切换模块与所述外部接口通信模块连接,所述外部接口通信模块与所述电平检测切换控制模块连接,所述电平检测切换控制模块与所述外部接口连接,所述电平检测切换控制模块的输出端与接口切换模块的输入端连接。2.根据权利要求1所述的一种接口自动切换装置,其特征在于,所述外部接口包括RS485接口和RS232接口。3.根据权利要求1所述的一种接口自动切换装置,其特征在于,所述外部接口通信模块包括RS485通信模块和RS232通信模块。4.根据权利要求1至3任一项所述的...
【专利技术属性】
技术研发人员:刘康德,胡美峰,
申请(专利权)人:深圳市宏电技术股份有限公司,
类型:发明
国别省市:广东,44
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。