Announcement

Collapse
No announcement yet.

Help with first program please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts


  • Help with first program please

    Hi all,
    After watching a few hours of videos I have what I think should be a working program, but it seems to stop working at one point. I attached the program. Pictures were easier than screen shots at the time. This was connected to a BX-DM1-10ED2-D.

    RowPresentProx is a sensor on a conveyor. When it turns on, it sets bit RowPresentBit. I think that should make the N/O RowPresentBit contact on the next rung light up.

    Click image for larger version

Name:	Screen1.jpg
Views:	116
Size:	81.0 KB
ID:	126953

    As you can see below, The RowPresentBit contact does not close when I force the RowPresentProx on.

    Click image for larger version

Name:	Screen2.jpg
Views:	91
Size:	101.4 KB
ID:	126954
    I'm probably being stupid, can someone tell me what's wrong? I'm sure that the program could be condensed and there is probably more wrong after I get past this. I really don't know what I'm doing yet..once this problem is fixed I'm I'll probably need help again.
    Thanks,
    Kevin
    Attached Files


  • #2
    It appears you have not written the program to the PLC. The bars in the left margin of a rung shows edit/save to disk/save to PLC state.

    If there are no bars in the left margin of a rung, that means it is synchronized with everything.

    If there is a yellow bar, that means it has been modified, but has not been Accepted (F8)

    If there is a light blue (cyan) bar, that means the rung has been accepted, but it has not been written to the PLC.

    If there is a green bar, that means the rung has been accepted, but it has not been written to Disk.

    Look at the Offline (top) Toolbar for the Write to Disk button, and look at the Online (2nd) Toolbar for the Write to PLC button. Hit both of those and everything will be "synchronized".

    There is similar green/cyan color status on the status bar for the System Configuration, Program, and Documentation. If you see the S, P, D, bar to the right of the Yellow Forces bar, you see that S and D have normal background (light gray) color, that means they are synchronized with disk and PLC. But the P (Program) has both a Cyan (left side) and Green (right side) background - that means there are 1 or more rungs in your entire project that have not been written to the PLC (cyan) or to Disk (green).
    There are 10 kinds of people in this world, those who know binary, and those who do not.

    Comment



    • #3
      I forgot to mention this important point - when you have modified rungs that have NOT been written to the PLC (cyan bar), then NO STATUS is shown for THAT rung. For contacts, that appears like the contact is not closed, but it just means there is no status for that contact. This will start doing status as soon as you eliminate the cyan bar (i.e. as soon as you write your project to the PLC).
      There are 10 kinds of people in this world, those who know binary, and those who do not.

      Comment



      • #4
        The program file you posted does not correspond to the rungs you pictured.
        thePLCguy

        Bernie

        Comment



        • #5
          That makes sense, thank you! I'll try again tonight.
          Kevin

          Comment



          • #6
            By the way, I guess this happened because I wrote it offline using the simulator, then plugged it in and downloaded it, then made changes and wrote to disk but not the plc.

            Comment



            • #7
              Originally posted by KevinB View Post
              By the way, I guess this happened because I wrote it offline using the simulator, then plugged it in and downloaded it, then made changes and wrote to disk but not the plc.
              Exactly.

              Just for clarification, when you are connected to a PLC, that is considered ONLINE, even if it is the Simulator. When you have a disk project opened ONLY, that is considered OFFLINE programming (not connected to a PLC nor to the Sim).

              The OFFLINE toolbar has functions that are available when offline OR online (find, toggle edit mode, cut/copy/paste, zoom, etc.). The ONLINE toolbar has functions that are primarily useful when connected to a PLC. Hence, most of the ONLINE toolbar buttons are disabled when you are OFFLINE programming.

              The Disk project does maintain the PLC connection, once it is established. So when you "Open" the disk project, it will attempt to connect to the PLC using THAT connection (link).

              Also, the PLC does maintain the name of the disk project, so if the disk project file (.dmd) exists in your Projects folder, then if you just Connect to a PLC (not open the disk project), it will ask you if you want to also open the disk project (to help maintain the synchronization between the .dmd file and the PLC).

              When you open a PLC project with a corresponding disk project (or vice versa), Do-more Designer will compare the two projects and tell you if there are any differences, specifically the System Configuration and/or Program and/or Documentation. If they all match, it will just open the PLC/Disk project without any "nag" dialog (since they are "in-sync"). If there are differences, the "nag" dialog will let you see specific Program differences (if that part of the project is different). That can be helpful in case you were doing work offline, or someone on another PC was doing work online.

              The Compare Program dialog is also available at any time via the Tools menu. It lets you compare what you currently have opened in Designer with what is currently in the PLC, or with what is currently on disk, or even with a completely different .dmd project file.
              There are 10 kinds of people in this world, those who know binary, and those who do not.

              Comment



              • #8
                Thanks again, that clears up some more mysteries.

                I attached the latest that is further along but still not right. I'll try to explain what should and what is happening when I run this on the simulator.

                If I toggle X1 Startbutton on then off, C0 Runbit turns on, which should run a stepper motor that drives the conveyor. It looked like that was working last night when connected to the PLC but I didn't check for pulses on the output.

                When RowProxPresent turns on, I want it to decelerate the conveyor to a stop by turning off RUNBIT, and turn on RowPresentBit. I'm using a bit because it seems easier to let the clear the sensor clear the flag as the conveyor decelerates to a stop.

                Once motion stops, I want C1 MoveComplete to turn on. On rung 8 and 9, if I turn on MoveComplete at that point (since not on an actual PLC,) the timers turn as they should. TIMEDOUT seems to be doing what I want, but ONDTMR does not turn on C4 timercomplete after 6 seconds as I think it should.

                I could swear I saw C4 turn on after the timer reached 6 sec one time, but now it's not turning on. What I want to happen when it does turn on, is for C3 RowPresentBit to reset and and Runbit C0 to reset, starting the convyor again and waiting for the next time RowPresentProx trips.

                There is probably a better way to do this, and maybe it has to be differently, I don't know. Any ideas? Hopefully it's clear what I'm trying to do.

                Click image for larger version

Name:	PLC.jpg
Views:	63
Size:	120.8 KB
ID:	127007






                Attached Files

                Comment



                • #9
                  The way it looks like you are using C3, C4, and Y4 it doesnt look like you need to use TIMEDOUT, and you should just use a regular OUT coil. The way you are doing things, behavior would be the same with either instruction so better to use the regular out when you dont need something special.


                  The behavior of ONDTMR doesnt seem any different than a regular TMR to me either. both will turn on the output when the time is up, and the output will go off when power stops flowing to the timer. If you switch to a regular TMR, then "T0.done" will turn on when the timer is at 6 seconds. Use that to trigger the next line instead of C4.
                  Also, marge lines 10 and 11. Have a single contact go to both coil outputs.

                  Comment



                  • #10
                    T0 timed out is C4, which resets C3, which resets the timer T0, which shuts off C4.
                    C4 is probably only on for one scan. This would make it hard to see turn on.

                    I believe the Axis Config only needs to be turned on once unless a change is made.
                    Don't know what the effect of trying to run it continuously while also performing a velocity mode move would be.

                    Comment



                    • #11
                      This should do everything you want:

                      Click image for larger version

Name:	DoMore.png
Views:	66
Size:	85.1 KB
ID:	127021

                      It is a slightly modified version of what you just posted with some lines merged and tweaked.

                      Just set the axconfig and axvel instructions to a real axis on a real PLC.
                      And instead of saying "D0 = 0" on lines 7 and 8, that should be "axis1.CurrentVelocity = 0". So it is looking for actual stepper axis velocity to be 0 on the real PLC. I tried to make that obvious by the nickname and description I put, since I cant actually put the real structure there in a sim PLC.
                      Last edited by MikeN; 12-05-2019, 06:53 PM.

                      Comment



                      • #12
                        Have you tried running the program on actual hardware?
                        First thing I noticed (though it is not something you asked about) is that you are using C0 to enable both AXCONFIG and AXVEL, does that work?
                        I have only enabled an AXCONFIG for as long as it takes to execute once (actually fist time I used AXCONFIG I used First_Scan and only enabled it for one scan, I got away with that for one axis but when I tried to configure three in one scan it didn't work)






                        "I could swear I saw C4 turn on after the timer reached 6 sec one time, but now it's not turning on. "
                        If I'm understanding the code, C4 only turns on for one scan, it is only hit or miss (mostly miss) for the status view to show something that is on for only one scan.
                        Rather than looking at C4, is C3 being RST ? of course if X3 is still on then C3 gets set again the next scan, so same thing, probably won't see it in status

                        Also, comments could be your friend today, and if done correctly will certainly be your friend tomorrow (and, especially, next year)

                        Just noticed another thing: " I'm using a bit because it seems easier to let the clear the sensor clear the flag as the conveyor decelerates to a stop ."
                        in your AXVEL your target velocity is 10 pulses per second and Acceleration/Deceleration mode is set to None(instantaneous) so odds are the sensor will not be cleared, and later on when C4 resets C3, the very next scan will again set C3 again because X3 is most likely still on.
                        I was wondering if maybe Y4 (turned on by the TIMEDOUT) activated something that moved the object that RowPresentProx has sensed, so I came back here to see what you said about it and saw the "decelerates to a stop", I don't think that is going to work.

                        Possibly a rising edge contact for RowpresentProx could work, but it is still not too clear what your mechanism is supposed to be doing.

                        I've added a demo that will run in the simulator, simulating (more or less) the AXVEL the simulator doesn't have. Also includes a trend view
                        conveyor_edt.zip
                        Well, this is interesting, I did have the program running in the simulator, saved it, ziped it, decided to double check so i extracted the files and tried to run program again, now the system doesn't like the existence of the AXVEL instruction, of course I know the simulator doesn't support it, so i had an ST2 contact in the rung but left the instruction for reference, and that was working before, but on reloading it is not happy (also somehow the ST2 got removed, might have been my error, maybe, but now if i try to replace it I can't accept the rung: "The instruction AXVEL is not supported in the DM-SIM PLC"
                        So, to run the demo one will have to delete the axis instructions I had left for reference.

                        Another mistake in the demo, though it doesn't actual seem to affect operation (especially if DecellDist (see comments) is zero) While my simulated AXVEL set the complete bit when done, it didn't reset it when it starts one could add [RST C1] to rung 12, but I don't want to bother re-uploading

                        If one does run my demo and the trend view, one may see that C4 turning on is sometimes, but very rarely, displayed.
                        "I could swear I saw C4 turn on after the timer reached 6 sec one time, but now it's not turning on. "
                        Attached Files
                        Last edited by Tinker; 12-05-2019, 09:54 PM. Reason: another comment

                        Comment



                        • #13
                          Thank you all for the detailed replies!


                          I realized that I was not turning the RowPresentProx back off before TMR ran out, and that was keeping C3 from resetting, and not letting C0 set either to start the conveyor again. When I do that, it appears to work properly, except for the motion that I can't see yet. I'm working on wiring the panel so it can be tested with the real hardware.

                          MikeN,
                          I should have mentioned that TIMEDOUT is there to take the place of a pushbutton that is currently used to start a dispense cycle. It seems to be working the way I want, other than a mistake on the output. I had X4 as the output instead of Y3. Why would it let you put an input where it really can only be an output? I'll try your other suggestions.

                          Thanks for the new program also. You have some stuff there that I don't understand yet, so I'll study more and try your program once it's all wired up. Does the addition of the Prox_Went_On bit eliminate the need for the RowPresentProx to be cleard before the conveyor comes to a stop?

                          RogerR,
                          I didn't know how to turn on the Axis Config only once, but it looks like MikeN's program does that, so I'll give that a try in mine.

                          Tinker,
                          You're right about comments, I'll add them. As far as clearing the sensor, I didn't put in real numbers for the motion yet since it didn't work with the simulator anyway. Thanks for demo program, I'll give it a shot also.

                          Another thing I don't know is the proper way to wire an e-stop to this. There's no real danger, I just want it to stop the program and disable outputs if that's the right thing to do. Can anyone tell me how to do that?

                          Kevin


                          Comment



                          • #14
                            To have the Axis Config only run once, Drive it with an ST0 Contact.. that is only closed on the First Scan..

                            Once you understand this stuff, it's easy.. getting to that point requires Many Questions..

                            Cap

                            Comment



                            • #15
                              Originally posted by Cap View Post
                              To have the Axis Config only run once, Drive it with an ST0 Contact.. that is only closed on the First Scan..

                              Once you understand this stuff, it's easy.. getting to that point requires Many Questions..

                              Cap
                              ST0 is only on for a singe scan ("there can only be one" [first scan]), and while experience has show that one AXCONFIG can execute in a single scan, an asynchronous instruction in principal could take more than a single scan. I have had failures trying to configure 3 axes on the first scan, using a stage might well be better.

                              Comment

                              Working...
                              X