Post by fefefede on Get the numer of day
CODESYS Forge
talk
(Post)
Hello i tro to create a program to turn on or off the air condition in relationship temperature and numer of day. I can't get the number of day. I try this after installing SysTime library but this not work and have this error on debug ------ Build started: Application: Device.Sim.Device.Application ------- Typify code... Generate code... [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0032: Cannot convert type 'Unknown type: 'SysTimeCore(TRUE)'' to type 'TIME' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0035: Program name, function or function block instance expected instead of 'SysTimeCore' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0032: Cannot convert type 'Unknown type: 'DayOfWeek(CurrentTime)'' to type 'INT' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0035: Program name, function or function block instance expected instead of 'DayOfWeek' [INFORMATION] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0181: Related position Build complete -- 4 errors, 0 warnings : No download possible PROGRAM PLC_PRG VAR Temperatura: UDINT; AriaCondizionata: BOOL := FALSE; CurrentDayOfWeek: INT; //Variabile Giorno CurrentTime: TIME; GiornoDellaSettimana: INT; DayOfWeek: INT; END_VAR CurrentTime := SysTimeCore(TRUE); // Ottieni l'ora corrente CurrentDayOfWeek := DayOfWeek(CurrentTime); CASE GiornoDellaSettimana OF 1: // Azioni per Lunedì 2: // Martedì se più 10° accend altrimenti spegni IF Temperatura >= 10 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 3: // Mercoledì se più di 50° accendi altrimenti spegni IF Temperatura >=50 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 4: // Giovedì se più di 40° accendi altrimenti spegni IF Temperatura >=40 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 5: // Venerdì se più di 50° accendi altrimenti spegni IF Temperatura >=50 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 6: // Sabato se più di 25° accendi altrimenti spegni IF Temperatura >=25 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 7: // Domenica sempre spenta AriaCondizionata := FALSE; END_CASE
Last updated: 2023-09-14
Post by alexgooi on Modbus writing on value change
CODESYS Forge
talk
(Post)
The way I usally tackle this is by syncing only words (then you are able to use the FB above). If you then want to write a Boolean simply type it like this. Value[1].0 := Bool1; Value[1].1 := Bool2; Value[1].2 := Bool3; Uints have the same number of bits than a INT/WORD so these ones will work as well (they are only represented diffrently). A Real will work but you will loose some infomration in the conversion. If you want to keep the information you can convert 2 words to a float with a function (for example with the IEEE-754 standard) . In this way the syncing to the server is very simple and in the Codesys Program you decide what part of the word you want to use.
Last updated: 2024-04-03
Post by ewi04 on Recipe Manager - RecipeManCommands, load & write wrong values, Bug?
CODESYS Forge
talk
(Post)
Hallo, I have a strange problem with the recipe manager. ISSUE: When using RecipeManCommands not all values are loaded correctly. Saving a recipe with CreateRecipe(), ReadAndSaveRecipe() or ReadAndSaveRecipeAs() works without any problems. BUT: LoadRecipe(), WriteRecipe() or LoadFromAndWriteRecipe() do not load the data correctly. It is Interesting that we have a different error pattern with LoadRecipe() than with WriteRecipe() or LoadFromAndWriteRecipe(). LoadRecipe() does not load all data and WriteRecipe() or LoadFromAndWriteRecipe() overwrites some data or assigns it incorrectly. And it is also strange that LoadRecipe() writes the values to the PLC. Normally it doesn’t do it. It makes no difference whether the memory type is textual or binary. I have an object consisting of STRUCTs which is inserted in the recipe definition. Environment: Codesys V3.5 SP19 Patch 4 (64Bit), Recipe Management 4.2.0.0 *Add a project (reduced to the problem)
Last updated: 2023-11-15
Post by dhumphries on Rounding error in simple addition
CODESYS Forge
talk
(Post)
Thanks for the response, as I've thought about this problem over the last month I began to suspect this was a problem with not being able to exactly represent .1 as a 32 bit binary number. I think I've found a work around by making the number an integer, then dividing it by 10 and storing that value as a floating point number. There is still an issue with the value not being exact somewhere in the 8th or 9th decimal place, but because I'm incrementing an integer value then dividing it, the error doesn't compound.
Last updated: 2024-05-25
Post by hua-huang on Compile problem - can't get .bin or .h86 file
CODESYS Forge
talk
(Post)
Hello, I am programming for IFM controller CR7132, after I check 'create binary file of the application' and 'rebuild all', there is no error when compiling but no .bin or .h86 file generated. Could someone please inform the correct way? Thanks in advance! BR, Hua
Last updated: 2024-09-12
Post by r-niedermayer on C0564 Warning Message
CODESYS Forge
talk
(Post)
Please see or Online Help on how to initialize variable before using them: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_pragma_attribute_global_init_slot.html Regarding the Attribute global_init_slot: You can use this pragma to influence the order in which signatures are processed during global initialization. It can only be applied to signatures. By default, the initialization sequence for variables from global variable lists is undefined! However, if, for example, variables from one list depend on variables from another list, it is necessary to initialize one before the other. (Aee OLH and Syntax) The placeholder <slot> must be replaced by an integer value that defines the position in the initialization sequence.</slot> The default value is 50000. A lower value causes an earlier initialization! If several signatures have the same value for the 'global_init_slot' attribute, the order of their initialization remains undefined! Cautious application should therefore be considered! Example: The project contains f.e. two global variable lists GVL_1 and GVL_2. The global variable "A" is part of the global variable list GVL_1: {attribute 'global_init_slot' := '300'} VAR_GLOBAL A : INT:=1000; END_VAR The initialization values of the variables "B" and "C" of GVL_2 are dependent on the variable "A". {attribute 'global_init_slot' := '350'} VAR_GLOBAL B : INT:=A+1; C : INT:=A-1; END_VAR So if you set the 'global_init_slot' attribute of the global variable list GVL_1 to 300, i.e. to the lowest initialization value in the example, then it is ensured that the expression "A+1" is well-defined at the time of initialization of "B".
Last updated: 2024-01-30
I want to convert a WORD to a hex string like 15.432 to '3C48'
CODESYS Forge
talk
(Thread)
I want to convert a WORD to a hex string like 15.432 to '3C48'
Last updated: 2024-04-19
How to allow a user to handle certificates without access to sourcecode?
CODESYS Forge
talk
(Thread)
How to allow a user to handle certificates without access to sourcecode?
Last updated: 2024-08-07
how to add module to raspberry pi
CODESYS Forge
talk
(Thread)
how to add module to raspberry pi
Last updated: 2020-11-24
how to set custom from/to timestamp in Trend
CODESYS Forge
talk
(Thread)
how to set custom from/to timestamp in Trend
Last updated: 2020-03-31
Unable to connect to git remotes through Codesys.
CODESYS Forge
talk
(Thread)
Unable to connect to git remotes through Codesys.
Last updated: 2023-11-10
Codesys to Android App to Cloud Database
CODESYS Forge
talk
(Thread)
Codesys to Android App to Cloud Database
Last updated: 2022-03-10
How to map to values in CAN BUS
CODESYS Forge
talk
(Thread)
How to map to values in CAN BUS
Last updated: 2021-04-29
Using Codesys WebClinet to talk to Sensibo API
CODESYS Forge
talk
(Thread)
Using Codesys WebClinet to talk to Sensibo API
Last updated: 2021-07-20
How to add a VFD to Codesys
CODESYS Forge
talk
(Thread)
How to add a VFD to Codesys
Last updated: 2023-05-12
How to convert Function block diagram to Structured text
CODESYS Forge
talk
(Thread)
How to convert Function block diagram to Structured text
Last updated: 2015-05-04
How to save sensor values ​​to a file
CODESYS Forge
talk
(Thread)
How to save sensor values ​​to a file
Last updated: 2023-02-22
HMI will not connect to PLC to display visu.
CODESYS Forge
talk
(Thread)
HMI will not connect to PLC to display visu.
Last updated: 2020-02-28
how to Connect CodeSys to many devices?
CODESYS Forge
talk
(Thread)
how to Connect CodeSys to many devices?
Last updated: 2017-08-16
how to communicate codesys to other PLC
CODESYS Forge
talk
(Thread)
how to communicate codesys to other PLC
Last updated: 2011-07-06
Not able to connect to Codesys Gateway on locl machine...
CODESYS Forge
talk
(Thread)
Not able to connect to Codesys Gateway on locl machine...
Last updated: 2021-03-12
How to convert UDINT to array of bytes ?
CODESYS Forge
talk
(Thread)
How to convert UDINT to array of bytes ?
Last updated: 2023-03-10
how to Connect CodeSys to many devices ?
CODESYS Forge
talk
(Thread)
how to Connect CodeSys to many devices ?
Last updated: 2017-08-17
Connect to telnet server. Where to start?
CODESYS Forge
talk
(Thread)
Connect to telnet server. Where to start?
Last updated: 2022-06-23
Unable to generate chm due to Pi library warning... [solved]
CODESYS Forge
talk
(Thread)
Unable to generate chm due to Pi library warning... [solved]
Last updated: 2018-01-29
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.