none
How to Change Name of Ports for use with Libraries? RRS feed

  • Question

  • Hi,

    I am looking to use Serial Modbus with my SBC running Windows 10 IoT Core. I am able to write through the serial port using RS-485 when using the SerialDevice class from the Windows.Devices.SerialCommunication library.

    The serial ports on my SBC are not labelled COM1, COM2, etc. I had to find them using devcon.exe stack * command. My ports have the name PNP0501#1 and PNP0501#2 which I was able to use as the port name in SerialDevice and it works.

    I am looking to use a Modbus library to make it easier to follow the Modbus protocol. I was looking into EasyModbusTCP but am open to any library that works with serial communication.

    When I try to setup a modbus client with this library, it asks for a port name and I enter PNP0501#1 because that is the name of that port and it successfully worked for straight serial messaging. However, It throws an error every time saying that that name does not start with COM. Is there any way to change the name of this device to use the COM name so it can work with this library? Is there any library that will take the full name of this device without the word COM. Any help would be much appreciated!

    Friday, October 4, 2019 6:37 PM

Answers

  • Hello bwhelan,

    As far as i know, the port name can not be modified in Windows IoT Core.  The EasyModbusTCP library is not compatible with Serial Communication in UWP app, it only supports TCP/UDP protocol. If you want to use this library, you can download the source code, and change the SerialPort which in System.IO.Ports namespace to SerialDevice.

    Best Regards,

    Michael


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, October 8, 2019 6:31 AM
    Moderator