Author Topic: Saving a 32 bit Integer into two DM[x} variables  (Read 10019 times)

Ben

  • Guest
Saving a 32 bit Integer into two DM[x} variables
« on: March 12, 2004, 11:55:09 AM »
What is the simplest method of breaking a 32 bit integer into 16 bit halves and saving them to the DM
  • array? The Functions GETHIGH16(x) and SETHIGH16 v,data are used for the upper 16 bits. How do we handle the lower 16 bits? Mask out the upper 16 bits by "AND FFFF0000" and assign to the DM
  • variable?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Saving a 32 bit Integer into two DM[x} variables
« Reply #1 on: March 12, 2004, 02:01:23 PM »
When you assign a 32-bit variable to a 16-bit variable, only the lower 16 bit will be assigned. So there is no need to do a logical AND to mask out the upper 16-bit.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS