Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Reading registry values. 32bit

Reading registry values. 32bit 8 years 10 months ago #7537

  • Gierula
  • Gierula's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 46
  • Karma: 0
Hi
How to read a 32bit counter value.
Modbus provides 16bit.
At 40052 - 16bit MSB
At 40053 - 16bit LSB
The administrator has disabled public write access.

Reading registry values. 32bit 8 years 10 months ago #7538

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi Gierula,

It is possible to read 4 bytes into one Ii by setting Representation in the ChanIi to UInt32. I'm not sure though if this gives the correct result or if you have to swap the two 16-bit word. It's also possible to read with to ChanIi with Representation UInt16 and merge the Ii signals in a CArithm with 'OI1 = (I1 << 16) + I2;'.

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: Gierula

Reading registry values. 32bit 8 years 10 months ago #7539

  • Gierula
  • Gierula's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 46
  • Karma: 0
Hi claes
The second method proved to be effective.
Just I swapped the order of records.
Thank you very much for your help.
Attachments:
The administrator has disabled public write access.

Reading registry values. 32bit 5 years 2 months ago #10105

  • benoit
  • benoit's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 180
  • Thank you received: 1
  • Karma: 0
claes wrote:
Hi Gierula,

It is possible to read 4 bytes into one Ii by setting Representation in the ChanIi to UInt32. I'm not sure though if this gives the correct result or if you have to swap the two 16-bit word. It's also possible to read with to ChanIi with Representation UInt16 and merge the Ii signals in a CArithm with 'OI1 = (I1 << 16) + I2;'.

/Claes

Hi Claes,
About the C code "OI1 = (I1 << 16) + I2;"
Please, could you precise the MSB and LSB?

I1 = MSB , I2 = LSB
or
I1 = LSB , I2 = MSB ?

Thanks.
/Ben
The administrator has disabled public write access.

Reading registry values. 32bit 5 years 2 months ago #10108

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi Ben,

I1 is shifted to the high word, so I1 is MSB and I2 LSB.

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: benoit
  • Page:
  • 1
Time to create page: 7.884 seconds