DonNH

Using ChatGPT to write ladder logic

1 post in this topic

Anyone successfully used ChatGPT to write ladder code?

I've tried a few times with zero success. At least part of the problem is just trying to interpret the "ladder" that it creates using a very limited set of ASCII characters.

 

For example, I asked this question:

      Can you generate ladder logic to try to correct an error condition:

1) Error condition 'error 1' occurs
2) system runs subroutine 'sub1'
3) check is made to see if error condition is still present
4) If error condition is still present, system outputs 'Stop'
5) if error condition is cleared, system outputs 'cleared'

 

and got this result:

 

+-----------------+
| Start           |
|                 |
|  +---[ Error 1 ]---+
|  |              |
|  |              V
|  |         +--------------+
|  +------[ Run Sub1 ]-----+
|            |            |
|            V            |
|  +----[ Check Error 1 ]---+
|  |            |            |
|  |            V            |
|  |    +-----[ Output Stop ]---+
|  |    |       |            |
|  |    |       V            |
|  |    +---[ Error Cleared ]--+
|  |            |
|  +------------+
|
|  +---[ Output Cleared ]--+
|  |                       |
|  V                       |
+-------------------------+
 

with this explanation:

 

Explanation:

  1. The ladder logic starts with the "Start" condition.
  2. If "Error 1" occurs, the system runs the subroutine "Run Sub1."
  3. After the subroutine, it checks if "Error 1" is still present.
  4. If "Error 1" is still present, it outputs "Stop."
  5. If "Error 1" is cleared, it outputs "Cleared."
  6. The ladder logic then loops back to the "Start" condition.

 

 

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