Multiple Channels via DDE from a TC-08

Forum for discussing PicoLog
Post Reply
mhayes

Multiple Channels via DDE from a TC-08

Post by mhayes »

I am using the following code to successfully read the current value from Channel 1 of a TC-08 via DDE into Visual Basic in Excel
a = Application.DDEInitiate("PLW", "Current")
b = Application.DDERequest(a, "Value")
What is the syntax for the second and subsequent channels to be read?

User avatar
markspencer
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Post by markspencer »

Hi,

Unfortunately, DDE is not correctly set up to work with more than one channel. I can provide a macro in excel that will overcome this problem for you, please send an email to:

tech@picotech.com

and I will forward the example to you. Please quote this post.

Best regards,
Regards,

Mark Spencer

Marjunvai
Newbie
Posts: 0
Joined: Fri Aug 15, 2014 3:44 am

Re: Multiple Channels via DDE from a TC-08

Post by Marjunvai »

Sir,

i am having the same problem, I have trying to display the data to MS Excel instantaneously but all I can do is display the values for Channel 1.

Here is my syntax =PLW|Current!Value

How can I go around this and display the values for the other Channels?

Hitesh

Re: Multiple Channels via DDE from a TC-08

Post by Hitesh »

Hi Marjunvai,

I have responded via your e-mail support request.

For the benefit of other users, there is a sub-routine defined in an MS Excel macro that was sent to Marjunvai:

Code: Select all

Sub GetCurrentData()
    
    chan = DDEInitiate("PLW", "Current")
    If TypeName(chan) = "Error" Then
        Repeat = False
        MsgBox "PicoLog cannot be found - Macro Halted!!"
    Else
        returndata = DDERequest(chan, "Name")
        For i = LBound(returndata) To UBound(returndata)
            Worksheets("Sheet1").Cells(i + 3, 1).Value = returndata(LBound(returndata) + i - 1, 1)
        Next i
        returndata = DDERequest(chan, "Value")
        For i = LBound(returndata) To UBound(returndata)
            Worksheets("Sheet1").Cells(i + 3, 2).Value = returndata(LBound(returndata) + i - 1, 1)
        Next i
        returndata = DDERequest(chan, "Units")
        For i = LBound(returndata) To UBound(returndata)
            Worksheets("Sheet1").Cells(i + 3, 3).Value = returndata(LBound(returndata) + i - 1, 1)
        Next i
        DDETerminate chan
    End If
    If Repeat Then Application.OnTime Now + TimeValue("00:00:01"), "GetCurrentData"
End Sub
Hope this helps.

Post Reply