CODESYS: Declaring and using "Structure" in the structured text (ST) programming

  Рет қаралды 33,484

Tohid Alizadeh

Tohid Alizadeh

Күн бұрын

Пікірлер: 22
@joshuajavier5158
@joshuajavier5158 Жыл бұрын
Thank you for your videos but Im curious when should I use the DUT or Struct and when will I use the Global List..
@TohidAlizadeh
@TohidAlizadeh Жыл бұрын
Thanks for your comment. You normally create and use a global variable (which will be inside a global variable list) when you need to have access to the variable globally in the project, from any of the POUs. Global variables could be Boolean, Integer, or of any type. While DUT is declared and used to fit your needs for a specific variable, which could be used only within a single POU, or could be placed in a global variable list. I hope this helps.
@ahoxha9748
@ahoxha9748 8 жыл бұрын
Hello Mr. Tohid, Thank you for allowing us to access this great work. I am interested in Structured Text(ST), i have a project in twincat(visual studio) which is the same as codesys, and i'm trying to figure it out. There is a Function block (FB) which contains most of the code logic, and other structs, one Global variable list, and the Main(PRG) program of course where there are only variable declarations and the inheritance of FB in PRG. I wanted to ask what is the reason of using FB and Global Variables when we could use just Main(PRG) and structs. I checked your tutorials of ST but there aren't many. I've been searching on internet about ST tutorials but i had no luck, do you know any website which could provide broader information about the language.
@TohidAlizadeh
@TohidAlizadeh 8 жыл бұрын
+Admir Hoxha Thanks a lot for your comment and interest in my videos. I would say that the main aim of using Function Blocks (FBs) is to make the programming easier and more organized. Specially, when you want to do a specific task (piece of code) more than once in the main program. Then it would be better to create a FB and refer to that. You may use your created FB later on in some other project as well, saving you the time and effort. the concept is somehow similar to the idea of creating Functions in Matlab and using them later as well (if you are familiar with Matlab). The aim of using Global variable list, is to create variables which are accessible all around the project (in the main program, FBs, ...).I hope this comment would be helpful for you. I may later leave another comment providing resources on ST.
@ahoxha9748
@ahoxha9748 8 жыл бұрын
+Tohid Alizadeh Thank you, I'm grateful
@abdullaheisajan2300
@abdullaheisajan2300 5 жыл бұрын
Hello Tohid, Thank you for the great tutorial videos you make. I was wondering why my counter doesn't get reset after reaching the PV value, or is it that the PV value is used for something else. Thanks in advance.
@TohidAlizadeh
@TohidAlizadeh 5 жыл бұрын
The counter continues to count even after reaching the PV value. It's output becomes True once it passes the PV value. To reset the counter, you should use the Reset input of the counter.
@muhammaddanish4253
@muhammaddanish4253 Жыл бұрын
So it seems struct variables are not global variables ,so you can not directly access using it you need to instantiate that structure first in program?
@TohidAlizadeh
@TohidAlizadeh Жыл бұрын
That's true. With Struct you create a new type of variable. You can instantiate a variable of the new type in the global variable list, if needed.
@azamafzaal769
@azamafzaal769 7 жыл бұрын
Hello Tohid, can you please upload a video creating functions/methods and calling them in the main program (ST)
@TohidAlizadeh
@TohidAlizadeh 7 жыл бұрын
Hi Azam, I will try to do so in the following days, however, for now, you can have a look at the following video, where TON and CTU function blocks are called within ST:kzbin.info/www/bejne/Y3e8l6yvmputhNU and this one, where you learn how to create Function blocks (in LLD, but you can do it with ST as well): kzbin.info/www/bejne/iX20dqeKq85mo5o Then, you can call the created function in a similar way to calling TON/CTU. I hope this will help you!
@azamafzaal769
@azamafzaal769 7 жыл бұрын
Thanks but i have seen this video already. I need to make a custom ST function/method and then calling it in the main program e.g. a derivative function (P.S. i know its already in the util library but i am not allowed to use it for my project)
@TohidAlizadeh
@TohidAlizadeh 7 жыл бұрын
I see. I will try to prepare the video till next week. I will update you here!
@TohidAlizadeh
@TohidAlizadeh 7 жыл бұрын
This video is for you: kzbin.info/www/bejne/oGrNnWpsaZVja9k I hope you will find it useful.
@V3loxX
@V3loxX 3 жыл бұрын
How can I use structs on more level? I mean struct in a struckt.
@TohidAlizadeh
@TohidAlizadeh 3 жыл бұрын
I think you only need to declare one structure first (call it struc01, for example), then in declaring the second structure, use struc01 as one element.
@ahsankhalid6672
@ahsankhalid6672 5 жыл бұрын
Hello :) Your videos are really helpful. I would like to suggest that before explaining the actual program, it would be great if you first explain the topic on which you have written the program. In the case of this video, you should've explained what structures actually are and what are their uses. Otherwise, I really like your way of explaining.
@TohidAlizadeh
@TohidAlizadeh 5 жыл бұрын
Thanks a lot for your valuable feedback, Ahsan. I will consider it in my next videos (if I manage to make).
@tarrensmith9657
@tarrensmith9657 8 жыл бұрын
Hello Tohid, thank you for the great videos. Excuse my ignorance, but what is the purpose of a structure, why would you use it?
@TohidAlizadeh
@TohidAlizadeh 8 жыл бұрын
+tarren smith Dear Tarren, Structure type variables can contain more information within only one variable. When you want to group a set of variables which are related to each other in some sense, you can create a structure variable, and use each of those variable as the fields of the structure. Think about the Timers and Counters. Referring to them as a variable, you deal only with a single variable, Timer01 for example, however, you have some fields for the variable as Timer01.IN, Timero1.Q, Timer01.PT and Timer01.ET. In general, having Structure type variables makes the programming easier and the variables more compact. I hope this would help you. Let me know if you have any other concerns. You can also refer to the Google+ community, where I provide some more explanation in the written form, for the videos: plus.google.com/u/0/communities/114767566156039270858
@tarrensmith9657
@tarrensmith9657 8 жыл бұрын
+Tohid Alizadeh Thank you so much Tohid, this makes perfect sense. Thank you for your time and patience and great tutorials.
@jamiecoates9891
@jamiecoates9891 4 жыл бұрын
Sorry, poorly explained.
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 7 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 56 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 116 МЛН
Codesys #18 Structure
11:04
Industrial Automation
Рет қаралды 3,3 М.
Codesys #19: Enumeration
16:09
Industrial Automation
Рет қаралды 3,6 М.
CODESYS - Difference between pointer and reference
14:02
CODESYS PLC Programming: Tips for Maximizing Performance
7:22
Codesys Visualization - How to Display Dynamic Values in Visualization Pages
17:30
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 7 МЛН