Marco8037

MrPLC Member
  • Content count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Marco8037

  • Rank
    Sparky

Profile Information

  • Country Portugal
  1. Hello Nick. Thanks for your quick answer. Yes, you are right when you say that a "DT" variable is is the number of seconds since 1970. By the way I shall be able to calculate each one of my variable outputs. However, it is not so easy as we can think at a first time, because for an exact calculation of the variable outputs we have to consider that there are a different number of secconds in defferent years, because of the leap years (years with 366 days). About the months, it happens the same: Months with 30 and 31 days (different number of secconds in different months). By the way my problem cannot be solved with some simple divisions and simple MOD (Instruction to calculate the remainder). We have also to consider that on February we sometimes have 28 days and sometimes 29. However, I have considered all this situations and I have made a programming code to calculate my variables. I have tested it and it is running well. But I still have a little problem (I will talk about it in some lines after). Let me explain first how I have made the code: At the first time I have created a Struct like this: TYPE MY_Own_time_struct : (* MY_Own_time_struct - similar to "System Time Structure" on TwinCAT PLC Utilities Library *) STRUCT wYear : UINT; (* Year: 1970..2106 *) bMonth : USINT; (* Month: 1..12 (January = 1, February = 2 and so on )*) bDay : USINT; (* Day of the month: 1..31 *) bHour : USINT; (* Hour: 0..23 *) bMinute : USINT; (* Munute: 0..59 *) bSecond : USINT; (* Second: 0..59 *) END_STRUCT END_TYPE That's easiest to check it in the following drawing (Because the forum erases the spaces in the programming code): Then, I have created my Function block to calculate my outputs (Year, month, day, etc...). That Fb puts the calculation result on an output variable of "MY_Own_time_struct " type. I gave "Calculate_YEAR_MONTH_DAY_ETC" name to that FB. The variables declaration is the following one: FUNCTION_BLOCK Calculate_YEAR_MONTH_DAY_ETC VAR_INPUT PDT: DT; (*Preset date and time*) END_VAR VAR_OUTPUT Calendar: MY_Own_time_struct; (*Struct with YEAR, MONTH, DAY, Hour, minute and seccond*) END_VAR VAR Consec_4_YEARS: USINT; (*Nr. of set (group) of 4 consecutive years*) Nr_secconds: UDINT; (*Number of secconds*) Remain_secconds: UDINT; leap_year: BOOL; years_more: USINT; sec_in_this_year: UDINT; (*Nr. of secconds on the actual year*) sec_in_this_month: UDINT; END_VAR That's easiest to check it in the following drawing: Then, I have made the following programming code: Nr_secconds:= DT_TO_UDINT(PDT); (*Calculation of the year*) Consec_4_YEARS:= UDINT_TO_USINT(Nr_secconds / 126230400); Remain_secconds:= Nr_secconds MOD 126230400; CASE Remain_secconds OF 0..31535999: leap_year:=FALSE; years_more:= 1; sec_in_this_year:=Remain_secconds; (*useful for the calculation of the month*) 31536000..63071999: leap_year:=FALSE; years_more:= 2; sec_in_this_year:=Remain_secconds - 31536000; (*useful for the calculation of the month*) 63072000..94694399: leap_year:=TRUE; years_more:= 3; sec_in_this_year:=Remain_secconds - 63072000; (*useful for the calculation of the month*) 94694400..126230399: leap_year:=FALSE; years_more:= 4; sec_in_this_year:=Remain_secconds - 94694400; (*useful for the calculation of the month*) END_CASE Calendar.wYear:= 1969 + (Consec_4_YEARS * 4) + years_more; (*Calculation of the month*) CASE sec_in_this_year OF 0..2678399: (*There are 86400 secconds in a whole day. There are 2678400 secconds on a month with 31 days. On seccond nr. 2678399, we are still in January. When 2678400 secconds are reached, it means we are already on February month*) Calendar.bMonth:= 1; sec_in_this_month:= sec_in_this_year; 2678400..5183999: (*considering a leap year - month with 29 days*) Calendar.bMonth:= 2; sec_in_this_month:= sec_in_this_year - 2678400; IF NOT leap_year THEN (*considering a no leap year - month with 28 days*) IF sec_in_this_year > 5097599 THEN (*considering a no leap year - Day 29 --- Replaced by 1st of March*) Calendar.bMonth:= 3; sec_in_this_month:= sec_in_this_month - 2419200; END_IF END_IF END_CASE (*It's necessary to close dthe CASE instruction to the 86400 increment has effect*) IF NOT leap_year THEN (*considering a no leap year - month with 28 days*) sec_in_this_year:= sec_in_this_year + 86400; (*Useful for using the same calculation method for the other months*) END_IF (*from now on, we will consider a leap year, even it is not true - February month with 29 days*) CASE sec_in_this_year OF 5184000..7862399: Calendar.bMonth:= 3; sec_in_this_month:= sec_in_this_year - 5184000; 7862400..10454399: Calendar.bMonth:= 4; sec_in_this_month:= sec_in_this_year - 7862400; 10454400..13132799: Calendar.bMonth:= 5; sec_in_this_month:= sec_in_this_year - 10454400; 13132800..15724799: Calendar.bMonth:= 6; sec_in_this_month:= sec_in_this_year - 13132800; 15724800..18403199: Calendar.bMonth:= 7; sec_in_this_month:= sec_in_this_year - 15724800; 18403200..21081599: Calendar.bMonth:= 8; sec_in_this_month:= sec_in_this_year - 18403200; 21081600..23673599: Calendar.bMonth:= 9; sec_in_this_month:= sec_in_this_year - 21081600; 23673600..26351999: Calendar.bMonth:= 10; sec_in_this_month:= sec_in_this_year - 23673600; 26352000..28943999: Calendar.bMonth:= 11; sec_in_this_month:= sec_in_this_year - 26352000; 28944000..31622399: Calendar.bMonth:= 12; sec_in_this_month:= sec_in_this_year - 28944000; END_CASE (*Calculation of the day*) Calendar.bDay:= UDINT_TO_USINT((sec_in_this_month / 86400) + 1); (*There is 86400 secconds per day. It is necessary to increment 1 unit because the day nr. 0 doesn't exist*) Remain_secconds:= sec_in_this_month MOD 86400; (*The variable "Remain_secconds" has now the nr. of secconds in this day*) Calendar.bHour:= UDINT_TO_USINT(Remain_secconds / 3600); (*There is 3600 secconds per hour. It is not necessary to increment 1 unit because the hour nr. 0 exists*) Remain_secconds:= Remain_secconds MOD 3600; (*The variable "Remain_secconds" has now the nr. of secconds in this hour*) Calendar.bMinute:= UDINT_TO_USINT(Remain_secconds / 60); (*There is 60 secconds per minute. It is not necessary to increment 1 unit because the minute nr. 0 exists*) Calendar.bSecond:= UDINT_TO_USINT(Remain_secconds MOD 60); That's a code too large to make a Print screen and show with a drawing, but you can easily make a Copy paste to twincat a see the effect. Then, I have made this Fb runs on the Main POU. If you want you can copy and paste a see it running as well. I've tested it and it runs very well with all the entered input dates, as you can see in the following example: As you can see on this example, all the calculated values are rigth. You can test with some other Date_and_time input values and the output will be always correct, independently of the year, month, etc... (It doesn´t matter if iot is a leap year or not. And it doesn't matter if there are 28, 29, 30 or 31 days on the month of proccessing date and time). The output result is always right. About the calculation method for my outputs, I have my problem solved. At this time, the problem is the following one: I intend to use this code on an application that needs an internal running clock. I need to know the exact actual date and time to make the calculation of the input variable of DT in the FB. For example: -I Know that the actual Date and time is, for example: DT#2010-01-26-20:15 -My programme determines that it will take for example 7 223 700 secconds to finish a parcel. What I need to know is: What will be the date and time when the parcel is finished? It will be easy to calculate: Converting "DT#2010-01-26-20:15" to UDINT and adding 7 223 700 secconds. Then, I will just need to convert the addition result to DATE_AND_TIME format and put that result on the input variable of the Function block that I have created. To do that, I only need an internal running clock that gives me the actual date and time. It should not be a problem if I would use an hardware of the CX family, since the CX has an internal clock running all the time. However, I will use an HMI operator terminal from beijer electronics that communicates with the beckhoff hardware with the ethernet ADS protocol. The problem is that the HMI operator terminal also have an internal running clock. When the operators set the date and hour, they will make it on the HMI operator terminal. By the way it will not be setted on the internal running clock of the beckhoff hardware. What I have to do is to synchronize the 2 clocks. To do it, I have spent some of my time reading the help menu of the twincat and I have found a code similar to the following one to do that: The function blocks "NT_GetTime" and "RTC" can be found on the twincat "TcUtilities" library. My doubt is if it only runs well with a Terminal AMS Net ID of a beckhoff hardware or if it will also runs well with the Net ID of the beijer HMI terminal. I still don't know if I am going to use the CX or the BC or BX family. Twincat help says that when using a BC family the RTC instruction has a potential error of about 1 minute in each 24 hours. If I can cyclicaly syncronise it with the HMI operator terminal, it will not be a problem for my application, because the error will also be cyclicaly corrected. At this moment, I cannot try it on because I have no one hardware to test. I'm almost finishing my programme code and I will choose an beckoff hardware platform soon. Of course that the beckoff hardware platform will depend on the size of the programming code and on the size of used data. Choosing it will also be something a little difficult for me: I think that when I make "Rebuild all" on twincat, the compiler should tell me if the proposed hardware was enough or not for the programming code that I have made. However, it happens something strange: On the PLC configuration I have selected PC or CX, like the following picture: I make "rebuild all", and the result is the following one: Then, I replace the library "TcUtilities" by the library "PlcSystemBC.Lb6". However, when I use the BC family, the Fb "NT_GetTime" is not available. By the way, how can I syncronise the BC real time clock with the HMI real clock? Twincat help says that, when using the BC family, " the RTC can be cyclically synchronised (e.g. with a radio clock or with a TwinCAT PC via the fieldbus).". Could anyone explain me this a little better, please? However, to see if the proposed PLC type is enough or not, for my aplication, I remove the Fb "NT_GetTime", and I select the PLC type BC or BX like the following drawing: I make "Rebuild all" and it appears the following error: Then, I keep the same PLC type (BC or BX) and I go to the "Resources" --> "Workspace" --> "Controller settings" and it is selected: "Defaut: BX5100" Then, I unselect the BX5100 and I select BX5200. Then I select BX5100 again and i make "rebuild all" again. It gives me the following 4 errors. I don't know how to eliminate them, but since they are about the RTC function block, I erase the RTC FB in my programming code and I eliminate the libraries about this FB and i make "rebuild all"again. the result is the following one: Now, my question is: Is the BX5100 enough to proccess my programming code or not? Thanks everyone. Marco
  2. Hello guys: I would like to get an way to get the year, month, day, hour, minute, and seccond in different variables, coming from a value on a DATE_AND_TIME variable. For example, using an FB like the following one: Where the IN and Output data of this FB is like this: FUNCTION_BLOCK DT_TO_year_month_day_hour_and_minute VAR_INPUT In_DT: DATE_AND_TIME; END_VAR VAR_OUTPUT Year: UINT; (*value from 1970 to 2106*) Month: USINT; (*value from 1 to 12*) Day: USINT; (*value from 1 to 31*) Hour: USINT; (*value from 0 to 23*) minute: USINT; (*value from 0 to 59*) secconds: USINT; (*value from 0 to 50*) END_VAR VAR END_VAR However, I only have the variables declaration. The programming code to do this seems very complicated for me. Does anybody have this code already done? Or, does anybody known an easiest way to do this? Thank you very much. Marco
  3. Hello all. I'm making a program where I use an HMI from exter to be connected to a PLC from Beckhoff. I am using the information designer to programme the HMI, twincat for the PLC and the beckhoff ads protocol to comunicate between the 2 equipments. I don't know yet what kind of PLC I am going to use, but I would like to get the actual date and time (of the HMI) on a variable to use on twincat. If I declare on twincat a global variable like this: Variable_date: DATE_AND_TIME; And if I import the variables from the rebuilded file on twincat, I cannot see the the variable "Variable_date" on the list of imported variables. Since the value on a DATE_AND_TIME variable is stored in secconds as an UDINT variable, begining from 1970/01/01 at 00h00m00sec., I could also declare the same variable as an UDINT variable to solve my problem. (An UDINT variable is imported successefuly). However, my question is: How can I write on that variable the actual date and time of the HMI terminal? If the variable "Variable_date" is declared as an UDINT variable I do the following on Information designer: Then, I have iserted an analog numeric: Then, I have filled the analog signal with the same variable: After this, I have run the HMI programme: I was expecting to see some numeric value on the analog numeric that I have created. However the shown value is 0. Does anybody know what am I doing wrong? Or does anybody know an easiest way to do this? Thanks very much. Marco Nunes
  4. V-series (moni-touch)

    Hello people. I am using the V-series editor V5.30 to program an HMI touch pannel from moni-touch. I would like to use it together with a beckhoff equipment connected via ethernet using the TWINCAT ADS driver. Does anybody know if there are any way to import the program variables from a twincat file? I can do that with the Information designer (the software for the beijer's HMI's) like the following drawing: In the green circle, I import the twincat file and then, all the variables appear on the red circle ready to use on HMI software from beijer. Is there any way to do the same in the V-series editor V5.30 for moni-touch HMI's? I have selected the ADS protocol as shown in the following picture: However, When I draw an object, like a push-button, for example, if I want to link it to a variable used on twincat file, I don't know how to do that. Please see the following picture: I have selected PLC1 for the blue push-button. PLC1 is the equipment with the beckhoff ADS driver. However, how can I link it to a variable? What is the P100-0 and 0000064-00 meaning? It would be much easiest if I could import the variables of my twincat file to my project. Is it possible to do? Thanks everyone.
  5. How to count pulses into DM?

    Hello: Use this code: Input pulse -----| |--------------@++ Dxx That's the intruction nr. 490 an is usel for a binary increment. (values , in decimal, from 0 to 65 535) Use The character "@" to count all the pulses. "@" means a differentiate up of the input. However, this is not the best way to count pulses, if the frequency is too hi. If the frequency input is too hi, by this way, your PLC will not count all the pulses. If you have a big frequency on the input, like an encoder, for example, there are a better way in the CJ1M to count the pulses. However it is only possible on the CJ1M CPU 21, CPU22 and CPU23. CPU 11; CPU12 and CPU 13 don't support that option. If you are using the CPU 21 or 22, or 23 I can tell you how to count the pulses in a frequency up to 100 kHz. let me know what CPU do you have and what do you have connected in the input. Do you have a sensor, an encoder,what kind of encoder? Encoder TTL, encoder push pull?
  6. Beckhoff BX5100 SSB

    Hello everyone. I have been making a programme on trial version of Twincat and now it is almost ready. (It is a translation of an old programme of mine running well on some machines with an Omron CJ1m PLC). Now I have to chose what CPU system will I go to use. I make "Rebuild all" on Twincat with the following configurations: - Target system type: BCxx50 or BX; - Work space: Controler settings: BX5100. When I make "rebuild all" it says: - POU indices: 187 (73 %); - Size of used data: 3449 bytes (21,05 %); - Size of used retain data: 886 bytes(43,26 %); - Code size: 91 624 bytes; - 0 errors / 65 warnings; (warnings are not a problem in my application). It seems the BX 5100 is enough to run my programme. In my application, I need to use a CANopen slave connection and an HMI connection. My question is: How can I connect an HMI to the BX 5100? On beckhoff web page, it is written on BX 5100 section the following lines: "Further peripheral devices, e.g. displays, can be connected via the integrated Beckhoff Smart System Bus (SSB)." Can I use the SSB port to connect an HMI? What Kind of HMI? When I run this programme on Omron PLC, I use the Omron NS HMI with the exclusive NT-link protocol of Omron. Using the same mark in PLC and HMI, I can easily make the HMI programme, since The HMI programme uses the same adresses used on the PLC. On twincat, I have my programme developed not with addresses, but with declared variables. What I would like to find was a touch panel display, where I could make my HMI programme using the same variables used on my twincat Programme. Is the SSB port the solution? And what kind on HMI shall I use? Or is there a better solution than this one? Thank you very much. Marco Nunes
  7. memory allocation on CoDeSys or TwinCAT

    Hello, I will try to help you, but since I am new on twincat, you can perhaps get better replies. I have never used VAR_CONF, but you can define a struct on Data types. For example: On data types, do the following code: TYPE TABLE_1 : STRUCT ON_OFF: ARRAY [1..4] OF BOOL; (*ON_OFF button*) Set_pieces: ARRAY [1..4] OF UINT; (*Setting number of pieces*) Act_pieces: ARRAY [1..4] OF UINT; (*Actual number of pieces*) END_STRUCT END_TYPE The struct you have defined is not a data memory area. By the way it not a variable and there is no memory to be allocated. However, after defining the structure, you can declare a variable of STRUCT type you have created. For example: On your programme (On you POU), make the following declarations: VAR Open_BUTTON: BOOL; (*Standard type*) Close_BUTTON: BOOL; (*Standard type*) value: UINT; (*Standard type*) My_table: TABLE_1; (*"My_table" is now a variable of type "TABLE_1". "TABLE_1" is the struct type that you have created*) END_VAR You can now use on your programme the following adresses, for example: My_table.ON_OFF[1] (*This is the name wich this variable is adressed*) My_table.ON_OFF[2] My_table.ON_OFF[3] My_table.ON_OFF[4] My_table.Set_pieces[1] My_table.Set_pieces[2] My_table.Set_pieces[3] My_table.Set_pieces[4] My_table.Act_pieces[1] My_table.Act_pieces[2] My_table.Act_pieces[3] My_table.Act_pieces[4] You can also adress the variables by the following way: My_table.ON_OFF (*This name represents the 4 different variables of the array of BOOL*) My_table.Set_pieces (*This name represents the 4 different variables of the array of UINT*) My_table.Act_pieces (*This name represents the 4 different variables of the array of UINT*) About declaring a STRUCT as DATA_BLOCK, like in siemens, I don't know what does it mean, since I am not expert in siemens. Is it simmilar to something possible to do in Omron? I hope this can help.
  8. HELP! I need to upload the Memory

    Hello. I have no experience uploading the memory from the CPU and downloading it again. But you can do the same by a diffrent way: If you know exatelly what is the addresses of the DM and HR and another king of non volatil memory areas you intend to upload from the old CPU to the new one you can do it by the way I will explain in the following lines. If you don't know all the memory areas, you can check what the non volatil addresses are beeing used in the program. Please do the following steps: 1. Make a note of that adresses: 2. Power supply the old CPU and connect your PC online 3. See the following picture: 4. Please open the Togle watch window (Red circle) 5. The Toggle watch window will appear. Make the monitorization in Decimal (Orange circle) 6. Write the addresses of non volatil memory areas wich value you intend to copy to the new CPU (Blue circle) 7. The value in that addresses will appear on the value column in decimal (Green circle). Please make a note of that values. 8. Power supply your new CPU and connect your PC online again 9. Open again the toggle watch window (Red circle) 10. The Toggle watch window will appear. Make sure the morization are still in Decimal (Orange circle) 11. Write the addresses of non volatil memory areas wich value you have maked a note (Blue circle) 12. Double-click on the value coloumn (Green circle). A pop-up window will apperar with an option to write a new value. (Certify yourself if there is on that window an option to set the new value in decimal - I'm not sure if it needed or not). Enter the values you have made a note. 12. Certify yourself that the program is running properly. If it is not everything ok, you can perhaps have forgotten to make a note of any non volatil memory adrees. If you have a lot of adresses to copy from the old CPU to the new one, it will take a several time to make this procedure, but this is an efficient way to do what you intend. Hope it can help. After doing it, please let me know if you succeed. I hope this can help.
  9. hello, Thank you very much by your quick answer. Unfortunately I have been a lot of work to do and I could not reply earlier. I could reproduce your code and it works perfectly. However, I have made a change on the function FillArray2, like the following picture: On this case, the variable "value" is not of WORD type but of Array of WORD type. By the way, I don't move the same value for all of the array elements, but I move each element value of "array_origin" ARRAY to the "array_destini" ARRAY. After it, I tried to use the same function to move element values of an array OF UINT to another array OF UINT. Since this function only works with arrays OF WORD, I had no success. Of course I could make another similar function, but to move elements of arrays OF UINT. But I have tried something like the following example: However, when I make "rebuild" it gives me an error: Of course: the BOX UINT_TO_WORD only converts a UINT variable to a WORD variable, and it cannot convert an array of UINT to an array OF WORD. My question is the following one: Is there any way to convert the elements type of an array? Could you also tell me, if you know the difference between an UINT type variable and an WORD type variable? In my opinion it seems there are no difference because the two ones have 16 bits and can have a decimal value from 0 to 65535. Can you see some other aspect that can distinguish the two ones? Thank you very much.
  10. Thank you very much. I have understood very well how to set / reset each bit individually of an WORD. When I told I am expert in Omron, it was only to say that I now much more about Omron than Twincat. However, I have never used arrys in Omron, since I can make what I intend using just a special instructions that manipulate some variables by a specific order, as in the examples I have shown in the post. By the way, I am not familiarized with using of arrays. About the arrays declarations, I was looking at it and it seems not very dificult. But about making a function block to minipulate an array, it seems a little bit more complicated for me, because the great way to manipulate it is perhaps using a Cycle FOR, but I am not familiar with C programming. Making it on Ladder, I think is nat applicable. Could you please give me an example code of a function block to manipulate an array? Let's supose the following example: VAR ArrayVariabe : ARRAY [0..10] of WORD; END_VAR In the programme I know I identify each word of the array like this: ArrayVariabe [0] ArrayVariabe [1] ArrayVariabe [2] ... ArrayVariabe [9] ArrayVariabe [10] If I try to make a FB in Ladder, I can have an input variable type WORD with the name "value". In Ladder I can move the variable "value" to each part of the array 10 times. But how can I make a code to move it only once, moving the same value to all the array parts? Thank you very much
  11. Hello everyone, I'm new on Twincat and expert on Omron. I'm trying to do on twincat some things that were easily possible to do on Omron, but on Twincat I don't know if I can do the same by a similar way. On the examples, you don't need to be an expert on Omron because I explain the meaning of each code. Let's go to the examples: Example 1: Please see this code on Omron: On this code, "condition" is of type BOOL. When "condition" is TRUE, the MOV instruction moves the value 0 to the variable with name "variable". "variable" is of type WORD, by the way it has 16 bits. On Omron systems, each variable of type word have not only a name, but also a number. On this case, the variable with name "variable" is of WORD type an has the number 20. Since the variable with the number 20 is of WORD type, and have 16 bits, I can consider the following bits: 20.00 20.01 20.02 20.03 ... ... 20.14 20.15 If I need on my program 16 variables type bool, and if I want to reset all of them, I only need to move the value 0 to the correspondent word. On Twincat, the only one way that I know to do the same is the following one: On this case, When the "condition" is TRUE, I make reset to all of the 16 bits (Bit_0; Bit_1; Bit_3 ... to Bit_15 are variables of type BOOL). But, to do that, I have to write the same code 16 times (Each time for each bit), because the Reset instruction resets only one bit. My question is: Is there a diferent way on Twincat to reset all the bits at the same time? I think it could mabe be possible, using the MOV instruction, to move the value 0 to a specified variable of WORD type. But, How can I use each bit of that variable as a type BOOL variable? Example 2: Please see this code on Twincat: On this code, all the variables are of WORD type. I move the value on "variavel_20" to "variavel_50", the value on "variavel_21" to "variavel_51", the value on "variavel_22" to "variael_52" and the value on "variavel_23" to "variavel_53". To do that, I need to use 4 MOVE instructions. The following code on Omron makes the same, with only one instruction: On Omron, since each variable have not only a name, but also a number, I can use this instruction to move 4 consecutive words, while the first source WORD is the word number 20 (with the name "variable_20"), and the first destination word is the word number 50 (with the name "variable_50"). Since in Omron I use not the variable names, but its number, I can use unstructions like this. My question is: If I need to move 100 words (100 variables of WORD type) on Twincat, Will I need to write the same instruction 100 times? Or, Is there a different way to do this? Since on Twincat the variables have only a name to identify them, I think it could be possible if it was possible to define a buffer with some consecutive variables. But How can I do that? Example 3: Please see the following Twincat code: All the variables are of WORD type. On this code, I move the value on the variable "variavel_10" to all the variables with the names from "variavel_20" to "variavel_50". On Omron, I use only one instruction to do the same:
  12. Can not use correctely the function block in Twincat

    It has helped a lot.. You are right. In the ladder programming, sometimes it is necessary to start making the network from the end to the begining. I only didn't know that it was possible to add a box and transform it on a function block. For me this is a strange way to use the ladder diagram, since I am coming from standard PLC's, like Siemens and Omron, and on that PLCs it was possible to make the connections between any inputs and outputs blocks by a simple way and starting the diagram from the begining to the end. But now, with your help, I can make the same in the TwinCat system, but by a different way. Thank you very much.. Marco Nunes
  13. Hello everyone. I'm learning about twincat and I am using the Twincat demo version available for 30 days. I am using the library TcUtilities and I want to make on ladder the same code that I have seen on a Help manual for this library. That code is the following one: The code that I am trying to do in ladder is the following one: Why can I not connect the TON output (TON:Q) to the START input of NTGetTime(FB)? When I insert the NTGetTime(FB), that output is automaticaly connected to the NETID input, and I cannot change that connection. Is there any way to make the right connection as the code I have seen in the Help manual? Thank you everyone.
  14. Making a function block on TWINCAT

    Hello Nick. Yes it has helped a lot. I can now make my own function blocks. Thank you very much. Best regards.
  15. Making a function block on TWINCAT

    Hello everyone. I am new using Twincat and I have developed a little program that make an output blink all the time. The programme code is attached on file picture_1. I put the Twincat on Run mode and I can test the program running. When In turn ON the variable ENABLE, I can see the output BLINK alternating ON and OFF every 500ms. Now, I would like to make the same programme as a function block, but it is my firs function block and I don't know how to do it. Can someone correct me where I am wrong? To do the function block, I select NEW --> Target system type: PC or CX --> Type of POU: Function Block I have defined as VAR_INPUT the following ones: ENABLE - To turn ON the system (alternating the output ON and OFF) TIME_UP - Where I expect to define the time that the output BLINK is ON TIME_DOWN - Where I expect to define the time that the same output is OFF I have defined the VAR_OUTPUT the following one: BLINK - Where I expect see the the output blinking I have declared all the other variables as a VAR. However I have only one POU of type (FB). I have no one POU as type (PRG) When I try to Rebuild all (compile), it gives me an error with the following message: Error 3551: Task configuration (2): The task 'Standard' must contain at least one program call I don't know what to do to solve the problem, because since I have only one POU of (FB) type, I cannot append a Programm call. Could someone help me please?