Author Topic: Need help to make the program work  (Read 2106 times)

Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Need help to make the program work
« on: November 02, 2018, 05:15:58 PM »
Hi Good Evening! I need any of your help to make my program works. Below are the details:
I made two PLC ladder programs one for running a cycle test where there are two position sensors to make a pneumatic piston extends and retracts. The second program is exactly copy of the first program but instead of two position sensors, I have used two (2) timers(CTU) to extend and retract the piston. I also made corresponding two HMI programs to run each PLC programs. Till now all works perfect.

Now my next idea was to combine these two programs into one program using JSR instruction and using one HMI programs with a toggle switch. If I place the toggle switch to one position then with the JSR instruction the cycle test program with timer will start running. But I am unable to do that. I combined the two programs with JSR instruction and also made a single HMI program with the toggle switch. But only one program works whether I flip the toggle switch or not.

I would appreciate your help. I am very new to PLC and HMI program.
Thank you very much in advance!

Phrog30

  • Guest
Re: Need help to make the program work
« Reply #1 on: November 02, 2018, 05:45:31 PM »
Can you post your stuff, then we can look at it.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Need help to make the program work
« Reply #2 on: November 02, 2018, 06:55:28 PM »
Did you have something similar to this:

===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Need help to make the program work
« Reply #3 on: November 02, 2018, 07:32:58 PM »
Hi Bachphi and Phrog30, thanks for your willingness to help me.

I did add the rung 0000 with SBR instruction and file number, where my second program resides. But I did not have second SBR instruction in the rung 0001, as I have only one subroutine file.

Regarding posting of the total ladder program, I do not know how much it is feasible. I can email to you, if I have email ID of yours.

Thanks once again!

Phrog30

  • Guest
Re: Need help to make the program work
« Reply #4 on: November 02, 2018, 07:34:50 PM »
Use Dropbox, OneDrive, Google drive, etc. That's the best way to share stuff.

Phrog30

  • Guest
Re: Need help to make the program work
« Reply #5 on: November 02, 2018, 07:38:24 PM »
You should have three routines, a main where you have your calls (jsr), and the two for your code.

Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Need help to make the program work
« Reply #6 on: November 02, 2018, 07:57:56 PM »
Hi Phrog30, that may be the reason it does not work. On Monday at office, I will modify the program with three routines as you suggested. Let see it works or not. If not, I will upload the program for your review.

Thank you very much! Have a Great Weekend!

Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Need help to make the program work
« Reply #7 on: November 05, 2018, 10:45:43 AM »
Hi Phorog30, this morning I tried what you suggested. It did not work. Here is the program. I am using a toggle switch with address: B:0/2.

Thanks,

Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Need help to make the program work
« Reply #8 on: November 05, 2018, 11:28:53 AM »
Sorry, the toggle switch address is B3:0/2

Phrog30

  • Guest
Re: Need help to make the program work
« Reply #9 on: November 05, 2018, 06:41:48 PM »
Look at the image, this is most likely your problem.  You're using B3:0/2 to toggle your code, but you are clearing the entire word in your code.  Very bad!

I will say this, having multiple locations to set IO is wrong.  It's confusing and not best practice.  Most PLC gurus will say the same.

If you are trying to program a cycle, look at state machine, grafcet, etc. 


Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Need help to make the program work
« Reply #10 on: November 06, 2018, 01:56:07 PM »
Hi Phrog30, Yesterday, I could make the program works just by adding B3:0/2 to PLCAddressValue for toggle switch. Earlier B3:0/2 was only entered to PLCAddressClick. Now toggle switch is working fine, changing the subroutine as I click the toggle switch. No issue so far.

Regarding your comment about the program. I agree. I am not a professional programmer. Being a reliability engineer, I have to develop a life test fixture for our product. I learnt whatever I can about PLC programming from internet and from this site. The two programs are running separately for last two months and we tested around 30 products. I was thinking of combining them to a single program. Now since the single program is running successfully from yesterday, I don't want to change it further.

Thank you very much to you for your help!

Phrog30

  • Guest
Re: Need help to make the program work
« Reply #11 on: November 06, 2018, 05:16:48 PM »
Did you understand the part about your code is clearing the entire word your toggle is a part of? It looked to me that the HMI will set or reset this bit, but then the code could reset it as well. Was this what you wanted? If not, I would use another address.

Jaguar

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: Need help to make the program work
« Reply #12 on: November 07, 2018, 04:47:26 PM »
Hi Phrog30, I did change the address as you suggested. That worked too. Thank you very much for your help!