We help IT Professionals succeed at work.

Com1 Communication

Medium Priority
427 Views
Last Modified: 2012-05-06
Hello,

I have some scales that I am trying to connect to a PC via COM1 and send data back and forth.  Fortunately when I first created the program COM1 was available and I could see that my code worked, I opened the port sent a "print command" to the scale and received a weight on the PC.  However, the next day I was getting an error message that said "not authorized to use COM1", or something to that effect.  After some reading I found that it could be mouse drives taking up the port (even though the mouse is USB) but I never got it to work.  The next day I re-boot and get a new error message "Com1 already open".  It could be the mouse still, maybe a modem - I don't know.

Is there some way to either reserve this port for the scale through windows or at least find out what program is using the port and blocking me out?  I can go into system > hardware and see COM1 but I am not given any indication of what is utilizing it.

Any ideas?

Thanks!
Imports System
Imports System.Text
Imports System.Drawing
Imports System.IO.Ports
Imports System.Windows.Forms
Imports System.IO.Ports.SerialPort
Public Class Main
    Public Delegate Sub myDelegate1()
    Private Sub DataReceived1(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SartoriusQC.DataReceived
        ScaleOutPut.Invoke(New myDelegate1(AddressOf UpdateScaleOutPut), New Object() {})
    End Sub
    Public Sub UpdateScaleOutPut()
 
        MsgBox("Updated.")
 
        Try
            With ScaleOutPut
                .Items.Add(SartoriusQC.ReadExisting)
            End With
        Catch ex As Exception
        End Try
    End Sub
    Private Sub ExitApp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitApp.Click
        If SartoriusQC.IsOpen Then
            SartoriusQC.Close()
        End If
 
        Try
            SartoriusQC.Close()
        Catch ex As Exception
        End Try
 
        Application.Exit()
    End Sub
    Private Sub Openbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Openbtn.Click
        If SartoriusQC.IsOpen Then
            SartoriusQC.Close()
        End If
 
        Try
            SartoriusQC.Open()
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Closebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Closebtn.Click
        If SartoriusQC.IsOpen Then
            SartoriusQC.Close()
        End If
 
        Try
            SartoriusQC.Close()
        Catch ex As Exception
        End Try
    End Sub
    Private Sub DataXferbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataXferbtn.Click
        Try
            SartoriusQC.Write(Chr(27) & "P" & Chr(13) & Chr(10))
        Catch ex As Exception
 
        End Try
    End Sub
End Class

Open in new window

untitled.bmp
Comment
Watch Question

I found what was using it.  

1) Disable the serial port via device manager.
2) Re-boot
3) wait for error message (in this case from ActiveSync which was using a USB port but also taking the com for some reason).

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.