Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Excel to SLC500 how to write values? 1

Status
Not open for further replies.

RayfromIntech

Electrical
Jun 2, 2003
34
What is the syntax to write a value back to the plc?

I am currently able to read values from the plc in my Excel sheet using a driver from wonderware (ABKF2) for serial communication. My Topic is ABPLC. Here is the string in my A1 box.

=ABKF2|ABPLC!O1.5
This allows me to view the status of O:1.5

EX: If i want to write a value of 1 to my plc adress O:1.0
What do i have to do?

Thanks
 
Replies continue below

Recommended for you

Are you comfortable with Excel macros and VBA?
This is the only way to write to PLC.
I can provide you a sample macro, but you have to know how to create it for editing and how to call it from application.
 
Yes can you give me the macro all i need is the proper syntax
 
I succesfully use the following in my projects for Mitsubishi.
It should work with any other brand DDE driver.

Sub WRITE_TO_PLC (PLC_DEVICE As String, DATA As Long)
CHANNELNUMBER = Application.DDEInitiate(app:="ABKF2", topic:="ABPLC")
Range("DATA_FOR_PLC").Value = DATA
Application.DDEPoke CHANNELNUMBER, PLC_DEVICE, "DATA_FOR_PLC"
Application.DDETerminate CHANNELNUMBER
EndSub

There must be a cell named DATA_FOR PLC elsewhere in the Excel workbook.
Errors processing is not shown here.
 
Where is the PLC adress in this example ?
And how can i start a macro from a cell value?
 
RayfromIntech,
The subroutine should be called with two parameters.
The first parameter is the string value indicating the PLC device.
The second parameter is the data to be written.
Use 1/0 to set/reset a bit device.
Example:
Call WRITE_TO_PLC ("O:1/5",1)

I do not understand your second question.
Are you asking how to link this subroutine to the specific cell, or how to start the macro?
 
I'v always been told that you can't write directly to an output on slicks. Have you tried to mov the value of this output to an integer or binary, and tried to read or write to that address.

 
spuds,
You're probably right, I really don't know.
As I mentioned, I use the macro for Mitsubishi and there it's possible to write to any device, including input(!)- it will be forced for one scan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor