Results 1 to 28 of 28

Thread: [RESOLVED] COM1 Problems

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    103

    Resolved [RESOLVED] COM1 Problems

    i wrote this code to send a byte the the COM1 when an arrow is pressed on the keyboard

    Option Explicit

    Private Sub Command1_Click()
    MSComm1.PortOpen = False
    End
    End Sub

    Private Sub Form_Load()
    MSComm1.CommPort = 1
    MSComm1.Settings = "2400,N,8,1"
    MSComm1.DTREnable = True
    MSComm1.PortOpen = True
    Dim oApp As Object
    Dim oDoc As Object
    Set oApp = CreateObject("Word.Application")
    Set oDoc = oApp.documents.open("C:\Test.doc")
    oApp.Visible = True
    Set oDoc = Nothing
    Set oDoc = Nothing

    Me.KeyPreview = True
    End Sub
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

    Select Case KeyCode
    Case 37

    MSComm1.Output = "11110010"
    Text1.Text = 11110010


    Case 38

    MSComm1.Output = "11110001"
    Text1.Text = 11110001
    Text2.Text = MSComm1.OutBufferCount


    Case 39

    MSComm1.Output = "11111000"
    Text1.Text = 11111000
    Text2.Text = MSComm1.OutBufferCount


    Case 40

    MSComm1.Output = "11110100"
    Text1.Text = 11110100
    Text2.Text = MSComm1.OutBufferCount


    End Select
    End Sub

    i tested the COM out buffer by using
    Text2.Text = MSComm1.OutBufferCount

    but it returned nottin which means the serial port isnt getting the byte!

    can anyone help with this?
    Last edited by Elios115; Nov 5th, 2005 at 06:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width