Applies To
All
Purpose
Fill the specified number of steps and channels with a Ramp pattern.
Syntax
Object.FillClock ([dwFirstValue], [dwLastValue], [dwIncrement], [dwCycleWidth], [vFirstStep], [dwSteps], [vFirstChannel], [vLastChannel])
The FillRamp method syntax has the following parts:
Name |
Type |
Description |
Object |
DioBlock |
DioBlock object |
dwFirstValue |
DWORD |
Optional - The ramp's starting value. Default is 0. |
dwLastValue |
DWORD |
Optional - The maximum ramp value. Defaults will be last step number in the block. |
dwIncrement |
DWORD |
Optional - Number of counts for each increment, can be negative for down ramp. Default is 1. |
dwCycleWidth |
DWORD |
Optional - Cycle Width (in Steps) is the number of steps to complete a clock cycle (must be greater than the Invert after Step entry). Default is 2. |
vFirstStep |
Variant |
Optional - Starting step number in the block. Step number specified by either the step label or the step number. Default is the first step. |
dwSteps |
DWORD |
Optional - Number of steps. Default is all steps |
vFirstChannel |
Variant |
Optional - First channel number in the block. Channel number specified by either channel label or the channel number. Default is the first channel. |
vLastChannel |
Variant |
Optional - Last channel number in the block. Channel number specified by either channel label or the channel number. Default is the last channel. |
Comments
The Ramp can be a up or down ramp, in either cases the following needs to be consider:
Up Ramp, dwIncrement is positive: The dwLastValue value should exceed dwFirstValue
Down Ramp, dwIncrement is negative: The dwLastValue value should be less than dwFirstValue.
The following apply to the dwLastValue parameter:
● If dwLastValue is reached before the last step, the ramp will remain at this value until the last step is reached.
● If the ramp reaches the Last Step before the dwLastValue is reached, the ramp ends.
● Channels are assigned to ramp bits starting with the least significant bit. Therefore, if sufficient channels are not allocated to fully represent the (user-modified) dwLastValue, only the least significant ramp bits are assigned to channels. However, the ramp is still fully generated internally. Without more significant bits, the ramp will appear to "repeat" with a period that depends on all values entered. The ramp ends if the internal dwLastValue value or Last Step is exceeded.
● If there are more channels in the range than are necessary to represent the dwLastValue value, the ramp will stop incrementing or decrementing when the dwLastValue is reached, or when the Last Step is exceeded. Therefore, higher order channels will not switch.
● The limiting operation of dwLastValue value is such that if the next increment would exceed that limit, the ramp value remains unchanged. Thus, if Increment by is set to 5, dwLastValue value to 12 and dwFirstValue value to zero, the ramp sequence 0, 5, 10, 10, 10… would be generated. 12, would never be attained because the next value, 15, would exceed the dwLastValue value.
● The ratio of dwIncrement to the dwCycleWidth value determines the effective slope of the ramp. For example, if dwIncrement set to increment by 3, and dwCycleWidth set to 2, the effective slope is 1.5 units per step and increments can occur every second step. If dwIncrement set to 6, and dwCycleWidth set to 4, the effective slope is still 1.5, but increments occur every fourth step and the step size is doubled.
See Also