When you have a NEGATIVE value for the CntsPerxxxUnits parameters the ARRAY WRITE UNITS command needs to be inverted. This is because the values in the array are being converted to counts. Because we are multiplying by a negative number the MORE negative number is LESS THAN the MORE positive number after multiplication. So if your array spots are:
$MyArray[1]=10 ;lower value
$MyArray[2]=20 ;upper value
$MyArray[3]=40 ;lower value
$MyArray[4]=50 ;upper value
So that you fire your window from 10 to 20 units and then from 40 to 50 units, this gets interpreted internally as the windows being backwards because -10 is a greater value than -20, not a lesser value.
So if the CntsPerxxxxUnits parameters are a negative value you need to load the registers like this instead:
Then the WindowArray will work properly.
$MyArray[1]=20;lower value
$MyArray[2]=10 ;upper value
$MyArray[3]=50 ;lower value
$MyArray[4]=40 ;upper value |