HOW TO CONNECT my PC TO my CONTROLLERe AC1353
CODESYS Forge
talk
(Thread)
HOW TO CONNECT my PC TO my CONTROLLERe AC1353
Last updated: 2011-02-25
How to WRITE to CSV file
CODESYS Forge
talk
(Thread)
How to WRITE to CSV file
Last updated: 2015-12-24
Upload All required to connect to eTOP407
CODESYS Forge
talk
(Thread)
Upload All required to connect to eTOP407
Last updated: 2012-07-17
How to restrict text input to alphanumeric characters?
CODESYS Forge
talk
(Thread)
How to restrict text input to alphanumeric characters?
Last updated: 2022-03-22
I'm not able to install RPI packege to CodeSys
CODESYS Forge
talk
(Thread)
I'm not able to install RPI packege to CodeSys
Last updated: 2015-10-09
How to add custom baud rates to Modbus_COM serial device?
CODESYS Forge
talk
(Thread)
How to add custom baud rates to Modbus_COM serial device?
Last updated: 2017-11-25
How to add an own device to the bus-master?
CODESYS Forge
talk
(Thread)
How to add an own device to the bus-master?
Last updated: 2016-04-13
Raspberry Pi - Accessing files to sync to cloud
CODESYS Forge
talk
(Thread)
Raspberry Pi - Accessing files to sync to cloud
Last updated: 2018-12-31
Unable to add fb_dta200 to library
CODESYS Forge
talk
(Thread)
Unable to add fb_dta200 to library
Last updated: 2023-04-10
how to use C or C++ to programme in CODESYS
CODESYS Forge
talk
(Thread)
how to use C or C++ to programme in CODESYS
Last updated: 2013-04-13
Using eithernet to output to a webpage.
CODESYS Forge
talk
(Thread)
Using eithernet to output to a webpage.
Last updated: 2009-01-07
How to add a new device to CodeSys
CODESYS Forge
talk
(Thread)
How to add a new device to CodeSys
Last updated: 2012-12-12
How to add startup parameters to an EtherCAT slave
CODESYS Forge
talk
(Thread)
How to add startup parameters to an EtherCAT slave
Last updated: 2015-09-15
Request to members to update their country information
CODESYS Forge
talk
(Thread)
Request to members to update their country information
Last updated: 2015-05-15
REAL to BYTE[],BYTE[] to REAL.
CODESYS Forge
talk
(Thread)
REAL to BYTE[],BYTE[] to REAL.
Last updated: 2017-02-23
Using Modbusserver to communicate from pc to plc
CODESYS Forge
talk
(Thread)
Using Modbusserver to communicate from pc to plc
Last updated: 2015-02-17
Is it possible to convert v2.3 Softmotion project to v3?
CODESYS Forge
talk
(Thread)
Is it possible to convert v2.3 Softmotion project to v3?
Last updated: 2016-09-01
Configure Local Codesys Gateway to connect to remote device
CODESYS Forge
talk
(Thread)
Configure Local Codesys Gateway to connect to remote device
Last updated: 2018-10-08
How to upload application file to remote controller (offline) ?
CODESYS Forge
talk
(Thread)
How to upload application file to remote controller (offline) ?
Last updated: 2024-02-16
How to access to variable value through symbolic string name
CODESYS Forge
talk
(Thread)
How to access to variable value through symbolic string name
Last updated: 2024-06-15
How to stop dhcpcd and use SysSockSetIpAddressAndNetMask to set address?
CODESYS Forge
talk
(Thread)
How to stop dhcpcd and use SysSockSetIpAddressAndNetMask to set address?
Last updated: 2025-11-04
Python script to add libraries to project
CODESYS Forge
talk
(Thread)
Python script to add libraries to project
Last updated: 2025-11-11
Unresolved reference when trying to upload to Codesys Runtime V3
CODESYS Forge
talk
(Thread)
Unresolved reference when trying to upload to Codesys Runtime V3
Last updated: 2026-03-25
Post by paulorb on STRUCT AT %MW1000
CODESYS Forge
talk
(Post)
Hi I am trying to use STRUCT to parse commands from Modbus/TCP, Modbus client will fill the bytes related to a specific command (type, parameters), then PLC (Codesys) will access the command parameters. A STRUCT will simplify a lot the process of parsing the data, so I don't need to parse byte per byte, address will be mapped to a struct and I can use it for parsing the data. From what I understood, the compiler does not allow me to specify the location of the struct for a %MW register. VAR_COMMAND AT %MW1002: structGenericModbusCommand; This will throw: Bad declaration, use '%ML' for 'structGenericModbusCommand' variable But If I change it to %ML, when you go online you see that it is actually allocating the struct in another memory address. When we go online, on GVL we can see: VAR_COMMAND. structGenericModbusCommand %ML1002 commandType COMMANDTYPE %MB8016 ... %MB8020 I am not specifying a pointer or a reference it is a struct type, why is it mapping to a %MW location (random one). How can I control where it is mapping to? I need a consistent way to map STRUCT to specific modbus address. Is it possible? Thanks, Paulo Note I am using a Codesys OEM: Schneider Machine Expert Logic Builder (M241)
Last updated: 2024-08-13
Post by struccc on Bibliothek: floatingpointutils
CODESYS Forge
talk
(Post)
The issue s the byte order typically in this case. Can be especially problematic with floating point numbers - even more tricky if transferred with a word based protocol. It is a peasant way to try out the alternatives, dword order can be a-b-c-d, b-a-d-c, c-d-a-b, d-c-b-a where a is the most significant, d is the least significant byte. So all you need is to swap the bytes in your dword, until you get the expected result. If you don't want to mess writing code for this, I'd recommend CAA_Memory library for that: MEM.ReverseBYTEsInDWORD and MEM.ReverseWORDsInDWORD functions would definitively do the trick. Otherwise, can do like this: VAR dwIn : DWORD := 16#11223344; dwOut : DWORD; rOut : REAL; pIN : POINTER TO BYTE; pOUT : POINTER TO BYTE; END_VAR pIN := ADR(dwIn); //pOUt := ADR(dwOut); pOUt := ADR(rOut); pOut[0] := pIN[3]; pOut[1] := pIN[2]; pOut[2] := pIN[1]; pOut[3] := pIN[0]; Ugly, but does the job...
Last updated: 2024-11-19
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.