Search talk: CAST LREAL INT

 
<< < 1 2 3 4 .. 6 > >> (Page 2 of 6)

Convert 2 INT to Real CODESYS Forge talk (Thread)
Convert 2 INT to Real
Last updated: 2021-08-15

Converting LREAL to binary and interpreting it as base 10 LINT CODESYS Forge talk (Thread)
Converting LREAL to binary and interpreting it as base 10 LINT
Last updated: 2022-01-20

Post by chaylak on MC_ReadActualPosition with ST code CODESYS Forge talk (Post)
hi everyone, i am trying use MC_ReadActualPosition module in ST but i cant do it,( if i use CFC yes i read it) my axis is SoftMotion General Axis Pool->VirtAxisZ [Device: SoftMotion General Axis Pool] codesys V3.5 SP20 program: PROGRAM PLC_PRG VAR VirtAxisZ : AXIS_REF_VIRTUAL_SM3; fbPowerZ : MC_Power; fbReadPos : MC_ReadActualPosition; bEnable : BOOL := TRUE; lrActPos : LREAL; bValid : BOOL; bError : BOOL; fbResetZ : MC_Reset; xZ_Valid : BOOL; xZ_Busy : BOOL; xGlobalPower : BOOL; xGlobalReset : BOOL; xBtnTeachingMode : BOOL; lrGrvZ_OffsetTorque : LREAL := 0.5; lrPulseMmZ : LREAL; rPosFromBlock : LREAL; xZ_IsPowered : BOOL; xZ_PowerError : BOOL; iZ_PowerErrorID : LREAL; rZ_ActualPos : LREAL; lrTargetTorque : LREAL; sZ_ErrorString : STRING; //********** jog fbJogZ : MC_Jog; xJogForward : BOOL; xJogBackward : BOOL; rZ_ActVelocity : REAL; END_VAR fbResetZ( Axis:= VirtAxisZ, Execute:= xGlobalReset); fbPowerZ( Axis:= VirtAxisZ, Enable:= xGlobalPower, bRegulatorOn:= xGlobalPower, bDriveStart:=xGlobalPower , Status=> xZ_IsPowered, Busy=> xZ_Busy, Error=> xZ_PowerError, ErrorID=> iZ_PowerErrorID ); IF xGlobalPower THEN fbJogZ( Axis:= VirtAxisZ, JogForward:= xJogForward, JogBackward:= xJogBackward, Velocity:= 100, Acceleration:= 100, Deceleration:= 100, Jerk:= 1000); END_IF fbReadPos( Axis := VirtAxisZ, Enable := TRUE, Valid => bValid, Position => lrActPos, Error => bError ); IF VirtAxisZ.bError THEN sZ_ErrorString := 'Z Ex err'; ELSIF NOT xZ_IsPowered THEN sZ_ErrorString := 'Z Ex (Power Off)'; ELSE sZ_ErrorString := 'Z Ex Ready'; END_IF IF xBtnTeachingMode THEN lrTargetTorque := lrGrvZ_OffsetTorque; ELSE lrTargetTorque := 0; END_IF VAR_INPUT CFC_Motion: INT; END_VAR
Last updated: 2026-05-15

kopieren einer INt Variable in einer Funktion CODESYS Forge talk (Thread)
kopieren einer INt Variable in einer Funktion
Last updated: 2010-08-27

Convert 2 diff type of int to real type CODESYS Forge talk (Thread)
Convert 2 diff type of int to real type
Last updated: 2021-08-17

convert INT Type to STRING Type CODESYS Forge talk (Thread)
convert INT Type to STRING Type
Last updated: 2009-10-22

Pack TWO INT variable to one DINT variable CODESYS Forge talk (Thread)
Pack TWO INT variable to one DINT variable
Last updated: 2024-05-07

Unexpected behavior in cyclic encoder read method during INT overflow (wrap-around) CODESYS Forge talk (Thread)
Unexpected behavior in cyclic encoder read method during INT overflow (wrap-around)
Last updated: 2025-05-13

Zugriff auf BYTE in einem WORD / INT in einem DINT etc... CODESYS Forge talk (Thread)
Zugriff auf BYTE in einem WORD / INT in einem DINT etc...
Last updated: 2023-01-19

Cannot convert type 'Unknown type: 'ADR(tabOrderIdArray)" to type 'POINTER TO ARRAY [0..0]OF INT' CODESYS Forge talk (Thread)
Cannot convert type 'Unknown type: 'ADR(tabOrderIdArray)" to type 'POINTER TO ARRAY [0..0]OF INT'
Last updated: 2021-04-26

How do I convert an INT variable to a TIME variable? CODESYS Forge talk (Thread)
How do I convert an INT variable to a TIME variable?
Last updated: 2011-03-30

Extract 4 bytes from array of bytes to save in decimal value (int?) CODESYS Forge talk (Thread)
Extract 4 bytes from array of bytes to save in decimal value (int?)
Last updated: 2022-01-11

Post by abinvest579 on COP instruction CODESYS Forge talk (Post)
Hi All, I have hands on rockwell software like rslogix 5000 and studio 5000. Currently started working on codesys i want to know is there any COP instruction with similar functionality in codesys like rockwell. I want to use it to split REAL into 2 INT,DINT to 2 INT also reverse 2 INT into DINT and 2 INT into REAL. Thanks in advance
Last updated: 2024-03-18

Post by apurv on Cannot pass array of constant size to a function as a reference CODESYS Forge talk (Post)
I have a Array of constant size defined like this Var Constant MAX_SIZE :UINT := 10; End_var VAR array : ARRAY[0..MAX_SIZE] OF INT; END_VAR Now I want to pass this array to a function by reference, Function fun : INT VAR_IN_OUT CONSTANT MAX_SIZE : UINT; END_VAR VAR_INPUT array : REFERENCE TO ARRAY[0..MAX_SIZE] OF INT; END_VAR but when I run this it gives strange Errors Error : Cannot Convert type 'ARRAY [0..MAX_SIZE] OF INT' to type 'ARRAY[0..MAX_SIZE] OF INT'
Last updated: 2024-01-07

Post by timvh on Configuring a 2's compliment CODESYS Forge talk (Post)
You could create a DUT of the Type Union and add an array of 2 bytes + an Int. Then write the byte values in the array of the Union and read the Int. Or VAR iInt : INT; byHigh : BYTE := 2#1111_1111; byLow : BYTE := 2#1111_1111; END_VAR iInt := TO_INT(byHigh*16#100 + byLow);
Last updated: 2024-09-28

Post by tvm on Function block method default arguments CODESYS Forge talk (Post)
This works for me in Schneider Machine Expert 2.2, which is based on Codesys 3.5.19. It did not work in Machine Expert 2.1, which was based on Codesys 3.5.16. METHOD PUBLIC Method1 : INT VAR_INPUT TestVar: INT:= 5; END_VAR Method1:= TestVar; PROGRAM SR_Main VAR TestFB: TEST_FB; Var1: INT; END_VAR Var1:= TestFB.Method1();
Last updated: 2024-01-04

Post by tvm on multiply gives negatives CODESYS Forge talk (Post)
It's probably because you have an INT in the input to the MUL function, which will then try to output an INT as well. INT variables can only handle values of -32768 to 32767. Your value of 523000 won't fit in an INT, so it turns into an invalid number. Use a DINT. This is usually better for working with time values anyway, because time values are all 32 bit. Or if you can't, use INT_TO_DINT(gvlp.detectie_nalooptijd_s) in the input to the MUL function.
Last updated: 2024-01-04

Post by lamine97 on Issue with Timer-Based Increment Function in CoDeSys Ladder Logic (LD) CODESYS Forge talk (Post)
I am trying to implement a Ladder Logic (LD) function block in CoDeSys that increments a value A by B every T time interval. My Structured Text (ST) version works perfectly in simulation, but when I implement it in LD, it does not work. The ST code: PROGRAM ADDITION VAR_INPUT A : LREAL ; B : LREAL ; T : TIME ; END_VAR VAR Timer : TON ; END_VAR Timer (IN:=TRUE, PT := T); IF Timer.Q THEN A := A + B ; Timer(IN := FALSE ) ; END_IF;
Last updated: 2025-03-25

Post by damian177 on Persistence variables PFC200 CODESYS Forge talk (Post)
Hi, I using persistence variables like below: VAR_GLOBAL PERSISTENT RETAIN id_worker1: ARRAY [0..3] OF INT := [231,234,176,222]; id_worker2: ARRAY [0..3] OF INT := [211,129,125,221]; Initial values can cause some problems?
Last updated: 2023-12-08

Post by dogulas on numeric text box control CODESYS Forge talk (Post)
I am using TargetVisu in my v3.5 sp20 p6 (64-bit) project. I see no control that will allow me to bind, edit, and display a LREAL variable. Am I missing a library? If it exists, why can't I see it?
Last updated: 2025-10-02

Post by timvh on KeyPad Function in Visualization to fill a table CODESYS Forge talk (Post)
Create an array of STRING and 1 INT variable, e.g.: asMyString : ARRAY[0..9] OF STRING; iIndex : INT; Then place a "Table" object in the visualization: - link this to the string array variable. - Check the option "Use Template" - Then in the Input Configuration - add the "Write Variable" command Somewhere else add a "Combobox, array" - link this to the same array. - And link the index to the INT variable. In the Combobox, you can then select one of the strings from the array. The index variable will indicate which selection has been made.
Last updated: 2026-01-08

Post by davemansell on explicit cast ENUM to UINT and vice versa CODESYS Forge talk (Post)
This is from sometime ago but below might help someone else; this could be done via POINTERS. Make sure you protect for NULL pointers etc if you take this approach. // DECLARATION myEnumValue : enumMyEnum; u8 : USINT; pmyEnumValue : POINTER TO enumMyEnum; pu8 : POINTER TO USINT; // CODE pu8 := ADR(u8); pmyEnumValue := pu8; myEnumValue := pmyEnumValue^; // dereference the pointer
Last updated: 2025-08-21

Post by davemansell on explicit cast ENUM to UINT and vice versa CODESYS Forge talk (Post)
This is from sometime ago but below might help you could do this via POINTERS. Make sure you protect for NULL pointers etc if you take this approach. // DECLARATION myEnumValue : enumMyEnum; u8 : USINT; pmyEnumValue : POINTER TO enumMyEnum; pu8 : POINTER TO USINT; // CODE pmyEnumValue := pu8; myEnumValue := pmyEnumValue^; // dereference the pointer
Last updated: 2025-08-21

Post by davidbo on Is it possible in the log to see previous shutdown CODESYS Forge talk (Post)
If my application does some kind of violation which makes it cast an exception it will trigger my real watchdog which results in a reboot. Unfortunately the log it seems only shows the boot sequence. Is it possible to see what happen before reboot?
Last updated: 2024-02-08

Post by ph0010421 on How to manage variable types larger than 64 bits - Ethernet/IP CODESYS Forge talk (Post)
My guess is that's a STRING, not an INT type. And it's 128 bytes, not bits
Last updated: 2024-09-23

<< < 1 2 3 4 .. 6 > >> (Page 2 of 6)

Showing results of 137

Sort by relevance or date