Search talk: Object reference not set to an instance of an object

 
<< < 1 .. 70 71 72 73 74 .. 293 > >> (Page 72 of 293)

Post by jmauer on Codesys 3.5 SP16 Modbus change port settings. CODESYS Forge talk (Post)
Hello, I'm coming to you today because I'm trying to make the baudrate and the slave number dynamic. I've tried the "updateComPortSettings" method on the slave device but it doesn't work and gives the "Modbus_COM_Port" an error. Can you tell me how you got this method to work? Thanks in advance for your help jérémy
Last updated: 2024-02-20

Post by bingo on PLC Shell commands via ST Code CODESYS Forge talk (Post)
Suppose you need to switch PLC IP dynamically between 192.168.1.10\192.168.2.10, First, set PLC IP to 192.16.1.10. Create a PGVL with a flag ‘xUseSecondry’ xUseSecondry : bool ; create a function that use socket to update IP: FUNCTION fSwitchIP : bool VAR_INPUT useMainIP:bool; END_VAR --------------------------------CODE------ if useMainIP then SysSockSetIPAddress(‘0’, ‘192.168.1.10’); PGVL.xUseSecondry := 0; else SysSockSetIPAddress(‘0’, ‘192.168.2.10’); PGVL.xUseSecondry := 1; end_if Now, if during execution, you need to switch IP, call the function ‘fSwitchIP()’, Set input to 1 for main IP, 0 for secondary IP. In order to set secondary IP at startup, you can do the following: in your PLC_PRG add a flag: xInit : bool := 1 ; and the code: if xInit then if PGVL.xUseSecondry then fSwitchIP(0); end_if xInit := 0 ; end_if *Alternative way is to use system events.
Last updated: 2025-03-03

Post by alessandro on SysMemCmp SysMemCpy CODESYS Forge talk (Post)
VAR Data1:ARRAY[1..10] OF SINT ; Data2:ARRAY[1..10] OF SINT ; Data3:ARRAY[1..10] OF SINT ; Data4:ARRAY[1..10] OF SINT ; ex_1 : BOOL ; ex_2 : BOOL ; enable : BOOL :=0 ; END_VAR // PROGRAM // The scope of this example is compare and copy the values of two ARRAY only if some value is different using SysMemCmp and SysMemCpy. // In this 2 example we don't use a FOR cicle for do this, and pBuffer1 and pBuffer2 is just a pointer to ARRAY. See details in Library util.SysMem of Codesys // The compare funcion util.SysMem.SysMemCmp is bidirectional if Data1 chanege respect Data2 ex_1 go to 1 and if Data2 change respect Data1 also // but the copy function util.SysMem.SysMemCpy work only from source ARRAY pSrc:=ADR(Data1) to destination ARRAY pDest:=ADR(Data2) // Example 1 Full ARRAY compare and copy // This compare 2 different equal ARRAY and if there is some difference ex_1 go to 1 and if you give enable he copy Data1 in Data2 ex_1 := TO_BOOL(util.SysMem.SysMemCmp(pBuffer1:=ADR(Data1), pBuffer2:=ADR(Data2), udiCount:=SIZEOF(Data1))); IF ex_1 AND enable THEN util.SysMem.SysMemCpy(pDest:=ADR(Data2), pSrc:=ADR(Data1), udiCount:=SIZEOF(Data1)); END_IF // Example 2 Only selected area of the ARRAY compare and copy // This compare 2 different equal ARRAY starting from position number [3] for 4 byte in this case start at position [3] and finish at position number [6] // and if there is some difference only in area [3..6] of the ARRAY ex_2 go to 1 if you give enalbe he copy Data3[3..6] in Data4[3..6] // if something change in other array position[0..2] or [7..10] are ingnored ex_2 := TO_BOOL(util.SysMem.SysMemCmp(pBuffer1:=ADR(Data3[3]), pBuffer2:=ADR(Data4[3]), udiCount:=4)); IF ex_2 AND enable THEN util.SysMem.SysMemCpy(pDest:=ADR(Data4[3]), pSrc:=ADR(Data3[3]), udiCount:=4); END_IF // Attention udiCount input is intended in <byte> in the example 1 I pass to udiCount:=SIZEOF(Data1) for compare and copy the intere ARRAY and // SIZEOF pass the size of intere ARRAY in byte to the function input, in this 2 examples I used variable type SINT each one occupie 1 byte and one position in the ARRAY // and in the example 2 I pass udiCount:=4 for compare and copy only 4 position of Data3/4[3..6] if you want to extend this example and use it for an ARRAY OF WORD // remember that each WORD will occupe 2 byte (16 bit) and you will have to pass udiCount:=SIZEOF(Data1) if you need to compare intere ARRAY example 1 // but need udiCount:=(42) for the example 2 because need to compare and copy 4 word each occupie 2 byte (16 bit). // For REAL (32 bit) need udiCount:=SIZEOF(44) for LREAL or (64 bit) need udiCount:=SIZEOF(416) // a good rule is calculate the dimension of the ARRAY in byte without empty space at the end, multiple of data type number for variable bigger then 8 bit // Example : If you want to create an ARRAY for 5 REAL (32 bit) each occupie 4 byte the correct size is ARRAY[0..19] OF REAL 54=20 position. // NOTE : In the example the position of compare function util.SysMem.SysMemCmp is first and the copy function util.SysMem.SysMemCpy inside the IF is after // in one cycle of the program the two array is compared and if there is some difference and enable are copied. // If you move util.SysMem.SysMemCmp after the IF cycle he will copare the ARRAY in the current cycle but the copy of the value will do in the next cycle.</byte>
Last updated: 2025-10-24

RPI How to login for a copy of the SD image CODESYS Forge talk (Thread)
RPI How to login for a copy of the SD image
Last updated: 2023-10-18

Problem with FBD/LD and "Go to the definition" of a Method CODESYS Forge talk (Thread)
Problem with FBD/LD and "Go to the definition" of a Method
Last updated: 2012-02-10

How to record positions in softmotion's x-y axis by X-Y chart of package CODESYS Forge talk (Thread)
How to record positions in softmotion's x-y axis by X-Y chart of package
Last updated: 2018-12-04

How to change the font size of the headline in a table CODESYS Forge talk (Thread)
How to change the font size of the headline in a table
Last updated: 2022-11-25

Trying to negate Boolean values inside of a case statement CODESYS Forge talk (Thread)
Trying to negate Boolean values inside of a case statement
Last updated: 2021-10-29

How to access the value of a variable held in the previous cycle in ST? CODESYS Forge talk (Thread)
How to access the value of a variable held in the previous cycle in ST?
Last updated: 2021-09-01

python script to edit I/O Assignment, [Dynamic Management of I/Os][Compound Safety PLC] CODESYS Forge talk (Thread)
python script to edit I/O Assignment, [Dynamic Management of I/Os][Compound Safety PLC]
Last updated: 2021-07-07

Cannot install runtime mulicore to the newest version of Raspberry Pi4 CODESYS Forge talk (Thread)
Cannot install runtime mulicore to the newest version of Raspberry Pi4
Last updated: 2023-07-14

"Out of global data memory". Is there a way to increase the memory? CODESYS Forge talk (Thread)
"Out of global data memory". Is there a way to increase the memory?
Last updated: 2022-03-28

RPi + Codesys: how to obtain a graceful shutdown of the system CODESYS Forge talk (Thread)
RPi + Codesys: how to obtain a graceful shutdown of the system
Last updated: 2018-02-19

What are the network requirements of "Codesys Engeneering" IDE to perform remote access ? CODESYS Forge talk (Thread)
What are the network requirements of "Codesys Engeneering" IDE to perform remote access ?
Last updated: 2020-06-24

Is there any way to get the name of the current action... pou... CODESYS Forge talk (Thread)
Is there any way to get the name of the current action... pou...
Last updated: 2017-03-20

Access to a GVL and seraching for a variable inside of it (Pyhton) CODESYS Forge talk (Thread)
Access to a GVL and seraching for a variable inside of it (Pyhton)
Last updated: 2022-07-25

How to get the amount of free disk space in a plc CODESYS Forge talk (Thread)
How to get the amount of free disk space in a plc
Last updated: 2022-08-08

How to release the memory of a variable in Codesys 2.3 CODESYS Forge talk (Thread)
How to release the memory of a variable in Codesys 2.3
Last updated: 2021-06-06

How to slow down the clock of the main execution program? CODESYS Forge talk (Thread)
How to slow down the clock of the main execution program?
Last updated: 2011-07-18

How to turn on a large number of outputs with 1 variable CODESYS Forge talk (Thread)
How to turn on a large number of outputs with 1 variable
Last updated: 2015-09-07

Can I save the current values of all variables to a file? CODESYS Forge talk (Thread)
Can I save the current values of all variables to a file?
Last updated: 2013-01-14

Is there a way to use part of arrays in OSCAT functions? CODESYS Forge talk (Thread)
Is there a way to use part of arrays in OSCAT functions?
Last updated: 2019-02-21

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

How to read the status of one Modbus Slave in the codesys program CODESYS Forge talk (Thread)
How to read the status of one Modbus Slave in the codesys program
Last updated: 2021-08-15

Can't figure out how to "save" a value of a variable CODESYS Forge talk (Thread)
Can't figure out how to "save" a value of a variable
Last updated: 2017-02-19

<< < 1 .. 70 71 72 73 74 .. 293 > >> (Page 72 of 293)

Showing results of 7320

Sort by relevance or date