You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old December 27th, 2008, 12:59 PM   #16
gmferg
Lifetime Supporting Member + Moderator
United States

gmferg is offline
 
gmferg's Avatar
 
Join Date: Feb 2008
Location: Modesto, CA
Posts: 336
Entry for Flip-Flop contest.
Incorporating strings may have gone a bit overboard but, it's kinda cool to see the state actually displayed as 'ON' or 'OFF'.

FlipFlopRubeContest.jpg
  Reply With Quote
Old December 28th, 2008, 01:24 AM   #17
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
I'm honored to be included in that distinguished panel!

Hey Steve,

Thanks for the invite. The initial proposal sounds interesting...

"The idea is to create the most egregious example of obscure, misleading, downright ugly ladder logic you can think of."

My first suggestion regarding the rules of submission is that all entries should be submitted in PDF so that anyone, and everyone, can view the code.

Even as I was reading the challenge the gears in my head started turning while my keepers urged me - with the aid of a few well placed two-by-four shots - to enter the contest rather than judge it. I haven't made up my mind yet.

Whether I enter the contest or not, the thought occurred that it should indeed be obscure and misleading, and possibly ugly, because... rather than just being poorly written, there was an ulterior motive! That is, the code should indeed do something, but that something should somehow be lost in translation.

Even as I type this... I can "see" that many of the original, and some of you latter day Baker Street Regulars know where this is leading... and there I shall leave it.

I think that the idea of building only an ugly toggle is quite limiting. I think it better to leave the field open to... uhh... otherworld ideas.

I think it should be a case of "here's what it appears to do, I think...", in as obscure, misleading, and ugly a way as possible, only to find out what it really does is such-n-such. It might appear to be a horribly written piece of toggle-code only to find that it is actually a brilliantly disquised such-n-such code.

That is, the code is "obscure, misleading, and downright ugly" with a purpose.

And so, the challenge, as I see it, is to develop a piece of code that appears to play no part in the main scheme of the process and yet seems to do something... something which is not so apparent.

Consider this...
You are a new guy on the job. You go through the code. You find this piece of code which "appears to play no part in the main scheme of the process and yet seems to do something... something which is not so apparent."

Certainly you will ask around about that piece of code. However, you get no real information about it.

So... do you delete the code, or do you leave it?

I think you can see that I'm focusing, like a laser, on the "misleading" requirement.

What say you all?

(616)

Last edited by Terry Woods; December 28th, 2008 at 01:28 AM. Reason: nunya
  Reply With Quote
Old December 28th, 2008, 01:39 AM   #18
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 7,111
Terry had the winner many years ago.

Terry has an example of TI505 code where he did a parity check. In stead of counting the number of bits and testing the least significant bit he used a method of divides that was weird but it worked.

Do you remember that Terry?

I would play but I just can't get myself to write kludge code.
If I were to try I would use ladder to emulate a Turing machine
http://en.wikipedia.org/wiki/Turing_machine
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old December 28th, 2008, 02:04 AM   #19
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
Darkman?

Hi Peter,

Long time, huh?

I do remember the parity issue... hmmm... a bit more than a couple years ago. I wonder if it is available to search for... Phil?

Peter, did you enjoy our White Christmas? (Worst snow in 35+ years!). My wife and I loved it except that we couldn't walk our working American Eskimo dogs because they... uhh... they like to work, a lot, pulling and stuff like that... on the ice... around concrete stuff... where faces and concrete don't exactly meld well together... scary as hell!

No, "whoa" does not work, not when, in order to remain in tact, you have say it between breaths! Time to get ready for the floods now. I'm sure Vernonia is gonna get hit hard again. They can't stop the rivers rising but this time they are ready with emergency equipment.

Maybe some of you have seen the "Axemen" show on Discovery. The town that was flooded on the show was Vernonia. It's just about 25-30 miles away from me.

Anyway, Peter, I look at this as a game of deception hidden behind ugly, yet feasible, code.

Hmmm... I think my darker side is coming out...


(627) Git, don't spoil it for the newbies!

Last edited by Terry Woods; December 28th, 2008 at 02:06 AM. Reason: nunya
  Reply With Quote
Old December 28th, 2008, 02:44 AM   #20
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 7,111
Quote:
Originally Posted by Terry Woods View Post
Hi Peter,

Long time, huh?

I do remember the parity issue... hmmm... a bit more than a couple years ago. I wonder if it is available to search for... Phil?
I am blessed/cursed with a very good memory except I find it difficult to remember names and match them with faces.

Quote:
Peter, did you enjoy our White Christmas? (Worst snow in 35+ years!).
40+ years. I have lived in Vancouver or Portland for at least that long.

Quote:
My wife and I loved it except that we couldn't walk our working American Eskimo dogs because they... uhh... they like to work, a lot, pulling and stuff like that... on the ice... around concrete stuff... where faces and concrete don't exactly meld well together... scary as hell!
You should have found something that you can sit on while they pulled and did their thing.

Quote:
Time to get ready for the floods now. I'm sure Vernonia is gonna get hit hard again. They can't stop the rivers rising but this time they are ready with emergency equipment.
The floods are supposed to be a problem this year because there isn't the snow pack on the ground like the did with the mid 90s flods.

Quote:
Maybe some of you have seen the "Axemen" show on Discovery. The town that was flooded on the show was Vernonia. It's just about 25-30 miles away from me.
Yes, I know.

Quote:
Anyway, Peter, I look at this as a game of deception hidden behind ugly, yet feasible, code.

Hmmm... I think my darker side is coming out...
I remember 5TI code where a delay was implement by having a lot of rungs in reverse order so it took a whole scan to activate the rung before it. Ten rungs in reverse order would cause a 10 scan delay. Is that obscure?

I can remember a system integrator saying our controller was the biggest pain in the butt to program. He used a LDC to each of the registers for a move command. If the 4 axes were going to move at the same time he did 24 LDC boxes instead of 1 movw block that copied 24 words which would move 4 axes at once. He cursed me and our controller. I explained to the mill manager the machine required only 6 states and therefore 6 rungs to activate the motion controllers. All the system integrator hand to do was activate the rungs at the right time. As you know the constants in a LDC can't be edit by a program like Wonderware whereas a commands store in VMEM can be edited by Wonderware.

I have seen applications where our controllers were accused of moving or not moving when they were supposed to. After traveling all the way to Appomatox, VA from Vancouver, WA is discovered that the system integrator used the same one shot multiple times.

I find it hard to be interested in kludge code. I have seen too much already. Both times it was an expensive trip into the field.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old December 28th, 2008, 03:12 AM   #21
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 7,111
Quote:
Originally Posted by Terry Woods View Post
Hi Peter,

Long time, huh?

I do remember the parity issue... hmmm... a bit more than a couple years ago. I wonder if it is available to search for... Phil?
I am blessed/cursed with a very good memory except I find it difficult to remember names and match them with faces.

Quote:
Peter, did you enjoy our White Christmas? (Worst snow in 35+ years!).
40+ years. I have lived in Vancouver or Portland for at least that long.

Quote:
My wife and I loved it except that we couldn't walk our working American Eskimo dogs because they... uhh... they like to work, a lot, pulling and stuff like that... on the ice... around concrete stuff... where faces and concrete don't exactly meld well together... scary as hell!
You should have found something that you can sit on while they pulled and did their thing.

Quote:
Time to get ready for the floods now. I'm sure Vernonia is gonna get hit hard again. They can't stop the rivers rising but this time they are ready with emergency equipment.
The floods are supposed to be a problem this year because there isn't the snow pack on the ground like the did with the mid 90s flods.

Quote:
Maybe some of you have seen the "Axemen" show on Discovery. The town that was flooded on the show was Vernonia. It's just about 25-30 miles away from me.
Yes, I know. I couldn't relate to the axemen to much. They use chain saws and have been ever since I was a little kid. I know because my father sold them the chain saws. I just remember that it was very dangerous.

Quote:
Anyway, Peter, I look at this as a game of deception hidden behind ugly, yet feasible, code.

Hmmm... I think my darker side is coming out...
I remember 5TI code where a delay was implement by having a lot of rungs in reverse order so it took a whole scan to activate the rung before it. Ten rungs in reverse order would cause a 10 scan delay. Is that obscure?

I can remember a system integrator saying our controller was the biggest pain in the butt to program. He used a LDC to each of the registers for a move command. If the 4 axes were going to move at the same time he did 24 LDC boxes instead of 1 movw block that copied 24 words which would move 4 axes at once. He cursed me and our controller. I explained to the mill manager the machine required only 6 states and therefore 6 rungs to activate the motion controllers. All the system integrator hand to do was activate the rungs at the right time. As you know the constants in a LDC can't be edit by a program like Wonderware whereas a commands store in VMEM can be edited by Wonderware.

I have seen applications where our controllers were accused of moving or not moving when they were supposed to. After traveling all the way to Appomattox, VA from Vancouver, WA is discovered that the system integrator used the same one shot multiple times.

I find it hard to be interested in kludge code. I have seen too much already. Both times it was an expensive trip into the field.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old December 28th, 2008, 03:35 AM   #22
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
uuhhh.... a little altzheimers (sp?) affecting the finger, maybe?

Yeah, I get it.
  Reply With Quote
Old December 28th, 2008, 09:29 AM   #23
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,221
Terry
What does the 616, or 627 stand for?

I am the new guy at a PLC5 plant it is riddled with left overcode. I have spent way to much time tracking down rungs that go out to a Basic card to a chart recorder that counts pulses from a flowmeter and back. Then I found a Highspeed counter card that is counting the same pulses. The oldtimer says Oh yea I couldn't findout where the signal was coming from so I hired a SI to get it going.

I love reverse engineering a junk system.
__________________
There should be a minimum IQ before people can breed.

FS Eng (TV Rheinland, #11004/15, Machinery)
  Reply With Quote
Old December 28th, 2008, 12:05 PM   #24
Phil Melore
Administrator
United States

Phil Melore is offline
 
Phil Melore's Avatar
 
Join Date: Mar 2002
Location: NY state
Posts: 537
Quote:
Originally Posted by Terry Woods View Post
snip...
I wonder if it is available to search for... Phil?
...snip
Everything is still available... but where to look is the question??
Remember the forum about 9 years ago, and I think 3 generations ago. Nice to see some of the names on there are still around

Enjoy,
__________________
Phil Melore
PLCS.net
phil@plcs.net
Learn PLC Programming...
  Reply With Quote
Old December 28th, 2008, 12:38 PM   #25
geniusintraining
Lifetime Supporting Member + Moderator
United States

geniusintraining is offline
 
geniusintraining's Avatar
 
Join Date: Jun 2005
Location: SC
Posts: 6,858
Quote:
Originally Posted by Terry Woods View Post
(627) Git, don't spoil it for the newbies!

Never...
__________________
www.PLCCable.com PLC Communication Cables, PLC Trainers, MicroLogix, ControlLogix, Siemens, Allen Bradley and more...OEM and aftermarket supplies... Aftermarket 1784-U2DHP Allen Bradley USB to DH+, new USB to 485 modbus
  Reply With Quote
Old December 29th, 2008, 12:58 AM   #26
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 679
Quote:
Originally Posted by Steve Bailey View Post
I was willing to include any examples, but if limiting this year's contest to the toggle (aka flip-flop) function results in more responses, I'm all for it.

As a self-nominated judge, I'm not eligible for the grand prize, but here's a modest contribution to help stimulate the creative juices.


Pushbutton _____ _____ ______
--]P[-----| ADD |----------| > |--------| MOVE |
| | | | | |
R1 -| |- R1 R1-| | 0 -| |- R1
| | | | |______|
1 -|_____| 1-|_____|
_____ Out
----------| EQ |-------( )-
R1 -| |
| |
1 -|_____|
Well......I think his suggestion was to take something simple like a toggle and convolute it to the point where it worked but was nearly impossible to follow how.

Yours works and is nice to look at...............and I can't quickly come up with a simplier solution....................but I am still thinking..........
  Reply With Quote
Old December 29th, 2008, 01:02 AM   #27
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 679
Kluge you say

Quote:
Originally Posted by Peter Nachtwey View Post
Terry has an example of TI505 code where he did a parity check. In stead of counting the number of bits and testing the least significant bit he used a method of divides that was weird but it worked.

Do you remember that Terry?

I would play but I just can't get myself to write kludge code.
If I were to try I would use ladder to emulate a Turing machine
http://en.wikipedia.org/wiki/Turing_machine
Peter.......were you ever in the military?

I have never heard a civilian use "kluge" before..............except Tom Clancey in Hunt for Red Oktober...........why do I remember that?
  Reply With Quote
Old December 30th, 2008, 09:26 PM   #28
ganutenator
Member
United States

ganutenator is offline
 
ganutenator's Avatar
 
Join Date: May 2002
Location: kansas
Posts: 1,171
I once had a boss that would write "block diagrams" in a bas*ter*ized function block diagram format. He would then expect us programmers to convert it to plc code.

Not a horrible idea, but sometimes it led to some really sloppy code.

I once reduced an entire page of his FBD code using boolean algebra.

It equated to ....

-----| | ---------( )

Just for fun, I wrote his code as designed, and sure enough, it worked exactly like
my above result.

Boy do I wish that I still had that FBD diagram!

Last edited by ganutenator; December 30th, 2008 at 09:27 PM. Reason: spelling
  Reply With Quote
Old December 30th, 2008, 09:40 PM   #29
ganutenator
Member
United States

ganutenator is offline
 
ganutenator's Avatar
 
Join Date: May 2002
Location: kansas
Posts: 1,171
Re inventing the wheel

I do feel that the rules will need to get pretty specific about the instructions and processors used. The fun stuff happens when you take advantages of nuiancess in the platform.

Check out my Beta entry.

I call it re inventing the wheel.

spoke 1 > spoke 2 > spoke 3 > spoke 4 > spoke 1, etc. etc.
Attached Files
File Type: pdf re inventing the wheel.pdf (10.1 KB, 68 views)
  Reply With Quote
Old December 30th, 2008, 09:48 PM   #30
ganutenator
Member
United States

ganutenator is offline
 
ganutenator's Avatar
 
Join Date: May 2002
Location: kansas
Posts: 1,171
This plc programmer (who reminded me of the garbage mouth guy from the saturday morning cartoons), who advised me to never sprinkle hot pepper flakes on my
pizza, as it would most definitely tear up my insides.. (is this true? cuz i sure do like them pepper flakes)

anyhoo, He would program a wonderware button to a oneshot address in the plc as such...

Code:
 
    HMI Button                   HMI Button pulse
       b3/0                        b3/1
------[ons]-------------------------( )
b3/0 would always be 1 because the previous scan would solve the oneshot true

The HMI button was set to write a 0 to b3/0.

When you write a zero to a oneshot, the oneshot is inherently reset.

Next scan, you get a pulsed b3/1.

Now for the why:

This was actually, kind of genious....

Since the momentary function in wondeware, could miss a button press, especially since there were often delays in communication in the oil field using radio modems...

Most wonderware programmers were aware of this, and would set the HMI to set a bit, and for the plc to reset the bit once it received it. And use a separate coil for button lamp indication.

This code accomplishes the same thing rather simply.

The bit b3/0 even serves as a good lamp indicator for the wonderware button.

But to walk up on the code for the first time........


One little caveat...

The AB PLC5 sets all of its false/true type instructions' EN bit to 1 on pre-scan.

The AB SLC does not.

Yet, this code did not produce the extra pulse on slc start that i expected.

Hmmm, because i am using the simulator?

Last edited by ganutenator; December 30th, 2008 at 10:20 PM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Problem with a script in flexible Combo LIVE PLC Questions And Answers 4 December 19th, 2008 06:38 AM
S7 - using Arrays with Multiplex Addressing in ProTool RMA LIVE PLC Questions And Answers 4 August 12th, 2005 08:39 AM
S7 BitCast function RMA LIVE PLC Questions And Answers 6 November 11th, 2004 05:20 AM
EXCEL Time Graph Kabir LIVE PLC Questions And Answers 17 April 9th, 2004 03:40 PM
Exact SP reached at end of heating ramp time JustDaveIII LIVE PLC Questions And Answers 12 October 17th, 2003 05:07 PM


All times are GMT -4. The time now is 10:02 PM.


.