Search talk: if statement

 
<< < 1 .. 18 19 20 21 22 .. 48 > >> (Page 20 of 48)

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 wagokurt on CODESYS Visualization M License Fails to activate on Linux SL CODESYS Forge talk (Post)
The fix for this is when you install the control SL license, there is a checkbox for the Visu S license option. You must click this option. The Visu M is technically an upgrade to the Visu S, if this is license is not installed them the Visu M will fail as shown above. Thanks JoJo for the solution!
Last updated: 2025-08-25

Post by antonz on CoDeSys v3.5: creating libraries for both 32-bit and 64-bit controllers CODESYS Forge talk (Post)
Thanks Tim. I would think it somehow is relevant when creating a compiled library, but that may very well not be the case. If I understand you correctly, then the same compiled library created from my source code would work for both 32 bit as well as 64 bit controllers.
Last updated: 2025-09-01

Post by timvh on CoDeSys v3.5: creating libraries for both 32-bit and 64-bit controllers CODESYS Forge talk (Post)
Yes, you are right. I think the help is pretty clear: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_library_development.html It helps you to find errors in the source code of your library if you want to create a library which is using pointers and you want to use your library on 32 and/or 64 bit platforms.
Last updated: 2025-09-02

Post by serwis on Dynamic target position tracking CODESYS Forge talk (Post)
Hello, I am trying to control a servo drive and dynamically set its position. I control the drive via EtherCAT with a cycle time of 500us. I use the MC_MoveAbsolute block for this. The problem is that when using a PID controller, I generate the positions I want the drive to move to on an ongoing basis, and I would like the position to be set immediately. The MC_MoveAbsolute block must receive a rising edge to execute, and I would like the movement to be performed without waiting for this edge. I have created a function that generates a rising edge every 1 ms, but I am unable to change this time to 500 Β΅s because the TON function does not support times shorter than 1 ms. Below is the code to call the rising edge: IF Exe = TRUE THEN delay1(IN:=TRUE, PT:=T#1MS); IF delay1.Q = TRUE THEN Exe := FALSE; delay1(IN:=FALSE); END_IF END_IF IF Exe = FALSE THEN delay(IN:=TRUE, PT:=T#1MS); IF delay.Q = TRUE THEN Exe := TRUE; delay(IN:=FALSE); END_IF END_IF END_IF Here is the code for calling the MC_MoveAbsolute function: MoveDegree( Axis:= Tilt, Execute:= Exe, Position:= position_target - (base_angle_real * feedforward_turn), Velocity:= vel, Acceleration:= acc, Deceleration:= dec, Jerk:= jerk, Direction:= MC_DIRECTION.shortest, BufferMode:= MC_BUFFER_MODE.Aborting, Done=> , Busy=> , Active=> , CommandAborted=> , Error=> , ErrorID=> ); I realize that there are probably better methods for performing this type of task. How can I implement motion with a dynamically changing setpoint? THANKS
Last updated: 2025-09-05

Post by gseidel on Cam Blending CODESYS Forge talk (Post)
Hi ustad41, cams can be buffered using the BufferMode input of MC_CamIn. If the end- and start-velocity of two buffered cams are not zero, there will be no stop. Not sure this answers your question. Cams can be changes on the fly by aborting the active cam. Please see [0] for details on switching cams. [0] https://content.helpme-codesys.com/en/CODESYS%20SoftMotion/_sm_cam_switch_between_cams.html Best regards, Georg
Last updated: 2025-09-08

Post by gseidel on can not new a cam table in codesys V3.5 SP20 CODESYS Forge talk (Post)
Hi liai, is it possible, that SM3_Basic is missing in the library manager? (It should be inserted automatically when adding a Cam table, along with the other motion libs.) You can add it manually and see if that solves the compile errors. Best regards, Georg
Last updated: 2025-09-19

Post by snhatton on How to write a for loop in ladder? CODESYS Forge talk (Post)
Hi there, little late to the party, but you could also use the ST block for in-line ST code and implement a for loop as you normally would. ST Block is super handy if you just need a small amount of in-line structured text code without creating a new POU. Hope this helps!
Last updated: 2025-10-06

Post by snhatton on Testing of Codesys program CODESYS Forge talk (Post)
There is a tool called test manager that is part of the Professional Developer's Edition of CODESYS. I would take a look at this tool for your testing purposes. There is a free 30-day trial so you can evaluate if the tool will meet your needs before investing in the license.
Last updated: 2023-12-08

Post by snhatton on OPC UA: How to change NodeId ?! CODESYS Forge talk (Post)
You can change the node id by adding the following to /etc/CODESYSControl.cfg: [CmpOPCUAProviderIecVarAccess] CustomNodeName=MyPLC123 Then restart the runtime and the new Node name will appear with the connection. I don't know if it's possible to remove the |var| from the name. I hope this helps!
Last updated: 2023-12-11

Post by preimesbergert on Codesys Control for Raspberry Pi 4.10.0.0 - Raspberry Pi OS > 2023-12-05 CODESYS Forge talk (Post)
Same issue here: Raspberry Pi 4 Model B HW 1.5 Regardless of the image (tried 32bit / 64bit version from Raspberry Pi Imager- all the "standard version") and with all tested Codesys Control versions (4.2.0, 4.8.0, 4.10.0) and regardless if single core / multicore / 64 bit variant.
Last updated: 2023-12-21

Post by svn123 on In Simulation Mode, logic is not executing CODESYS Forge talk (Post)
I stopped the simulation and tried to rebuild. "Cloned Task0.task0. Priority already in use" error was shown after rebuilding. I used Build-Clean All option and rebuilt again. Now the logic started working. But I am not still sure what caused the error in first place. If somebody knows about this error, please enlighten me. Thanks svn
Last updated: 2023-12-25

Post by martinlithlith on Raspberry Pi: List of available drivers / libraries CODESYS Forge talk (Post)
Hi! I'm still on the hunt for drivers for example TCA9548 and a list or somewhere where all devices for raspberry is gathered. as this post is quite old I'm hoping/gussing that there is somewhere where work after 2021 is gathered? Or has the raspberry part if the community slowed down on creating device drivers?
Last updated: 2023-12-31

Post by pmasip on Codesys Control for Raspberry Pi 4.10.0.0 - Raspberry Pi OS > 2023-12-05 CODESYS Forge talk (Post)
So none of the images from the 64bit archive work with any Codesys Control versions? I have tried the last Pi OS with every Codesys Control version and they don't work. I was wondering if there's any stable combination of versions.
Last updated: 2024-01-04

Post by oscardm on Problem install codesys 3.5.17 SP 30 with Codesys Installer CODESYS Forge talk (Post)
Hi, I have a problem with codesys installer: if install a package on the codesys 3.5.17 SP17, and i try to install a package, for example SVN package, the codesys installer report the "digital signature expired error". Anyone have an idea for resolution ? Thanks for your feedback
Last updated: 2024-01-12

Post by scarter on Bit / Bool data types in function parameters CODESYS Forge talk (Post)
Any reason BIT and BOOL data types are not interchangeable? Trying to make a function which takes a BOOL IN/OUT parameter (Not allowed to use BIT) In the main logic if I make a DINT variable, and want to use each bit on different functions CODESYS will not allow it.
Last updated: 2024-01-17

Post by masmith1553 on SDO generation CODESYS Forge talk (Post)
If you add any device to the CANOpen Manager it will send messages to verify the device is on the network. Do you have the Enable expert settings check box checked in the General tab? have you added any SDOs in the SDOs tab? I avoid using the CANOpen Manager and just use the CAN_Tx and CAN_Rx blocks from the library.
Last updated: 2024-01-25

Post by wiresplus on Connect to remote PLC via local pc and teamviewer CODESYS Forge talk (Post)
Hello, Depends on the architecture of your PLC. If the PLC is a PC-based item with a normal desktop environment, then you probably can. I find it simpler to install an IIoT Router in the panel, and use an encripted VPN to link to my office PC / Laptop on demand.
Last updated: 2024-01-26

Post by mondinmr on Why SysPipeWindows is not implemented in RTE? CODESYS Forge talk (Post)
This library would be very useful for IPC communications. Using a UDP socket on localhost is unpredictable, as with slightly loaded machines it does not even guarantee packet delivery locally. Using TCP creates a lot of overhead. Message named pipes would be an excellent solution for Windows RTE. On Linux, since the release of the extension package, there is no issue, as it is sufficient to develop a component. However, although now 90% of our clients understand that Linux runtimes are better in every way compared to Windows RTE, especially from the security aspect (Not in kernel space) and the issues with Windows updates, 10% stubbornly insist (sometimes for trivial commercial reasons) on using Windows. Managing IPC with circular buffers in shared memory is quite ugly, or rather really ugly and unaesthetic. In the manuals, I saw the SysPipeWindows libraries, so I decided to test them, but unfortunately, I noticed that they are not implemented for RTE devices. Technically, I could try to open them as regular files, but SysFileOpen returns 16#27 or 16#39 depending on how I set the name (direction of the slashes). Here is the code to create shared memory and named pipes. Shared memory work great, named pipes no! #ifdef Q_OS_WIN32 SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = &sd; sa.bInheritHandle = FALSE; const wchar_t* name = L"Global\\ShmTest"; HANDLE hMapFile = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(SharedData), name); if (hMapFile == NULL) { qCritical("Error creating shared memory"); return 1; } data = static_cast<SharedData*>(MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(SharedData))); if (data == NULL) { qCritical("Error mapping shared memory"); return 1; } HANDLE hPipe = CreateNamedPipe( TEXT("\\\\.\\pipe\\MyPipe"), PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 1024 * 1024, 1024 * 1024, NMPWAIT_USE_DEFAULT_WAIT, &sa); if (hPipe == INVALID_HANDLE_VALUE) { qCritical("Error creating named pipe"); return -1; } if (!ConnectNamedPipe(hPipe, NULL)) { qCritical("Error connecting to named pipe"); return -1; } checkPipe(hPipe); #endif
Last updated: 2024-02-02

Post by dhumphries on Using Codesys example problems CODESYS Forge talk (Post)
You have to install any libraries needed by the sample program. Click the button with ... next to one of the errors (see attached image,) then choose download missing libraries. Codesys should automatically locate and install the missing libraries, it's not flawless though, I've had some issues getting libraries to install. The best advice I can give if it doesn't work is re-install Codesys.
Last updated: 2024-02-03

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 rmaas on Direct Pointers in IOMapping for EtherCAT with IoDrvEthercatLib.ETCSlave_Dia CODESYS Forge talk (Post)
Hi, Im not sure if this is what you mean, but i do succesfully use the IoDrvEthercatLib.ETCSlave.InputData and IoDrvEthercatLib.ETCSlave.OutputData to read from and write to beckhoff DI and DO cards. Very convenient as you can make an FB with an VAR_IN_OUT of type IoDrvEthercatLib.ETCSlave and only have to pass the slave reference... So i am not using .ETCSlave_Diag but .ETCSlave...
Last updated: 2024-02-13

Post by mondinmr on Direct Pointers in IOMapping for EtherCAT with IoDrvEthercatLib.ETCSlave_Dia CODESYS Forge talk (Post)
Thank you for the response! It's a path I had already considered, however, while it has always worked for me on inputs, it doesn't on outputs, because if I enable the option to update all IOs at every scan, the IO tasks overwrite each other. However, I have found something very interesting which I am posting below.
Last updated: 2024-02-13

Post by aconley on Static Code Analysis CODESYS Forge talk (Post)
I'm using CODESYS 3.5 SP16 Patch 6. I would like to incorporate static code analysis as part of our CI/CD pipeline. 1. Is there a way to execute the static code check from the command line or python script? 2. If you can't do it from the command line, is there a way to export the results from the application?
Last updated: 2024-02-15

<< < 1 .. 18 19 20 21 22 .. 48 > >> (Page 20 of 48)

Showing results of 1195

Sort by relevance or date