High Country Tek emc-3L User Manual
Page 65
If the bit needs reset, ‘and’ with 0xf7. The word ‘data_to_dvc7a.output_status’ is the active word.
Another example, if it is needed to see if bit ‘2’ is on, then use 0x02, see below.
if
((data_from_dvc7.a_OG1_OG2_enable
and
0x02) = 2)
then
'comparing 2nd bit
Valvecoil2.Enable = 1
else
Valvecoil2.Enable = 0
end
if
If the value is true, or ‘2’ in this example, then an internal bit can be set or reset.
Analog values, using more than one bit:
Using a value that is other than on/off will need to be transferred also. The DVC controllers use a 10 bit
number. The information transmitted in 1 byte is 8 bits in length. For this reason, and to transmit / receive the
highest resolution, 2 words will need to be used, see the code below on format.
data_to_dvc7a.a_ana_in1_low = (Analog_In1
and
0xff)
data_to_dvc7a.a_ana_in1_high = (Analog_In1 / 256)
The value of ‘analog_In1’ is moved into a 8 bit word, data_to_dvc7a.a_ana_in1_low. Analog_In1 is then divided
by 256, this will move the upper 8 bits into the lower 8 bits. That value is then moved into a 8 bit word,
data_to_dvc7a.a_ana_in1_high.
To reverse the process, follow this format
Valvecoil1 = ((data_from_dvc7.a_OG1_PWM_low)+(data_from_dvc7.a_OG1_PWM_high * 256))
The 8 bit word, data_from_dvc7.a_OG1_PWM_high is multiplied by 256, this moved the information from the
lower 8 bits to the upper 8 bits. This value is added to the 8 bit word, data_from_dvc7.a_OG1_PWM_low, to
give a 16 bit variable, Valvecoil1.
P/N: 021-00163, Rev. A.0 - for V5.2 Tools
Page | 65