DDEPoke - Sending a String to ControlLogix?

kdcui

Lifetime Supporting Member
Join Date
Dec 2007
Location
USA
Posts
386
I used DDE to message down data to a bunch of PLCs, most of the time it is all numeric and this works fine.

However with this latest PLC I have a 20 character String tag on the ControlLogix which contains the ID of an device.

I'd like to update this string trough DDE but my DDEPoke command does not seem to work.

My code looks similar to this:

Channel = DDEInitiate("RSLINX", Topic)

''Reads and write work great until the following
''CM_pH[1].Cfg_ID is the tag (DDE Item) I am trying to write

DDEPoke Channel, "CM_pH[1].Cfg_ID", Range("B2").Value

DDETerminate

I noticed that the String tag on the CLX has the String Data and Length tags in the structure. Do I need to write to there instead or is there a way to write directly to the string value? If not, that would be a pain...

Thanks.
 
I just kicked myself in the head...

You pass the entire range down, for some reason I thought I was doing this until I saw the .Value in my code.

Removed that and I was good.
 
Thanks for the tip...not very intuitive, usually when trying to access the contents of a cell in Excel you would use the .Value. But doesn't work with this DDE stuff
 
I used DDE to message down data to a bunch of PLCs, most of the time it is all numeric and this works fine.

However with this latest PLC I have a 20 character String tag on the ControlLogix which contains the ID of an device.

I'd like to update this string trough DDE but my DDEPoke command does not seem to work.

My code looks similar to this:

Channel = DDEInitiate("RSLINX", Topic)

''Reads and write work great until the following
''CM_pH[1].Cfg_ID is the tag (DDE Item) I am trying to write

DDEPoke Channel, "CM_pH[1].Cfg_ID", Range("B2").Value

DDETerminate

I noticed that the String tag on the CLX has the String Data and Length tags in the structure. Do I need to write to there instead or is there a way to write directly to the string value? If not, that would be a pain...

Thanks.

@kdcui

Do you mind sharing the code for sending numeric values please ? Assuming it is different from what you posted above.
 
Passwordg,

Is indicated in my later post, when doing a DDEPoke to send data, numerical or string, you have to remove the ".Value" of the excel range (or cell).

This applies to both numerical and string.

For quick things DDE is fine but if you are thinking of a more complicated but faster and more robust solution, consider using the OPC object model to pass data.
 

Similar Topics

I have read several posts related to this Topic and gathered information from each but have still had no success. Attached is where I'm stuck. I...
Replies
3
Views
2,733
Hello all. First post here. I'm using Excel to handle all of my tag data and such. I'm wondering if there is a way to write to tag descriptions...
Replies
0
Views
1,497
Hello, I have write the follow VBA-code in Excel: sub test() dim woord as integer dim channelnum as long woord=150...
Replies
9
Views
5,907
Hi I am having an InTouch application and want to use a DDEPoke from Excel to modify a "Memory Message" tag. I am successful in reading this...
Replies
6
Views
7,450
I’m attempting to send a temperature from a SLC-5/02 to an EZiMarquee display. The vendor said to use a MSG instruction to send the data to the...
Replies
1
Views
81
Back
Top Bottom