CODESYS Talk
Yes, you are on the right track, and ADR(myArray) is the way I would do it too. I usually declare a small buffer just for this, something like an ARRAY[0..1] OF BYTE, put the alias in there low byte first, and then pass ADR() of that buffer as pbyData, with the length set to 2 rather than 2048. The 2048 you saw is just the size of the buffer the FB can work with, not what you have to write every time, and for the alias at 16#0012 you really only want those two bytes. One thing I learned the hard...
Hi, your guess about ppConnectorList is on the right track, at least in my experience. When the IDE runs a scan it calls IoDrvScanModules on your device FB, and that method is supposed to hand back one connector entry per module it finds, so the IDE can match each entry against the device descriptions in the repository and show them in the dialog. So the enumeration part really belongs in that method: ask the master for the attached modules over your socket, then build one entry per module. The breakpoints...
Hi Kmax, I ran into the same confusion the first time I tried this, so you are not missing something obvious. Function code 6 is not really a function block you create on its own, it is just the operation you pick inside the Modbus setup, and that is why searching the Library Manager for a block called ModbusTCP_FunctionCode06 does not get you anywhere. In your case the PQM_1000 is the slave and your PLC is the master, so I would do it through the device tree rather than hand-coding the frame. Add...
Your Oct 23 summary is pretty much what I ended up with on the same cards, especially the _User.cfg part. Editing CODESYSControl.cfg directly cost me a working setup once when it got overwritten, so that note alone is worth keeping around for the next person who finds this thread. One thing I would add is about TraceLevel=0xFFFFFFFF in your snippet. It was a lifesaver while I was chasing the hang, but I would not leave it on once the bus is running. With full tracing the log grows fast and the RTE...
Hi artem, welcome to ST β the jump from FBD and ladder takes a bit of getting used to, but what you're trying to do is very doable. The thing that tripped me up the first time too: SysTimeRtcGet isn't a function you just call and get a value back, it's a function block. So you need an instance of it in your VAR block, something like fbRtcGet : SysTimeRtc.SysTimeRtcGet; and then in the code you set fbRtcGet.xExecute := TRUE and call it every cycle until fbRtcGet.xDone comes back TRUE, and only then...