ADevelp
HI
Based on the tests I've performed, it appears that only the %IW and %QW resources are actually mapped into the Runtime memory.
 
Byte resources (%IB and %QB) and double word resources (%ID and %QD) are listed in the monitor, but they are not updated with the values from the program.
Is that correct? Is there a way to read and write byte and double word values to the hardware as well?


Global_Format.jpg


In the program, I assign values to these using three local variables.


Format.jpg


However, when checking the Webserver Monitor, only the Word variables appear to be written to the Runtime.
What does it mean when the monitor highlights only the Word variables in blue?

MonitorFormat.jpg
Reply 0 0
thiagoralves
They are written, just aren’t mapped to Modbus. Since the monitor uses Modbus to read the variables, you can’t see anything in there. These locations are used by hardware drivers to control IO in some platforms. If you want to expose longs and doubles over Modbus, use %M locations (%MD and %ML)
Reply 0 0
ADevelp
I am not using Modbus? I talk directly with the OpenPLC memory by mapping the Analogic Input area, I regularly read and write the area but it only accepts INT values, moreover if I try to use a UINT directly on the Variable Editor
PIPPO = UINT set as (which by standard must be a word 0-65535)%IW
the debug stops and creates this error:

atest build does not match with connected target.
Program matches PLC MD5
PLC data transfered successfully.
PLCobject : NewPLC (49b1551b9d44e2fa6b55e9a5940c87e6)
PLC installed successfully.
PLCobject : PLC started
PLCobject : Python extensions started
Avviando il PLC
Exception in thread PLCTrace:
Traceback (most recent call last):
File "C:\Users\Computer\OpenPLC_Editor\python\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Users\Computer\OpenPLC_Editor\python\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Computer\OpenPLC_Editor\./editor\runtime\PLCObject.py", line 953, in TraceThreadProc
self.remote.send_debug_set_query(variable_idx, True, force_value, iec_type)
File "C:\Users\Computer\OpenPLC_Editor\./editor\runtime\openplc_debugger.py", line 146, in send_debug_set_query
data = struct.pack(">H", varidx) + struct.pack(">B", flag) + struct.pack(">H", 2) + struct.pack(">h", value)
struct.error: 'h' format requires -32768 <= number <= 32767

Is there a data exchange area available with the hardware that accepts both INT and UINT?
Where can I find information about the usable exchange areas and the different formats?







Reply 0 0
ADevelp
Hi
No need to investigate further I’ve discovered the issue. The program and IEC resources are not the cause; in fact, I’ve partially tested them and they work fine within the software.
The bug lies in the forcing mechanism during debugging. If you insert a UINT value for example, 40000 the system doesn’t evaluate the variable type being forced and treats it as an INT regardless.
To write 40000 into a UINT mapped in the schema, you need to input it as an INT, meaning -25536. In that case, it’s accepted without triggering an error.
Reply 0 0
ADevelp
I'm also all set when it comes to memory mapping. I performed an external debug that allows me to view low-level data areas in real time, so I can bypass the Webserver monitor.
Thanks anyway.
Reply 0 0
ADevelp
Based on the tests I've performed, it appears that only the %IW and %QW resources are actually mapped into the Runtime memory.
 


As for this question, I'm all set as well. Once I understood the Runtime architecture, I developed everything I needed in terms of IEC resources I'm now managing all of them in real time, except for the 64-bit type, which I don't need at the moment.
Thank you.
Reply 0 0
thiagoralves
I am not using Modbus? I talk directly with the OpenPLC memory by mapping the Analogic Input area, I regularly read and write the area but it only accepts INT values, moreover if I try to use a UINT directly on the Variable Editor
PIPPO = UINT set as (which by standard must be a word 0-65535)%IW
the debug stops and creates this error:

atest build does not match with connected target.
Program matches PLC MD5
PLC data transfered successfully.
PLCobject : NewPLC (49b1551b9d44e2fa6b55e9a5940c87e6)
PLC installed successfully.
PLCobject : PLC started
PLCobject : Python extensions started
Avviando il PLC
Exception in thread PLCTrace:
Traceback (most recent call last):
File "C:\Users\Computer\OpenPLC_Editor\python\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Users\Computer\OpenPLC_Editor\python\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Computer\OpenPLC_Editor\./editor\runtime\PLCObject.py", line 953, in TraceThreadProc
self.remote.send_debug_set_query(variable_idx, True, force_value, iec_type)
File "C:\Users\Computer\OpenPLC_Editor\./editor\runtime\openplc_debugger.py", line 146, in send_debug_set_query
data = struct.pack(">H", varidx) + struct.pack(">B", flag) + struct.pack(">H", 2) + struct.pack(">h", value)
struct.error: 'h' format requires -32768 <= number <= 32767

Is there a data exchange area available with the hardware that accepts both INT and UINT?
Where can I find information about the usable exchange areas and the different formats?







What version of the editor are you using? I thought I had fixed this already.
Reply 0 0
ADevelp
As I mentioned earlier, it's not a Runtime issue it's just the forcing mechanism during debugging that doesn't accept the correct values based on the variable type being set. I have a UINT, but the forcing only accepts INT. However, if I enter the value as a negative number, the UINT in the schema works correctly.
Is this version the only one I found through the link on the website? Version 2024-10-16
 
Reply 0 0
thiagoralves
That’s why. Your editor is too old. Update it and then forcing will work properly. If it doesn’t, let me know.
Reply 0 0
ADevelp
Okay, once updated it works. Actually, I had already updated it earlier,
but after running a series of tests, I ended up reinstalling everything from scratch.
Reply 1 0
Reply