Convert2Logix

rootboy

Lifetime Supporting Member
Join Date
Jan 2004
Location
Tennessee
Posts
1,375
Hi guys,

I do much of my programming outside of the Logix5k environment. But when I copy from 5k to Notepad++ and make external edits, Logix won't allow me to paste them back in. It knows that I have edited them outside of the editor, and it won't take them back.

To get around this, I wrote a program that basically takes my L5K "clippings" and converts them back to PLC5 format. You can then take the converted code and paste all of it into the "Command Line" (the text entry line that appears up top when you double click your rung), and Logix will create the rungs for you. This box allows you to load multiple rungs, so there is no need to paste them in one at a time.

I've included the source, as well as the executable (you should really build your own .exe, but I included it for those that don't want to install vb.net).

It's a really simple, and just barely debugged program. I haven't even run a tenth of the Logix instructions through it, nor am I likely to anytime soon.

As always, check your results before putting your converted code into a working system.

Use it at your own risk. And it is freeware, use it wherever / however you like.

Enjoy!
 
I think the problem is that Notepad does not accept the character code type that Logix uses. May work with a different type of editor that supports that code type.
 
Most of the time I use Excel, but Notepad always works for me. Are you using Neutral Text, or ASCII Text? I always use Neutral.
 
I use Ultraedit/UEStudio for all of my text editing. Love it.
Fast, can do column selections, broken up selections, macro's... Overall, and excellent editor.

It even supports Python, PHP, and Ruby scripting right out of the box.
 
Last edited:
... when I copy from 5k to Notepad++ and make external edits, Logix won't allow me to paste them back in.
I use pnotepad (Programmer's Notepad) and have no problem. I downloaded notepad++ just to do a test and it's working ok, using ANSI or UTF-8, and selecting In ASCII Text on RSLogix (In Neutral Text give me problems... all the code inside Unknown Instruction block).

If I were you, I'd look for any hidden character added by your notepad++ (something like BOM) or the combination of characters used to mark the end of lines.
 
I use Notepad++ and Studio 5000 together every day (I've used v16 through v24) with no problems.

I just checked and I have NP++ set for "UTF-8 without BOM" encoding.

I can paste directly into Structured Text, and use the "in Neutral Text" entry box when pasting into Relay Ladder Diagram.

In my experience, Studio 5000 doesn't recognize that you have a ladder rung in the clipboard when it comes from a text editor, but it's easy to insert a rung, double click, hit Delete to remove the pre-entered semicolon from the Neutral Text mode, then Control-V.
 
Off-topic-ish, but just wanted to say, happy to see that others here use Notepad++. My favorite editor for years now.

On-topic, 2nd or 3rd that Logix works fine with Notepad++, haven't ever had to adjust anything as far as the encoding (UTF, ASCII, etc)
 
Thanks guys!, I didn't think to check the encoding. :)

The program was "borrowed" from my PLC-5 to L5K converter that I wrote, so it was simple to do. But if I didn't have to do *anything*, that would be better. :)
 
I've included the source...
I was reading your source. I found this part:

Code:
[COLOR=Blue]Select Case[/COLOR] LogicWord
  [COLOR=Blue]Case[/COLOR] "EOR"
    [COLOR=Blue]Call[/COLOR] ResolveParens(LogicLine, LogicWord, PartStr)
  ...
  [COLOR=Blue]Case[/COLOR] "SDS"          ', add, add, txt...
    [COLOR=Blue]Call[/COLOR] ResolveParens(LogicLine, LogicWord, PartStr)
  [COLOR=Blue]Case Else[/COLOR]
    Call ResolveParens(LogicLine, LogicWord, PartStr)
[COLOR=Blue]End Select[/COLOR]
AFAIK it doesn't care if LogicWord match a reserved word or not, you always call the same function with the same parameters. Maybe I'm missing something because this code is part of a bigger application.
 
I was reading your source. I found this part:

Code:
[COLOR=Blue]Select Case[/COLOR] LogicWord
  [COLOR=Blue]Case[/COLOR] "EOR"
    [COLOR=Blue]Call[/COLOR] ResolveParens(LogicLine, LogicWord, PartStr)
  ...
  [COLOR=Blue]Case[/COLOR] "SDS"          ', add, add, txt...
    [COLOR=Blue]Call[/COLOR] ResolveParens(LogicLine, LogicWord, PartStr)
  [COLOR=Blue]Case Else[/COLOR]
    Call ResolveParens(LogicLine, LogicWord, PartStr)
[COLOR=Blue]End Select[/COLOR]
AFAIK it doesn't care if LogicWord match a reserved word or not, you always call the same function with the same parameters. Maybe I'm missing something because this code is part of a bigger application.

Yup. :)

The "Framework" was from something else that I was working on, and I just left it in. I also thought that there might be a need for knowing what instruction that I was working with. Turns out that for this utility, there isn't. :)

So you can strip out all of the different case statements if you like, and just use the ResolveParens routine.
 
Back
Top Bottom