AT&U
AT&U
  • 14
  • 57 834
CODESYS -Differente between pass by vale and pass by Reference
Source code: github.com/ATandU/PassingArguments
Explaining the difference between pass by value and pass by reference.
Passing an argument by:
- Value
- Pointer
- Reference
- VAR_IN_OUT
Creating an immutable argument.
Getting the execution time by of pass by reference and pass by value.
มุมมอง: 2 034

วีดีโอ

CODESYS - List all files in a directory. Write a specific file type (.csv, .txt, etc) into a list
มุมมอง 3.9K2 ปีที่แล้ว
Source code: github.com/ATandU?tab=repositories - Open a specific directory - Read all the files in the directory - Write a specified file type, like .csv, .txt, etc. into a list (array of strings) - Close the directory
CODESYS - Runtime polymorphism using inheritance (OOP)
มุมมอง 4.8K2 ปีที่แล้ว
Source code: github.com/ATandU?tab=repositories - Explanation of compile and runtime polymorphism, the object interface and the object property you can fin in the previous video: th-cam.com/video/dcSW0X4gM98/w-d-xo.html - We use a pointer to the base class to point to its child classes. Over the pointer we are invoking the correct method in the child class. - Inheritance: The capability of a cl...
CODESYS - Runtime polymorphism using an ITF (OOP)
มุมมอง 3K2 ปีที่แล้ว
Source code: github.com/ATandU?tab=repositories - Polymorphism is one of the pillars of the OOP and means "Having many forms" - There is a Compile-time polymorphism also known as static polymorphism or early binding and it can be achieved with functions overloading. (not only) - The Runtime-time polymorphism also known as dynamic polymorphism or late binding and it is when the function call is ...
CODESYS - Memory allocation of arrays and function blocks with the NEW & DELETE operators.
มุมมอง 4.1K2 ปีที่แล้ว
Source code: github.com/ATandU?tab=repositories - NEW and DELETE operators - Allocating a standard data_type and allocating a user_defined_type - Accessing the elements of the allocated array with ptrName[n] and ptrName = (SIZEOF(DATA_TYPE)*n). (n=0...elements -1) - Use of NEW and DELETE in a FB - Sort and Find functions explained: th-cam.com/video/Ny8JDpRkHKc/w-d-xo.html TIPS: - When the alloc...
CODESYS - Bubble sort, filter function for an array of string without knowing the size of the array
มุมมอง 2.2K2 ปีที่แล้ว
-What does the [*] operator do and what the UPPER_BOUND and LOWER_BOUND means you can check in the previous video th-cam.com/video/sn84dS9Psic/w-d-xo.html - Simple Bubble sort from A-z and from z-A. (This works for any basic datatype) - Search function that is checking all the elements of the source array and if the searched phrase is found in the checked element of the array, this one will be ...
CODESYS - How to pass an array to F_ FB_ or M_ without knowing its size in the function itself
มุมมอง 3.7K3 ปีที่แล้ว
- 2 Ways how to pass an array to F_ FB_ or M_ without knowing its size in the F_ FB_ or M_ - The bodies of the F_ are dummies and just fill the Arrays with the elements number. - I will create a video in which I'll pass an Array of Strings (List with program names) and create a sort function using the bubble sort method. A second method will filter the program names. Tips: - Prefer the [*] oper...
CODESYS - Random Number Generator, Itf and Visu Template Part 2
มุมมอง 1.9K3 ปีที่แล้ว
- Using the Interface of the Object "Random Number Generator" - Creating the Function Block and the ITF: th-cam.com/video/oUEzksl4Ucs/w-d-xo.html - Creating a simple Visu Template and passing the ITF of the Object "Random Number Generator" to it. - Tips: - Do not use single "direct" variables for the Visu of an Object. If you want to visualize more than one object from the same type, you have t...
CODESYS - Random Number Generator, Itf and Visu Template Part 1
มุมมอง 6K3 ปีที่แล้ว
- Creating a simple Random Number Generator - Use of SysTimeGetMs() Function - Creating an Itf as a Structure In the second part of the video I'll create a Template for the Itf. The Template will be used for objects from the Itf type.
CODESYS - How to use the "ANY" - data type
มุมมอง 2.5K3 ปีที่แล้ว
- ANY Data Type - ANY Structure (TypeClass, pValue, diSize) - Example how to use the ANY Data Type in FB - Creating a FB to convert ANY_INT in REAL with a decimal point. - CODESYS Generic Compare Function with ANY NOTE: The FB must be finished if you want to use it in your project. Some Tips: - Set an ERROR if the passed Var doesn't match the CASE. - Reset the Output result if the passed Var do...
CODESYS - Difference between pointer and reference
มุมมอง 8K3 ปีที่แล้ว
- A pointer from type T points to an object from type T (T = basic or user-defined datatype) - A pointer holds the address of the object that is pointing to - The fundamental operation with a pointer is called "dereferencing". The dereferencing in CODESYS is done with the symbol "^" - A pointer can point to a different object at a different time - Before dereferencing a pointer and assigning a ...
CODESYS - Get a char from a string using reference and pointer
มุมมอง 2.6K3 ปีที่แล้ว
Two functions: 1. Get the n-char from a sting using reference (n=1...sting length) 2. Get the n-char from a string using pointer (n=1...sting length)
CODESYS - Data Logger
มุมมอง 10K3 ปีที่แล้ว
With the AT&U data logger, you can log any type of variables you like into a logbook. Through this process, you can easily find errors in the code. In this video 3 variables from type bool, int and string are stored on change.
CODESYS - File management
มุมมอง 2.4K3 ปีที่แล้ว
This video shows a quick look at the AT&U Data Management Functional Block and its basic functions (Create a file, Write to a file, append to a file, read from a file) 1. Customising row and column over constants (in this case 1000x10). 2. Fill a two-dimensional array with the data. (String row_xxxx, column_yy) xxxx= 1..1000, yy=1..10 3. Create a directory and a file over the Data Management FB...

ความคิดเห็น

  • @simmmr.9040
    @simmmr.9040 2 หลายเดือนก่อน

    IN_diMin := -2147483648; IN_diMax := 2147483647; Ups… _diDiv + 1 = 0 → _diResult := … MOD 0 → division by zero

    • @simmmr.9040
      @simmmr.9040 2 หลายเดือนก่อน

      IN_diMax := -IN_diMin; // -2147483647 ⩽ IN_diMin ⩽ 0 Ups… _diDiv + 1 = 1 → _diResult := … MOD 1 is always zero → _diResult is always equal to IN_diMin

  • @Kailasnath-l3c
    @Kailasnath-l3c 2 หลายเดือนก่อน

    can u share the program?

  • @Kailasnath-l3c
    @Kailasnath-l3c 2 หลายเดือนก่อน

    hai, can u share this project.

  • @YosoyDavidRedondo
    @YosoyDavidRedondo 3 หลายเดือนก่อน

    Hi! Very helpful video. Only one advice, it is easier to do it with only one structure and calling three fb’s also as a reference in the frames 😊. Thanks for your videos

  • @duvanmoreno8121
    @duvanmoreno8121 5 หลายเดือนก่อน

    why you upload something without code and you don't say which library you use.

  • @fabianomoreiraamaro9920
    @fabianomoreiraamaro9920 7 หลายเดือนก่อน

    Excellent video!

  • @tolegator2623
    @tolegator2623 7 หลายเดือนก่อน

    Can i use memory allocation by __NEW for interfaces?

  • @phamminhtri16
    @phamminhtri16 7 หลายเดือนก่อน

    Thank you very much by your video. I can't see your FB_DataManagement. Please explain for me.

  • @ghosthunter9897
    @ghosthunter9897 9 หลายเดือนก่อน

    Bubble sorts for big data isn’t efficient.

  • @samvivi7
    @samvivi7 9 หลายเดือนก่อน

    Hi, Thank you for uploading but i ran into some issues (i am using TwinCat 3) 1. Itf does not generate the FB and IN and OUT automatically when calling in Main. (i am sure some settings need to be turned on). 2. All my numbers are negative. 3. it seems to only generate couple of number and start repeating them. (*One Shot*) _rtExecute.CLK := In_xExecute; _rtExecute(); IF _rtExecute.Q THEN _iStatus :=0; END_IF (* State Machine*) CASE _iStatus OF 0: IF _rtExecute.Q THEN Out_xDone := FALSE; Out_diRand := 0; _diDiv := (In_diMax - In_diMin); _diResult := TO_DINT (SysTimeGetMs()) MOD (_diDiv +1); _iStatus := 100; END_IF 100 : Out_xDone := TRUE; Out_diRand := _diResult; END_CASE i am trying to make a Dice Roll game. Thanks for any help.

  • @7Denial7
    @7Denial7 ปีที่แล้ว

    Maaan thank you very Much, the video is sublime!!! It's a surprise for me that it's possible to write program for PLC's in a full-blown OOP style!!!

  • @7Denial7
    @7Denial7 ปีที่แล้ว

    Very cool, thank you! Looks like Codesys 3.5 ST is a full-blown OOP language, so flexible. Inheritance, encapsulation, polymorphism, it supports all of those. Sweet

  • @Shabazza84
    @Shabazza84 ปีที่แล้ว

    Goog explanation. But the amount of ads throughout the video is beyond funny.

  • @I_vantheory
    @I_vantheory ปีที่แล้ว

    wow I finally get it.Thanks a lot

  • @Evaninsoccer
    @Evaninsoccer ปีที่แล้ว

    as useful as a condom in a convent...

  • @JoshuaChristianJavier
    @JoshuaChristianJavier ปีที่แล้ว

    Thanks for your videos May I ask what exactly the advantage when using this in a project

  • @marcelh2341
    @marcelh2341 ปีที่แล้ว

    Can you share an example about object oriented programming with hardware I/O?

  • @nivishkamdar5808
    @nivishkamdar5808 ปีที่แล้ว

    Can I get the library for random number generator.

  • @MosheAshkenazi-rk3re
    @MosheAshkenazi-rk3re ปีที่แล้ว

    can you share the code?

  • @rubenmanuelgarciaroque6378
    @rubenmanuelgarciaroque6378 ปีที่แล้ว

    Hi! Can ANY data type be used to pass any structure as an input?

    • @GuillermoRuiz-Camauer
      @GuillermoRuiz-Camauer 27 วันที่ผ่านมา

      Yes, but you will not know the structure datatype, just that it is a structure. You will need to pass in the data type as a parameter to your function so that it knows how to treat it.

  • @20k38
    @20k38 ปีที่แล้ว

    It is very helpful. I have watched this many times to understand. Thanks for sharing your knowledge.

  • @marcio1516
    @marcio1516 ปีที่แล้ว

    Very nice explanation about polimorfism. I was looking for an easy way to understand it using the codesys environment. Thanks a lot!

  • @johnmhedges
    @johnmhedges 2 ปีที่แล้ว

    Hi there, Geat videos! I've not used interfaces or inheritance in my projects before. What is the advantage of using this type of implementation versus simply creating specific functions or funtion blocks? For example, just having a function for calculating area each shape and returning a result.

    • @atu1330
      @atu1330 2 ปีที่แล้ว

      For me personally there are some reasonable reasons. 1. An interface / abstract class allows you to guarantee that certain methods exist and return the required types. When the compiler knows this, it can use that assumption to work with unknown classes as if they had certain known behavior. 2. If the classes C, D, E,… implement an interface or inherit a abstract base class AI, you can use a C, D, E,… whenever an AI is expected. Simple example is the function that returns the area of a shape. The function does not care what kind of shape it is passed to it, but if it’s a shape, it will calculate its area. When you don’t have an interface you have to have a explicit function for every shape, in other words, where C is expected you can‘t pass D, you can only pass C. So you need the explicit shape. 3. If you use an abstract class, you can have explicit methods with a default implementation, that are provided to all children classes. Let’s say as an example the calculation of all shape areas is very heavy and complicated. For these we should provide some common functionalities to help us with the calculation. We can create some concrete methods (the common functionalities) and use these methods for the calculation of every area in every child class, you don’t need to copy/paste those to every new function block (circle, triangle….) or break the encapsulation of a class. In simple words, when you provide the concrete methods in the base class, all child classes can have their own implementation of the area, but use the common methods of the base class without having to define those for every shape. 4. You will have a better code maintainability.

    • @johnmhedges
      @johnmhedges 2 ปีที่แล้ว

      @@atu1330 That's very helpful to know! Thanks for taking the time to explain further 😊

  • @CodeX787
    @CodeX787 2 ปีที่แล้ว

    Is the AT&U library available, so I can run some tests?

    • @atu1330
      @atu1330 2 ปีที่แล้ว

      I will provide everything soon in the github repository.

  • @CodeX787
    @CodeX787 2 ปีที่แล้ว

    Great content 👍👍

  • @romicabeschea9488
    @romicabeschea9488 2 ปีที่แล้ว

    Great content. Thanks!

  • @boskoloncar3040
    @boskoloncar3040 2 ปีที่แล้ว

    How would this work with passing in an array of interfaces?

  • @hburd7627
    @hburd7627 2 ปีที่แล้ว

    make the code available for everybody!

  • @stefanhenneken217
    @stefanhenneken217 2 ปีที่แล้ว

    good job. The video is a good introduction to __NEW and __DELETE with all its pitfalls. Great!

  • @thala1505
    @thala1505 2 ปีที่แล้ว

    My only suggestion is to interlock at line No 4 in the IF logic with AND (IN_ToSort[_diIdx_2 + 1] <> ''). This is just to avoid comparing if null string in array then no need to sort with that particular element. If in case array has few null strings then it sorts and keeps that null in top. Excellent share, Thanks a lot for the help too 🙂

  • @ypkapo2
    @ypkapo2 2 ปีที่แล้ว

    You can share the project?

  • @ghosthunter9897
    @ghosthunter9897 2 ปีที่แล้ว

    Thanks man 🙏 Can you please explain in which case one may need bubble sorts algo in PLC?

    • @HermanWillems
      @HermanWillems ปีที่แล้ว

      I used it alot. I rather say: Why not?

  • @sumanlwagun3780
    @sumanlwagun3780 2 ปีที่แล้ว

    Thanks for the clear explanation bro.

  • @endprg6477
    @endprg6477 2 ปีที่แล้ว

    It is a pity that the video is not in Russian. But it's still useful. Keep going maestro...)

  • @Runtimevic
    @Runtimevic 2 ปีที่แล้ว

    very good, if you could host it somewhere it would be very good, to be able to have the example projects ... Thanks for everything.

    • @atu1330
      @atu1330 2 ปีที่แล้ว

      Hey Victor, thanks for your suggestion. I’m gonna create a git repository and you will be able to download the source code from the videos. Please have some patience until I am able to do it.

    • @Runtimevic
      @Runtimevic 2 ปีที่แล้ว

      @@atu1330, thanks you 👍🏻😉

    • @Runtimevic
      @Runtimevic 2 ปีที่แล้ว

      @@atu1330, thanks you

    • @Runtimevic
      @Runtimevic 2 ปีที่แล้ว

      @@atu1330 , have you had time to create the repository?, thank you very much for everything...

    • @atu1330
      @atu1330 2 ปีที่แล้ว

      Hey Victor, you can find some of the programs in the repositories. All the projects are saved as Archive. github.com/ATandU?tab=repositories

  • @Runtimevic
    @Runtimevic 2 ปีที่แล้ว

    very good, if you could host it somewhere it would be very good, to be able to have the example projects ... Thanks for everything.

  • @Runtimevic
    @Runtimevic 2 ปีที่แล้ว

    very good, if you could host it somewhere it would be very good, to be able to have the example projects ... Thanks for everything.

  • @Runtimevic
    @Runtimevic 2 ปีที่แล้ว

    very good, if you could host it somewhere it would be very good, to be able to have the example projects ... Thanks for everything.

  • @dexterfoley2701
    @dexterfoley2701 2 ปีที่แล้ว

    Decent this is!! This channel needs P R O M O S M!

  • @sandeepladdha3916
    @sandeepladdha3916 2 ปีที่แล้ว

    Thanks for the data logging info. But Where can i find the above project? Thank u.

  • @meganivanova
    @meganivanova 3 ปีที่แล้ว

    Your videos are of great help to me, thanks again!

  • @meganivanova
    @meganivanova 3 ปีที่แล้ว

    Thank you, it’s been so helpful!

  • @mattkurantowicz
    @mattkurantowicz 3 ปีที่แล้ว

    More videos please :)

  • @BoxerliMurat
    @BoxerliMurat 3 ปีที่แล้ว

    <identifier> : REFERENCE TO <data type> Example A : REFERENCE TO DUT; B : DUT; C : DUT; A REF= B; // corresponds to A := ADR(B); A := C; // corresponds to A^ := C;