连接继电器到PC [英] Interfacing Relay to PC

查看:75
本文介绍了连接继电器到PC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用中继和c#代码控制调制解调器. C#代码应能够在预设时间打开和关闭调制解调器(继电器应充当在所需时间打开的开关).我不确定如何启动?
我正在使用12v继电器(糖立方).我可以使用串行端口来控制继电器吗?如果可以,我该怎么办?
请帮忙.

I would like to control my modem using relay and c# code. The c# code should be able to turn on and off modem at pre set time(the relay should act as a switch that turns on at required time).I am not sure how to start?
I am using 12v relay(sugar cube).can i use serial port to control the relay? if so how do i do it?
Please help.

推荐答案

查看此CodeProject文章:
通过计算机控制物理世界(逐步) [^ ].

您可以自己开发所有内容.首先,了解用于COM端口的RS-232的规格和标准: http://en.wikipedia.org /wiki/RS-232 [ ^ ] ,另请参见: http://en.wikipedia.org/wiki/Serial_port [ http://msdn.microsoft.com/en-us/library/system. io.ports.serialport.aspx [ ^ ].

(可选)您可以考虑使用并行端口:
使用PC控制电器 [未经审查的I/O端口-1-控制LED(发光二极管) )并口 [ ^ ],
具有C#或VB.NET的计算机控制浇水系统 [
Look at this CodeProject article:
Control Physical World Through Computer (Step by Step)[^].

You can develop it all by yourself. First, learn the specifications and the standards of RS-232 which is used for COM ports: http://en.wikipedia.org/wiki/RS-232[^], see also: http://en.wikipedia.org/wiki/Serial_port[^].

To work with the port programmatically, use the class System.IO.Ports.SerialPort, see:
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^].

Optionally, you can consider using parallel port:
Control Electrical Appliances using PC[^],
I/O Ports Uncensored - 1 - Controlling LEDs (Light Emiting Diodes) with Parallel Port[^],
Computer Controlled Watering System with C# or VB.NET[^].

—SA


这篇关于连接继电器到PC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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