How To Enable/disable Serial Device In Code


Hinse

Recommended Posts

Hi,

 

I would like to be able to shut down or Start up an RS232 device from code.

My system will have an RS232 that will not always be present, I added an option on the main page to enable/disable this device. The problem is when the application starts it looks for the RS232 device and generates errors if it is not present, I want the code to wait until the operator selects it, then start the serial device, or shut down.

 

Thank you,

Pierre

Link to comment
Share on other sites

There are two different parts to this depending on what you are asking.  If you want to disable a comm port, set the comm port to 0: device.myDevice.port = 0.  If you want to stop a bunch of channels from reading, usually the best way is to set their timing to 0, put them all in the same group, then use channel.ReadGroup() from a sequence to do the actual polling interval rather than use Timing.  Then to stop reading, you just stop the sequence.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.