Jump to content

Sideway

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by Sideway

  1. Hi, You can't update your MI 697 value since it's rewritten as the output of the linearization function. That's why the value of MI 697 would not change after entering a new value for it on the HMI. Sincerely yours, Sideway.
  2. Hi kratmel, Thank you for your fast response ! Having a look at the example, i have been able to confirm that i configured it right on the PLC side. However i realized my slave device was not configured to handle NMT node guard (100Ch and 100Dh objects). By modifying them, i have been able to retrieve NMT Status on the PLC and the NMT toggle bit is working just fine. One last question about the Visilogic software in itself : How come the communication trial is RED with the CANbus test tool, yet i can communicate with my slave device correctly ? Have a nice evening, Cheers, Sideway.
  3. Hi all, I have been investigating on NMT commands and how to deal with them in my CANopen project. I have created a project in which i bootup my PLC, then I send NMT Reset and Preoperationnal commands to my VFD drive (node 1). Once i am in Preoperational state, i can use my SDO commands. SDO commands are working fine. I can even ask for a NMT Stop command to disable them, then switch back to NMT Start. Problem is : i don't follow what's going on with the NMT commands. I would like to retrieve the NMT current status, but nothing is refreshed in my MI 2004 variable as shown below... Here is my function NMT Nodeguard, activating every second : May you help me solving this problem ? Sincerely yours, Sideway.
  4. Hi everyone, I wonder if it there is any option or tool available to import/export communication addressing on Visilogic. I am currently using canopen and i would like to avoid entering the configuration of each and every node by hand (EMCY, NMT, PDOs bits and register addresses). I have 16 nodes to fill and i'd rather avoid any typing mistake. I think those addresses are hidden into Vision internal memory mapping but i wonder if there is any access to it other than entering each MB/MI by hand. Cheers, Sideway.
  5. Hello ! Thank you for your kind reply ! I will work on it and try to make it even better One thing though : i am currently working on the big project (which includes the small train routine, that i left as is : i didnt change anything in it yet). This program is a lot more complex, and i really struggle architecturing it properly, especially with the I/O module which is mostly setting pneumatic actuators (that can be set/reset for a long period of time, thus i find it hard to use anything else than Set or Reset coils). The problem is : i have a lot of inputs (XB 1xx) and outputs (XB 2xx) from a WAGO external I/O module, CANopen communication with a servoDrive, HMI menus and navigation etc. I used "kind of" state machines for each region of my program (ie. i have like 5 subroutines for the Automatic mode only !), but unfortunately it's a real mess to manipulate, update and debug. Do you have any insight on how i could deal with such a big project or any architecture plan i could follow for really complex projects (in general) ? Cheers, Sideway. P.S. : Though the program isnt written in English, the idea here is to talk about the architecture of the program. No need to really understand what it's doing, only knowing which pieces it is made of is sufficient, i guess... CE prog v2.4 2022-05-20 .vlp
  6. Hi, Thank you for your replies. I tried to adjust my program (quickly though), to understand the essence of state machine. Since i did slight adjustments, i did not manage to have one coil per state machine step (since some steps do not interact with my outputs at all). Also, consider XB100 - 199 to be my external inputs (sensors) and XB200 - 299 to be my external outputs (i am using CAN open so i retrieve these bits in a structure, not shown in that small program) I would like to practice on this small program to make it as clean as possible, to use it as a reference for future projects. Cheers, Sideway. train project v2.vlp
  7. Hi everyone, I am currently working on a small project, in which i am automating the movement of a small "train" of boxes that i am filling with stuff. The train has two commands (move forward / backward) and three sensors (homing_position, box_is_full, box_detection). I control my train with three modes : Homing, Auto and Manual. My problem is the following : In order to move my train, i need to call the commands forward/backward multiple times in my routine in several rungs. I already know i can't use multiple direct coils because only the last direct coil state remains. On the other hand, if i write my code with a lot of set/reset coils, it becomes a bit hard to read. Do you have any suggestion or trick on how i could turn my code so that it remains readable without using set/reset coils ? I wrote TWO versions of my code : -> "train project.vlp" which i know is WRONG, but it is written with direct coils to illustrate how i would like the rendering of my ladder to be. -> "train project with set reset.vlp", which, i hope, is performing well although readability is worse. Cheers, Sideway. PS : I presented here a small project, but i have also been working on bigger projects, with, say 8 or 16 outputs all working together. And you can lose yourself easily with all the set/reset coils invading the project. train project with set reset coils.vlp train project.vlp
  8. Hi everyone, thank you for your replies. The whole story is that i created a small program, split in two subroutines... And the goal was to send new XYZ coordinates to my drives after the last point had been reached. The purpose of my XB was : XB rises = load my position buffer into the drive and wait for the motors to reach target". When target reached, XB would reset and i would load new coordinates in my position buffer. Then i ask for XB SET again to load buffer into drive. Everything was working fine for the 1st point launched in the drive, but the program was blocking abruptly when asking for the 2nd point to be sent. And this was due to the weird rising edge failure i just shown. Cheers, Sideway.
  9. Hello Isakovic ! At first sight, the program "should" work as you said (this is what i thought as well) ! I mean, i created this easy routine just to demonstrate the issue i had. And the issue, as you said again, is about how transition contacts are perceived from one scan cycle to another. I added some SB press keys just to be able to simulate my issue manually, when running in DEBUG mode, one scan at a time. When you do this, you may realize that the routine is working effectively only ONCE. When i go through another loop (i.e. when my MI goes back to 0 and XB resets), if i press "8" then the value 1 loads into MI but the XB rising edge is not seen and the program blocks.
  10. Hi everyone, For sake of clarity, i decided to update this post, in a more compendious way, with a much simpler routine, going straight to the point. I have summarized the problem within the subroutine attached to this post (version used : VisiLogic 9.4.0) To describe it briefly : This routines executes well the first time i go through it. However, if i go Scan by Scan (using the OnLine debug mode), a problem occurs when i loop through my routine twice : XB23 (which is effectively 'Reset' at the end of the subroutine), does turn ON if i press #8 on my PLC, but XB23 Rising edge does not occur. However, if i go through my routine, reset my XB23 at the end of it, then i wait 1 scan cycle, then retry my routine, it works properly. May you explain what is going on ? Cheers, Sideway. TEST ROUTINE.vlp
  11. kratmel, XB17 is a bit which sets ON when my CANopen configuration has terminated successfully ==> Once i configured my PDOs properly, i turn on XB17 to initiate a PDO Clock every 20 ms (which is later called to send RPDOs to my motor drives as shown below) EDIT : Discard XB1 direct coil, it is useless, just forgot to delete that one Ausman, i forgot that feature was actually available I was used to checking for the timer running within the timer variable list. I take good note of this one Thank you for your kind replies ! I have read the Timer help more in depth than i used to, and i understand it a bit better now Cheers, Sideway.
  12. Oh ! Ok i think i got it : Since i dont use any rising edge when my coil goes ON, my TE33 stays on for more than one scan ? That's why my MI is counting down scan cycles, is that correct ? Cheers
  13. Hi, I have tested again my program this morning and here is what resulted from my tests : 1) After downloading the program properly, and switching on/off my machine, i found that my TE33 timer was working, since my MI was incrementing, as shown below : As you said, TE33 is not showing that it's powered up within Visilogic (neither in the ladder section, nor in the timer array) 2) I have tried again without SB1, and the result was exactly the same. 3) I have tried with a slower timer value for TE33, and the result was quite interesting : As you can see, i set up MI to equal 0 on power-up. The MI variable attached to TE33 is incrementing a lot faster than TE2, eventhough my TE33 is slower. And yes, i downloaded the program (download + reset), then restarted my machine just to be sure. Any idea on what's going on here ? Cheers, Sideway.
  14. Hi ! I have read your answers carefully, and will retry tomorrow morning so that i can give you a feedback As you said, maybe I forgot powering up again the machine after downloading... which may sound stupid buuuuuut it may not be the first time for me However, i am SURE about this : the two timers TE2 and TE33 were never used anywhere else. I just called them for the demo ! (So, no double direct coil, reset coil forgotten or anything of the sort...) And the lungs are in the Main Routine, just to be sure i call the routine properly Oh and Ausman... what is WAN ? Never heard about this Cheers, Sideway.
  15. Hi Flex, I have often been manipulating timers for CAN communication and they are all in milliseconds *10 (we need our devices to answer fast ). And usually, if my timers are working, i can see them blinking (switching on and off) within Visilogic. I checked for my timer TE33 here, and it does not turn ON, even with a MI increment next to it. Cheers, Sideway.
  16. Hi everyone, I found something weird about timers lately... We already discussed about timers in another topic i wrote a couple of months ago, but this time, the behaviour is a bit different so i decided to write a new one. Let TE2 and TE 33 be two timers in my program : TE2 is called after a couple of seconds, and TE33 is called all the time. As you can see, TE2 is working properly, but TE33 always remains OFF. Why is that ? Greetings, Sideway.
  17. Thank you for your warning ! Conditional subroutines are a habit i have often seen in the ladder programs i have been working on... Since it was a bit of code written by some senior automation experts, i used to take those habits as "good practices". I realize now that i was very wrong about that, and realize how good it is to be part of this forum, where i can fullfill my knowledge thanks to the help of all of you, and think more in depth about the programs i am writing Cheers, Sideway.
  18. Hi Ausman, Thank you for your explanations, i didnt notice that the power rail would turn red whether or not the routine would be called, sorry for that ^^' Though, in some of my ladder programs, i remember i used to put a direct coil sometimes in my leading net, which would turn red if the subroutine was ON. I have always been "learning-by-doing" automation (for 1 year now), so i may have bad calls sometimes Cheers.
  19. Hi, if i see it correctly, it seems like your net wire (on the left of your comparison) is not activated (does not turn red). So it seems like your rung is not runned, which means your routine is not activated Cheers, Sideway.
  20. Hi toreros, Depending on how you want to manipulate your servo, you can have a look at the section 3 of your manual (page 14). It will indicate you every "mode of operation" you want to use, and what are the registers you need to manipulate in order to create motion. You have several typical modes of operation, the most common ones are the following : Homing mode, Profile position mode, Profile velocity mode, Profile torque mode. Before even configuring your mode of operation, you must be sure your drive is in Run mode . To do so, you need to set the ControlWord [0x6040] to the value 0x0F to turn your drive into Run mode. I give a bit more infos on ControlWord down below. See these informations page 38 of your manual : """If P1-01 (aka 0x6040) = 0x0B, user could set 6040h to 0x000F for ServoOn immediately. If P1-01 (aka 0x6040) = 0x0C, user need to set 6040h to 0x0006->0x0007->0x000F for Servo On step by step. """ Be sure to use the "Homing mode" (section 3.3, page 18), before using Profile position mode, because it is required to set your actual position (because if you want to go at a given position, you first need to know where your motor is ). An easy way to set your homing position is to use the homing method nยฐ35, which sets your current position as the "zero" [0x6098 = 35 in decimals]. See further informations in "homing method", page 50 of your manual. Now let's take a basic example. We want to move with the Profile position mode (section 3.1, page 14). To create motion in this mode, you first need to indicate the parameters for your motion : - the current mode of operation you are using [0x6060], for profile position mode, set it to 1, - the target position [0x607A], - the speed at which you want to go [0x6081], - the values of acceleration/deceleration in profile mode [0x6083 and 0x6084 respectively], Others parameters in this mode can be set to default at first. To initiate motion after you set all these parameters, you can use the "ControlWord" [0x6040]. The ControlWord is a register which asks the drive to generate a motion with your motor. It contains 16 bits and each bit is assigned to a given task. Given the mode you are using, the ControlWord bits may vary. In addition to this register, the StatusWord [0x6041] is a kind of response from the drive on its real-time status. It is also a 16bits value and each bit corresponds to a retrieved information. In profile position mode, once you wrote the target position in your drive, you need to ask your drive to go to this target. To do so, you need to set the bit 4 of your ControlWord to 1 ==> "New set-point". (See section "Detailed objects", pages 34 and 35 on how to use ControlWord in the different modes of operation) Your motor will then start moving towards the target. While moving, you can retrieve your StatusWord value as an indicator. It will show the bit 10 "Target reached" = 0 while moving, and "Target reached" = 1 when it is fully stopped. If you can initiate your motion but it stops abruptly right after that, it can be due to a small following error window (which can be set at [0x6065] ) or a current value (in Amperes) which is too small. I know this can be a bit tricky to manipulate at first, so if you have troubles, i may create a simple .vlp routine to show you all of this Cheers, Sideway.
  21. Hi toreros, First of all, have you already established a connexion between your PLC and the drive ? To manipulate your drive parameters, you need to communicate with SDO or PDO functions within Visilogic. Cheers, Sideway.
  22. Hi farcry, That's what i was doubting about while writing my post ๐Ÿ˜• It turns out you can only set packets of 8 bits (1 byte) with the Struct object, i forgot about that detail ^^ (for instance, according to what you wrote in your structure, your 1st byte sent in your MI vector is : [MB50 to MB57] stored in the bits 0 to 7 of MI150, then your 2nd byte is : [MB51 to MB 58] stored in the bits 8 to 15 of MI150... Then [MB55 to MB62] stored in the bits 0 to 7 of MI151... and so forth. So yes, my advice was not the best ahah. However, using the struct object would be fitting perfectly using words such as MI, ML etc. since they are packets of 16 and 32 bits But it's not what you are trying to do What i can suggest is simply the following : Solution 1) Do as Flex suggested : you can move your MBs with the "Replace operand" function. It may be a bit tricky to use, so i will show you how to proceed down below. Solution 2) Store your MBs that are in different locations to a contiguous MB vector. This way, you can keep your MB fields as they are, you just need to create more MBs : you may use contacts and direct coils to do this ==> Simply link a direct coil MB50 to a direct contact MB0 for instance, then MB51 to MB1, MB55 to MB2 etc. And then you work with your MB0 to MBx vector field. Example for solution 1 : Let's say you want to turn MB51 and MB52 into MB0 and MB1. Open "Replace operand" function (under Edit panel) and do the following : In "Select operand and Adress", write MB51. Press OK. In the new window "Select operand and Address to replace MB51", write MB0. Then, in "Replace" window, write "Vector length" = 2. This way, it will take both MB51 and MB52 into account and turn them into MB0 and MB1. If you had only 1 value to change, you would write 1 in the vector length. Check the boxes "Copy properties" and "Clear source operands". Press OK. And you are done Cheers, Sideway.
  23. Hi farcry, thank you for your kind reply. I may have a suggestion for you, if your MBs are in various places. ***EDIT : I thought a bit more about the following suggestion... Be careful with the Struct object, i did not test my solution yet but i think it may generate overflows since i load a MI 16-bit value within a bunch of MBs (there are not necessarily 16 of them). Needs to be confirm by advised Uni-guru superheroes ๐Ÿ˜… A solution i may have here is to add dummy bits if needed until you reach 16 bits /EDIT*** You may have a look at the Struct object (under vector functions list). This way, you can link every MB from any location with a contiguous register, such as an MI (which is basically 16 bits following eachother) for example. And actually, all you need to do is modify your MI value with the register toggle operand, which will toggle on/off your MBs indirectly. You can have a look at the Struct function help in VisiLogic, which illustrates how the function works. If you want, i can rewrite my example code to show you Cheers, Sideway.
  24. Hi farcry, I just gave an example on a new project, leaving the PLC config by default... which appears not to be V130 ๐Ÿ˜›That's why i may have more options than you ^^ I think you can discard Marking View... Actually i only own a V130 myself ! So i do not even know what this option is doing i was just assuming while writing the code. The goal of my example was simply to show an alternative to toggle those bits on any vision screen. I did not think deeper about it, but we may find a way to trigger some indication on the display that the bits are ON or OFF ! Like using the "Hide" function with a drawn rectangle surrounding each bit on the display Cheers, Sideway.
  25. Hi everyone, I came out with an idea while reading this thread. Let us put the MBs in a contiguous area of your PLC memory, for instance you have your 1st MB "MB0" and your last MB "MB8". Let us assume that these MB are in a grid of 3x3 in your display. Let "MI0" be a counter variable. When you load your display, MI0 initiates to 0 and varies as follow : a. If you press Right arrow, MI increments by 1. b. If you press left arrow, MI0 decrements by 1. c. If you press bottom arrow, MI0 increments by 3. d. If you press top arrow, MI0 decrements by 3. If you want to toggle a given bit, press "Enter" when you are positioned correctly. By pressing "Enter", you need to trigger a bit toggle operand, going from MB0 to MB8 and shifted by MI0 value. You can find a simple example of my idea attached to this post. Cheers, Sideway. MB_grid.vlp
ร—
ร—
  • Create New...