What REFERENCES for communication through COMM / SERIAL PORT from within IMAGE-PRO PREMIER . . .
All --
I am working to control a device via a COMM / SERIAL PORT
I have example code that includes
Unfortunately the MY.COMPUTER.PORTS is not supported by a "native" PREMIER PROJECT.
According to
https://msdn.microsoft.com/en-us/library/e4560dx9.aspx
the
My.Computer.Ports
is requires by
Namespace: Microsoft.VisualBasic.Devices
Class: Ports
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
I tried to add this LIBRARY to my project via
WORKBENCH + SCRIPT + PROJECT + REFERENCES
but I do not see this LIBRARY on the list in the REFERENCES DIALOG BOX (see below)
Is there a LIBRARY / REFERENCE that I can link to my project to gain access to
My.Computer.Ports
If this is not possible, can you direct me to the LIBRARY that will support
Thanks.
-- Matt
I am working to control a device via a COMM / SERIAL PORT
I have example code that includes
Sub GetSerialPortNames() ' Show all available COM ports. For Each sp As String In My.Computer.Ports.SerialPortNames ListBox1.Items.Add(sp) Next End Sub
Unfortunately the MY.COMPUTER.PORTS is not supported by a "native" PREMIER PROJECT.
According to
https://msdn.microsoft.com/en-us/library/e4560dx9.aspx
the
My.Computer.Ports
is requires by
Namespace: Microsoft.VisualBasic.Devices
Class: Ports
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
I tried to add this LIBRARY to my project via
WORKBENCH + SCRIPT + PROJECT + REFERENCES
but I do not see this LIBRARY on the list in the REFERENCES DIALOG BOX (see below)
Is there a LIBRARY / REFERENCE that I can link to my project to gain access to
My.Computer.Ports
If this is not possible, can you direct me to the LIBRARY that will support
' Open the serial port MSComm1.CommPort = 4 MSComm1.Settings = "9600,N,8,1" MSComm1.PortOpen = Trueor another COMM /SERIAL PORT ACCESS METHODOLOGY I can use from within a PREMIER AUTOMATION?
Thanks.
-- Matt
0
Comments
What is the best way to proceed on this?
Thanks.
-- Matt
You need a reference to Microsoft.VisualBasic, Version=10.0.0.0,
then you can use code like this:
Sub GetSerialPortNames() ' Show all available COM ports. Dim ports As New Microsoft.VisualBasic.Devices.Ports For Each sp As String In ports.SerialPortNames Debug.Print sp Next End Sub
Thanks for the direction on this.
I have added the REFERENCE to the
Microsoft.VisualBasic, Version=10.0.0.0
as shown below.
I am now able to query WINDOWS for the COM PORTS.
A++
I'll add additional code to start communicating through the PORT shortly.
Were you led to this LIBRARY by the ASSEMBLY LINE in the info I found (below) or was there another trail you found to this LIBRARY?
Thanks again.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Namespace: Microsoft.VisualBasic.Devices
Class: Ports
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
I am working to get communications up and running through the COMM PORT.
I see that your GetSerialPortNamesExample is different than the GetSerialPortNamesExample posted on MSDN at
https://msdn.microsoft.com/en-us/library/9wahf8t8(v=vs.140).aspx
and when I try some example code from
https://msdn.microsoft.com
I get syntax errors.
My CODE is below and I have "hardwired" in COM4 because it is the only COMM PORT on my TEST COMPUTER.
I'll make this more robust later.
Can you please direct me to the MSDN PAGES that will give me guidance to how to get my READ and WRITE ROUTINES up and running?
Thanks.
-- Matt
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
The VISUAL BASIC LIBRARY that you recommended seemed to generate a lot of SYNTAX ERRORS when I used VB.NET CODE EXAMPLES from MSDN.
After some experimentation, I found that using
gives a PROJECT within the PREMIER PROJECT WORKBENCH the SERIAL PORT COMMANDS needed to COMMUNICATE through a COMM PORT.
I hope this information is helpful.
-- Matt