14:14, EEST
May 2, 2012
Hello,
is it possible to transfer unsigned 32 bit OPC vars to Delphi unsigned 32 bit (aka Longword) vars? Whenever I try to do this with TPsInteger I receive ‘range check’ exceptions as soon as OPC values become higher than 2^31.
This happens if the OPC’s data type is set to vdtLongWord; if set to vdtInteger there are no exceptions, but, however, the OPC unsigned value becomes a Delphi signed integer. Is there a simple way for a to do longword – longword transfers without additional casts?
Best regards,
Jürgen
6:53, EEST
December 21, 2011
13:32, EEST
May 2, 2012
Hi Jouni,
thanks for reply.
Tried TPsBitSet, TPsStatusBits and TPsVariant, but surprisingly got ‘range error’ exception when highest bit was set.
Moreover the trick stated above by handling PLC data as integer only works for PLC-to-Delphi direction. When data type is set to vdtInteger and integer casted longwords are sent from Delphi to the PLC with MSB set, then the PLC receives wrong values.
Unfortunately our PLC needs longword var communication in both directions. Any ideas?
Best regards,
Jürgen
15:02, EEST
December 21, 2011
7:49, EEST
May 2, 2012
Hi Jouni,
doesn’t work perfectly: reading values is ok, but writing give wrong values at PLC side (eg. trying so send 4.000.000.000 results in 125 at PLC).
If using vdtLongWord then writing values to the PLC is ok, but whenever the value changes at PLC side and must be transferred back to the Delphi application via OPC, then range check exceptions are thrown. There is no need to access the var (like x := PsInteger1.Value) but the simple fact that PSInteger1 is bound to the PsOPCConnector is enough to show this behaviour.
Btw. Setting and reading PLC longword values via an external OPC browser works fine, so the PLC should be ok.
All in all we still have now way to transfer longword values > 2^31…
Best regards and thanks for your help so far,
Jürgen
8:40, EEST
December 21, 2011
Please, send an email to sentrol-support@prosysopc.com and I’ll see what we can do to improve your situation.
Most Users Ever Online: 1919
Currently Online:
183 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 749
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
scvchad954, misty3446453365, KelsonzFu, Kelsonz, lienbelisario, erick34s63346, Kaitlyntvsl, lonaerskine7, KTP21ideft, GeorgecotagModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1