Author Topic: GETHIGH16  (Read 6481 times)

Bill

  • Newbie
  • Posts: 21
    • View Profile
GETHIGH16
« on: September 16, 2006, 11:18:32 AM »
I have implemented the gethigh16 feature and assgned the result to DM[1].  Variable A is being used as the 32 bit counter.

With a value of 580,000 in register A, I read 88 in DM[1].

How do i convert this to an actual count in the HMI?

plc_user

  • Newbie
  • Posts: 21
  • I'm a llama!
    • View Profile
Re:GETHIGH16
« Reply #1 on: September 16, 2006, 12:21:47 PM »
I think you might be a bit mixed up, when you look at 32bit data the least significant bit is all the way to the right.  So when you break up a 32bit variable into two 16bit pieces of data with the GET16HIGH function, that returns the data from bit 8 to bit 31, that is the upper part of the 32bit variable.  When you store your data in the DM memory, you need to place the upper part of the 32bit data one place to the right of the lower part.  For example:

DM[1]=A
DM[2]=GET16HIGH(A)

then let the HMI look at DM[1] with the field setup as a 32 bit datatype and you should see the correct result.

I will be checking back here in awhile, if you still are having trouble, just reply to this message.
 

plc_user

  • Newbie
  • Posts: 21
  • I'm a llama!
    • View Profile
Re:GETHIGH16
« Reply #2 on: September 16, 2006, 12:23:35 PM »
Attention:  In the above post, it was meant that the upper part is bit 16-31
Sorry for the inconvience.


Bill

  • Newbie
  • Posts: 21
    • View Profile
Re:GETHIGH16
« Reply #3 on: September 16, 2006, 04:40:54 PM »
Thanks.

I have been known to get a bit mixed up.  

I am not in the shop at the moment, however I will try this technique on monday.