COM connection related

Status
Not open for further replies.

ijalab

Junior Member level 1
Joined
Jan 10, 2006
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,395
mscom1

I have a reference board (Ref1) with a functional chip that supports UART and I2C interfaces. This reference board connects thru a UART Interface to the PC which commands the functions. There is another UART interface for debug purpose. Now, I am asked to connect another reference board (Ref2) thru UART to another COM port of the PC and try to collect data from the first reference board thereby keeping it as a server and the Ref2 acting as a client and working on the assistance from the first ref board. Can some one help me out how to proceed?
Should I collect the details from the first ref board onto text files and inject them? Or Can I send/transmit directly to the second ref board.?
-Bala
 

Of course you can do.

A few months ago i connected a pc to pic using 2 com port. One for debug, other one for commands and data.

First of all you will need a pc with 2 com ports or usb to serial convertors.
I wrote a visual basic program for this. (Real program in delphi but it is only for command connection)

If you want to process data coming from first connection and than send results to another connection you will need something special for you.

No need to use text files. Read from first port, process it, send result to second port.

Or, Read from first port, send to second port, and if you want, write to text file debug purposes. If processing is not required you can use this one.

If you know or use vb than i can help you.

Added after 33 minutes:

Put a textbox and 2 ms com control on form. And code is here. I wrote it on my mind and NOT tested. This one reads from port 1 and puts read data to 2nd port. You can see all text on textbox. Of course only for text datas. Not binary. We can correct and extend it.

Code:
'open ports 1 and 2
Private Sub Form_Load()
        Dim Buffer 'As String

        If MSCOM1.PortOpen Then MSCOM1.PortOpen = False 'not required
        If MSCOM2.PortOpen Then MSCOM2.PortOpen = False
        MSComm1.Settings ="2400,N,8,1" 'IMPORTANT
        MSComm2.Settings ="2400,N,8,1"
        MSCOM1.CommPort = 1 'SOURCE
        MSCOM2.CommPort = 2 'DESTINATION
        MSCOM1.PortOpen = True
        MSCOM2.PortOpen = True

        Do
                Buffer=MSComm1.Input
                if buffer<>"" then 
                        MSComm2.Output = Buffer
                        Call DoLog(Buffer)
                end if
                doevents
        Loop 

End Sub

Private Sub Form_Unload(Cancel As Integer)
      MSComm1.PortOpen = False
      MSComm2.PortOpen = False
End Sub


Sub DoLog(str As String)
     Text1.text = Text1.text & vbcrlf & str 'text1 multined textbox...
End Sub
 

    ijalab

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…