Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSCOMM Problems

Status
Not open for further replies.

VictoryHighway

Technical User
Mar 4, 2004
115
US
Greetings,
I am attempting to use the MSCOMM control to communicate with an external device.

What I need to do is send a packet of binary data (this contains a block-mode identifier that the target recognizes, then the length of the packet and then finally command codes for the target.)

However, I am having some real difficulty in accomplishing what should be relatively easy.

So, I have setup a Byte array called output() that will for now store 5 bytes. This is what I have in my code for right now:

Code:
        Output(0) = &H18
        Output(1) = &H3
        Output(2) = Destination
        Output(3) = 0
        Output(4) = &H49
        
        Dim s As String

        With MSComm1
        ' First we initialize a few properties.
        [COLOR=green]' Set the COM port number.[/color]
        .CommPort = COMPORT
        [COLOR=green]' The communication settings.  The values are:
        ' baud rate, parity, data bits, stop bits.[/color]
        .Settings = "115200,n,8,1"
        [COLOR=green]' Recieve and send thresholds, described below.[/color]
        .RThreshold = 1
        .SThreshold = 1
        [COLOR=green]' Open COM1 and begin communications.[/color]
        .PortOpen = True
        [COLOR=green]' Send the string "some data" to the output buffer.[/color]
        .Output = Output()
        [COLOR=green]' Get the current contents of the input buffer.[/color]
        s = .Input
End With

Now, I can seemingly send ASCII text "terminal commands" to the target device and it will respond correctly, but I am not getting the proper response when I tried to send the "block-mode" packet.

So, what I have done is build a "spy cable" so that I can view and capture the data going through from my PC to the target. I have a second PC on the recieving end of the spy cable which is running ProComm Plus 4.8.

What ProComm is apparently showing me is that my computer's serial port is not sending out the data that I want it to send out.

What I'm not sure about is why this is happening. Am I doing something wrong with the code? Any ideas?

Thanks in advance,
Geoffrey
 
Hmm. Other than hooking it back up to your device and trying it ( because Hyperterminal might not be reading the info the way we think it should ), I've reached the end of the suggestions that I have.

If I think of anything else, I'll let you know.

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top