Host Engineering Forum

General Category => DirectSOFT => Topic started by: blglaw on August 25, 2008, 10:11:41 AM

Title: double word help
Post by: blglaw on August 25, 2008, 10:11:41 AM
I am trying to use BCD_INT32 with my C-more micro graphic display to enter in a value for inches for a length measuring system.  I can enter the value into the display, 1234.56" but when the PLC looks at the same location, it sees 34.56".  I believe it needs to look at 2 Vmem locations.  How do i set the PLC to look at double word location?  I am using greater than/less than functions to compare  my lengths and slow down my motor and then stop.  Is this done in the Memory editor and with it then  look at both words? ???
Title: Re: double word help
Post by: franji1 on August 25, 2008, 10:25:30 AM
Relationals only work with single word values.  There is a CMPD (Compare Double) box that will perform the operation, but as a function, not as inline contacts.  You will need to look at the SP60/61/62 to see the result of the comparison.  I recommend looking at Chapter 5 in the User Manual at the CMPD instruction description.
Title: Re: double word help
Post by: MikeS on August 25, 2008, 10:52:23 AM
you can use a pair of relational contacts - one comparing the upper v-memory location with the upper word of your value, the other comparing the lower v-mem with the low half of the value -  but that's very ugly and hard to maintain.

the best answer is to use the cmpd instruction with it's sp60, 61 & 62 bits to do the comparison. using math functions with sp bits isn't much better, but it's much more maintainable over the long haul.
Title: Re: double word help
Post by: blglaw on August 26, 2008, 09:03:23 AM
OK....thanks.  That is what i figured out.  I just have to get it to work now. 
Thanks again,
Bill