Sign in to follow this  
Followers 0
Oncloud9

counter as stop switch

10 posts in this topic

I am a high school teacher and I am working to learn how to program using CX Programmer. I have CMP2C 20cdr-d PLCs. I am writing a program to use a sequence of 4 flashing lights to simulate energizing the fields in a stepper motor and using a counter to stop the sequence after 9 cycles. I programmed a start switch with a hold-over latch to begin the sequence and have programmed the CNT output to energize a LOAD NOT stop bit in each run. The counter counts down correctly to 0 but doesn't change the status of the stops. The start work bit turns on the first light and initiate the first timer. The timer correctly changes the LOAD NOT bit to turn off the first light and turns on the next rung. I have placed the sequence stop LOAD NOT bit in the start rung and in series with the timers on each rung. My final rung(excluding the end) uses the final timer output to cycle back to the first light in sequence. It does have the LOAD NOT bit addressed to the counter to turn off the start bit. There are two clues that I believe are significant but I have been unable to figure out a solution. The program starts immediately upon the RUN without the push button input and the counter doesn't stop the when O is reached. This tells me I have a loop. I tried removing the latch in the start bit rung but then needed to hold the push button for the program to work. How else might I initiate and stop the light sequence? Thank you for your help.

Share this post


Link to post
Share on other sites
Sounds like you have done an incredible amount of work for a beginner. Please post the .cxp file and we will all take a look at it. Or, if you do not want your students to find it, send it to me in a private email.

Share this post


Link to post
Share on other sites
I haven't tried to fully understand what you are trying to do but I will point out a couple of fundamental issues. - You are driving CNT 10 in rung 1 and using the contact of C100 in rung 2. The addresses do not match. - 20.02 is being used in duplicate output. It will always be evaluated by its last use before the END statement. Duplicate OUT statements are generally bad practice. If you would like to change its state in multiple places in the program, it is better to the SET and RSET instructions.

Share this post


Link to post
Share on other sites
Thanks for picking up the transposing of the counter number; sometimes can't see the tree when looking at the forest. Correcting this issue made the counter to do what I wanted. I also agree with the statement about the last use of bit 20.02. I am still trying to figure out how to allow the 4 light sequence to repeat without triggering the 20.02bit. I have tried DIFU and SET-RESET but was unable to solve the problem. I have repeatedly been going back to the manual after each failed attempt. It dawned on me this morning that the solution might involve using MOVE to relocate the start bit for each subsequent cycle one bit address to avoid duplicate start address and permit the push button start. Wish me luck.

Share this post


Link to post
Share on other sites
It sounds to me like you require two separate signals. One signal to turn ON when Start is pressed then turn OFF when the count is done. You kinda have that one if you remove the duplicate output. A second signal is required to restart your timer sequence. You can use the completion of Timer 4 to do that. I have an example if you would like. I don't want to spoil it for you in case you want to figure it out.

Share this post


Link to post
Share on other sites
Doing the foxtrot: two steps forward - one step backwards...lol. Used SFT to create a separate start bit for each cycle with push button start as i wanted. Now realize I have to turn off timers 1through 4 and still working on it. I am interested in the solution you have as simpler is always better.

Share this post


Link to post
Share on other sites
UREKA !!! - I got program to work. Thank you very much for your help. Realized I needed to turn off only timer 1 by using force and program advanced to next cycle. Used timer 4 to energize a LOAD NOT stopping bit for timer 1. Used my start bit to SET-RSET the stopping bit.

Share this post


Link to post
Share on other sites
Glad to hear that you solved it !! More important .... you learned how to do it yourself!! It's amazing how many students come here (and the other forum) looking for someone to solve their homework problems for them. You are now qualified to teach problem solving to them.

Share this post


Link to post
Share on other sites
Great work! My example was your original program modified exactly as you described above. Your shift register approach is not a bad idea. Though a little more complex, they can offer more flexibility. Good luck with your class and please feel free to come back with any more questions.

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