panic mode

MrPLC Admin
  • Content count

    3016
  • Joined

  • Last visited

Posts posted by panic mode


  1. since PLC is in the machine, they can literally take few photos of it. and since they have backup, they can provide it in full, rather than piecemeal. then anyone with suitable software will be able to open project. that file you posted is actually text file. open it in a text editor and see how much you can learn from it.

     

    1 person likes this

  2. please be mindful where you post. download section is meant for placing resources such as documentation, program examples etc that are likely to be useful to others. that is not a place to ask for help. that will also have an effect on how many people will find your post and how soon you may be getting any tips. ;-)

    normally when isolation is required one would simply use 3rd party signal conditioner that provides the 3-way isolation (in/out/power). for example

    https://www.weidmuller.ca/en/products/electronics/analogue_signal_conditioning/index.jsp

    https://www.automationdirect.com/adc/overview/catalog/process_control_-a-_measurement/signal_conditioners/dc_voltage,_current_or_potentiometer_input

    https://www.redlion.net/product/isolated-universal-converter-signal-conditioning-module

    etc.

    not sure why are you doing DIY rather than using off the shelf components but i guess you must have a reason.

    anyway, looks like you are working with own circuit that attempts to produce an analog output using very basic circuit. it does not even have an ADC or voltage reference, it is just using PWM signal into 1st order filter and buffering output to produce an analog voltage. it does not get more crude than that, so you obviously do not need great stability, accuracy etc.

    in that case, consider getting cheap isolator from Amazon. if this is some school project or whatever homebrew, no point spending hundreds of $$$ on proper isolator when signal is produced by such simple circuit.

    https://www.amazon.com/Isolation-S-10V10V-Quantities-Voltage-Isolating/dp/B07RGWJC26

     

    but if you are planning to integrate isolation into your own circuit, you need to make some decisions. this means consider spec etc. deciding on 2way or 3way isolation, place in circuit where isolation is done etc.

    at the very minimum you will want 2-way isolation. This can be done two ways, isolating analog output or isolating PWM input.


    in general isolating PWM input is much simpler as long as used optocoupler can handle signal at frequency you are using. if your PWM is not more than couple of kHz this should be fine. but optocouplers are not very good for high speeds since latency becomes a factor. in case of higher frequency, distortions due propagation etc become factor which is not good for PWM where duration of the pulse is important.

    there are of course other types of coupling (capacitive or inductive). so not sure what your comfort level or needs are. in case you are only using 2-way isolation, opamps would need to be powered from the target circuit, not from your MCU circuit, so your booster to produce 12V will need to be replaced.

    btw. using switching supply is also not the best idea, specially since circuit is low power. also using single sided supply for your buffer is another problem as you will not be able to get close to zero even if opamp is rail-to-rail.

    isolating an analog side of the circuit is also possible and several solutions exist. in your case time constant is very long (0.1sec) and your analog output would be very slow. 

     

     

     


  3. get programming manual for your PLC. it will explain each instruction, addressing etc,

    each PLC also has own instruction manual that is product specific. so you really really need to know what exact hardware you are working with and get correct manuals.

    in general CPU can access some memory directly. that includes memory location M, D etc. one can also directly access regular I/O (X and Y).

    but when there is an "intelligent" device or I/O module things get a bit more complicated. intelligent module is practically EVERY module except the simple digital I/Os.

    that includes products that have analog inputs, analog outputs, servo control, communication interface etc.

    so each of those intelligent devices will also have own manual, explaining functionality as well as how to access the parameters. part of memory of the module that is accessible from "outside" (by PLC CPU) is called buffer. using TO and FROM instructions one can read or write the buffer locations. 

    note that it also matters how the PLC is configured - module that is in a different location will have different base address, which is what you need to know in order to access buffer locations in that module. for example in some particular configuration, you may have several identical analog input cards. but you need to parametrize and get values from each separately. 

    your program sample seem to do same kind of thing. Z0 is special register that can be used to add offset. K0 is decimal representation of 0. so K0Z0 allow you to use same set of instructions to access different module simply by changing Z0 value.

    the first line says something like:

    when M1090 is true, access module with base address K0Z0, then in buffer location zero (K0) put value from D458. in this case it is only copying one value (K1). quite often you can transfer several values at once by changing K1 to something larger.

     

    next two lines are reading from the intelligent module. 

    one is reading from buffer location 10 (K10) and placing value into D453. Actually here we are transferring 4 consecutive buffer location (K4 at the end of the instructions).

    this means buffer 10 is copied to D453, buffer 11 is copied to D454, buffer 12 is copied to D455 and finally buffer 13 is copied to D456.

     

    last instruction does the same, it copies buffer 29 (K29) which is a single value (K1) and that is a 16-bit, to a group of M bits starting with M932.

    K4M932 means size of target is 4 nibbles (K4). One nibble is 4-bit or half a byte so K4 means 16 bits of entire 16-bit value is transferred and stored into M932, M933...M947.

    transferring to block of M location instead of single D register indicates that they want to check the value bit by bit so in this case using M bits is more practical than working with D register.

     

     

     

    2 people like this

  4. if you have OPC server running on PLC, your Visual Studio will need to act as OPC client and you can get data from PLC

    if you have OPC server running on PC, your Visual Studio will need to act as OPC client and you can get data from PC. But the server still need to somehow get the data from PLC.


  5. one thing important to add is that order of first two rungs is important. it is used to detect signal edge when button is pressed

    the next rung toggles the state. using XOR is efficient but in case it is not clear how that works, here is version using set/reset.

    note that in this case you cannot use output value to change output, you need to store it into some temporary bit first and use that.

    toggle.png

    1 person likes this

  6. that is correct. this is not a simple task. one need to know quite a bit to do it.

    advantage of using mentioned approach is that many things are already supplied and easy to setup (robot, cell, and everything in it). also all the math is already done including kinematics and transforms.

    the downside is that one still need to dive into the code and figure out how to swap the data feed. and that is just one of challenges. even though this is in "readable" source code, it is obfuscated by formatting. some of variable and function names are just 1 or 2 characters long. but knowledgeable and dedicated person could still take advantage of this rather than starting from scratch. if you have not worked with OpenGL, well... there is plenty of tutorials and books on the subject. good luck.

    1 person likes this

  7. robot movements or coordinates or both? only coordinates is simple, just get data to your server and update values in page.

     

    for movements you need to show robot. few options exist so here are some of the simplest.

    install RoboDK (free version will do), insert robot you want to see, create some motions and play with it.

    when done, export it as HTML. now you can open it in any browser and not just observe the motions but interact with it.

    now that you have a working page (with correct 3D model, kinematics etc.), you need to modify it (or build your own that does similar job). in case of export, motions are stored in a lookup table that is embedded into HTML document. you will want to replace that by actual robot position value that is obtained from the real robot. This means your robot will need to have software (from factory or more likely created by you) that will connect to your webserver and stream robot position data at suitable interval. server can log this data or use it any way you like, for example to update joint positions in the mentioned page.

    that is one approach... other is do it all from scratch. you can do OpenGL etc in a web browser. which approach is better suited for you is up to you. good luck.

    for example see example export

     

    RoboDK Export Example.html


  8. you need to think how the values are stored....

    position measured by encoder is an integer since pulses are counted (0,1,2,3...). so there is no decimal point.

    to convert that into real world measure (inch, mm degree or whatever) one can process that value and store it a floating point type.

    but if you want to go reverse, for example to enter some setpoint. you really need to go backwards.

    note that decimal point is actually only used with floating point data type, also known as REAL or FLOAT. INT/DINT etc do not have that,

    so your setpoint such as 95.65 need to be converted into something else and integers do not have fractional parts.

    a good way to get around this is to use fixed point representation. in floating point, place of decimal point can move or float. in fixed it is fixed. 

    one can choose location of the fixed point based on required accuracy. one common solution is to use 3 decimal places.

    so when you use an integer such as 145318, value would really mean 145.318. decimal point is assumed to be at filed location - three places from the right.

    in your case such conversion would involve multiplication by 1000 before using FIXL. less significant positions would still be lost of course but you retain ones that matter...

    1 person likes this

  9. need to post some info on used hardware (CPU type), addresses used to control stepper, number of steps per revolution etc.

    normally steppers are controlled by PTO (pulse train output) which need to be configured.

    check instruction manual for your controller

    stepper.png

    pulse.png


  10. yup, that will work too.  as usual there are many ways to get the same result.

    on a side note - without knowing where the data comes from and what the result is used for, i would just suggest some caution with data manipulation. you may want to check or ensure that "byte values are indeed only 8 bits or you may get surprise result. 

    if the byte values are from some bitwise memory like I/O or M, you can use form that only takes 8 bits (for example K2M100). if the byte values are stored in D registers you may want to clear higher bits..

     

    for example

    WAND HFF  HighByteValue HighByteValue  

    WAND HFF  LowByteValue LowByteValue


  11. the same way you would do that with digits in a decimal system. if you want 3 and 8 to become 38, you multiply first one by ten then add the second one.

    in case of 8-bit, you multiply first one by 256 or simply shift it left 8 places then add or OR result with the second byte.

     


  12. VFDs are good and speed control but not positioning. for position control (servo like) control feedback loop need to be closed at some device that can act fast. if the positional accuracy is not that important you can use programmable controller to make own code to run it at desired speed, decelerate before target position then creep slowly until at position or reasonably close. Also the whole idea of position control is to be able to maintain the reached position. and without feedback loop closed at the drive itself or at least brake, this is not likely to produce satisfactory results. When VFDs use encoder it is usually to maintain speed or to track another drive - not to do positioning. Some VFDs (for example from Eurodrive) have option to wire encoder directly to the VFDs, use internal loop control. They can be programmed to move among few predefined positions which is handy for applications like turn table etc. but this is rare. really this is domain of servos.


  13. not sure what you got there, buttons should be good 0.5" or larger. maybe check videos like this.

    you did not state what was the type of the image file you tried to attach, maybe problem is not the file size but the image resolution. try resampling it to something reasonable (1200x900) and try again.