Sign in to follow this  
Followers 0
Star_automation

MICROLOGIX 1200 AND VISUAL BASIC

21 posts in this topic

Hello everybody, I'm trying to do a home SCADA application using a visual basic script. I'm having problems when I want to write at the output file O0:0 I'm using the protected file with 3 elements command but I receive a invalid format. Could some budy help me. Wich is the best command format to write at this output file??. This is driving me crazy. Thanks a lot for your help Best Regards Gustavo Estrella

Share this post


Link to post
Share on other sites
It would help if you could post the snippet of your script with the write command. Are you using DDE or OPC? I am not 100% sure of this but did not think you could write directly to an output. You might want to try accessing an integer {N} or boolean {B} register with the same command and see if you get the same error message.

Share this post


Link to post
Share on other sites
I'm using DF1 protocol via RS232 using MSComm active X in visual basic. I'm programming to obtain all PLC data but i'm havingo problem for writting at Output data file. If somebody have the command to sent to PLC to write at output file please help me. I'm writting my thesis

Share this post


Link to post
Share on other sites
So if I understand correctly you have created your own DF-1 protocol driver in VB and are not using RSlinx at all. I would definitely recommend you check the www.ab.com/manuals website and the knowledge database. There are certain flavors of AB PLC to which you cannot write to and turn on or off a real world output. You'll also fins the DF-1 protocol manuals for crafting your own if you dig deep enouigh in the knowledgebase. Sorry I don't ahve time right now to post the links myself. There are also a couple of mrplc threads which discuss the DF-1 protocol if you search for them.

Share this post


Link to post
Share on other sites
See my post #12 in the A-B Forum for an attachment that might help you.

Share this post


Link to post
Share on other sites
I have never done this. But could the problem be that you are using O0:0 instead of O:0/0? May be to simple of an answer for a problem that is beyond me.

Share this post


Link to post
Share on other sites
I need the command format at df1 protocol to write and read output files O0:0/0 for example

Share this post


Link to post
Share on other sites
Try this document http://literature.rockwellautomation.com/i...rm516_-en-p.pdf And see this discussion among others http://forums.rockwellautomation.com/rockw...age.id=168#M168

Share this post


Link to post
Share on other sites
Ok thank. I'll try to do these and i confirm wich response I have. thank, if you have any sugestion to help me please send me. The other question I have is: Need I enable forces before writting at output file??

Share this post


Link to post
Share on other sites
Think of things this way. The Input-Output Image table is an area of processor memory which is open access. If the PLC has a program running it will update the output table at the end of each PLC scan. Your write request to the table will apply when it arrives and be overwritten at the end of scan. IF you enable forces and send a force command this will supercede the logic and keep it in the state you want. Hope I explained this well.

Share this post


Link to post
Share on other sites
COULD YOU WRITE THE EXACTLY COMMAND CODE I HAVE TO SEND TO PLC TO WRITE AT OUTPUT FILE O0:0 FOR EXAMBLE 128d. I understand your sugestion but for these reason I clear the programm but when I send these code 10 02 01 00 STS TNS A2 01 89 00 00 80 CRC 10 03 the system responce with the same but with the error code 10 that is invalid format or something like these, I can't read and can't write. Another question, could somebody help with the command to download anda upload all PLC program???? thanks

Share this post


Link to post
Share on other sites
I am going to have to gracefully bow out at this point. I have never studied the DF-1 protocol to the depths you are attempting. I hope this "project" is for at least a Masters or Doctorate in Automation or Electrical Engineering Program. That is how sophisticated a level youa re approaching rapidly. I can suggest you study the manuals I posted and post your best effort of the Upload and Download command and you'll probably get a critique and suggestions from some of our more skilled members. To ask someone just to do it for you is like asking for a free meal. Usually ain't no such thing.

Share this post


Link to post
Share on other sites
I'm not trying that somebody do something for me, yeah is for master degree but I'm writting a program and these is a little bit problem i have. Thanks for information, I'll try to do these by myself. I'm studing DF1 protocol but I think I'm sending the correct command but I having problems. Thanks for information and I understand your criteria

Share this post


Link to post
Share on other sites
No problems and hopefully some other high level PLC Programmer will chime in soon.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
There are several DIFFERENT op codes for reading/writing, and depending on which PLC you are talking about, it won't recognize all of them. Each product line will only recognize a subset. I have no idea which ones the Micrologix series recognizes though because Rockwell hasn't updated the DF-1 protocol document in a very long time.

Share this post


Link to post
Share on other sites
As a matter of industry practice, most HMI applications do not write directly to an Output file in a controller. Most often, the controller remains in control of the output points via its user program, and the HMI contributes its data which the controller program can use to decide to turn on the output if the HMI takes over control. HMI programs generally write and read to Allen-Bradley PLC/SLC/Micrologix "N" or "B" or "F" data files. Also as a matter of industry practice, the wholesale upload and download of program files is left to the vendor's software. I won't say that it is "dangerous" to write directly to an Output file, since you can make plenty of mistakes in other coding of a controller. Be aware that if you write to an Output bit that is under the control of the controller program, the controller will write over your command the very next scan. If you write to an Output bit that is not under the control of the controller program, it will remain on or off until you write to it again; the controller cannot turn it on or off because it is not referenced in the program. For the above reason, I have never experimented with writing to an Output file element in DF1.

Share this post


Link to post
Share on other sites
All that being said, let's take a look at that DF1 frame: 10 02 01 00 STS TNS A2 01 89 00 00 80 CRC 10 03 There are several incorrect things about this frame. 1. The STS, TNS, and CRC values are missing. 2. The CMD field is missing. 3. The CRC field should be the last two bytes, after the End of Transmission (10 03). 4. Remember that DF1 is a binary protocol, not an ASCII protocol. The "10" is one byte, equal in value to 0x10 (hex) = 16 (decimal) = 00010000 (binary). The command payload is incorrect. The File Number is missing, and the "80" at the end does not belong there. The command you posted is most similar to a Read of "N7:0". A few tips that I find helpful when dealing with DF1 protocol: The Status (STS) field is always 00 for the command frame. It can have a Status value for a response frame. The Transaction Sequnce Word (TNS) is two bytes, with the least-significant byte first. Start at 1 and increment by 1 for each request. Many controllers will ignore frames with duplicate TNS fields. Calculate the CRC with all the fields except the Start of Transmission (10 02) and End of Transmission (10 03). Also exclude any extra 0x10 values that are included to designate data bytes equal to 0x10. This is called "DLE Escaping". Edited by Eddie Willers

Share this post


Link to post
Share on other sites
Thanks for information, I think I make a mistake when I sent the information, you have reason of all you mentioned, To write at output files I clear the program to avoid the overwritted when the next scan take place. But I need to know is the command to write at an output files. and read and input files, if you know the command to do these please send me, i'm using the command protected file with 3 elements and PLC respond with an error ''Invalid Format'' Thanks for your help

Share this post


Link to post
Share on other sites
Take a look at the DF1 driver in this software:http://sourceforge.net/projects/advancedhmi/ It has the code for uploading and downloading. If you email me using the address at the top of the code, I can send you a very detailed document that explains how to upload/download using DF1. Archie

Share this post


Link to post
Share on other sites
Hi Archie thanks for information, I really interested in uploading/downloading all program from PLC MICROLOGIX 1200, I would like to know the procedure to do it. Please send me information there are my mails: gestrell@hotmail.com gustavo.estrella@unilever.com Edited by Star_automation

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0