8 send receive bit / byte information, Send receive bit / byte information – High Country Tek DVC80 User Manual

Page 78

Advertising
background image

P/N: 021-00154, Rev. A.6 - updated for V4.7 Tools

Page | 78

End If

ElseIf (Feedback < Actual_SP) Then

SError = (Actual_SP - Feedback) * EE_I / 100
If (SError > EE_Error_Max) Then
SError = EE_Error_Max
End If

If (Sum + SError > 100%) then
Sum = 100%
Else
Sum = Sum + SError
End If
End If
End If

5.8

Send receive bit / byte information

The DVC controllers are capable of both sending and receiving J1939 messages. This example will explain
how to contruct / deconstruct bytes of information from both single bit and 10 bit configurations. More
information can be found in the document ‘DVC7 as J1939 expansion module’, also refer to the online tool,
‘J1939 message creation’.
Digital values, using one bit:
Using the ‘J1939 message creation’ worksheet will show how to set / reset bits in a word.

8

7

6

5

4

3

2

1 bit#

128

64

32

16

8

4

2

1 value

0x80 0x40 0x20 0x10 0x08 0x04 0x02 0x01 set

value

(hex)

0x7f 0xbf 0xdf 0xef 0xf7 0xfb 0xfd 0xfe reset

value

(hex)

0x128

0x64 0x32 0x16 0x08 0x04 0x02 0x01 compare

value

(hex)

dec
value

0 0 0 0 0 0 0 0 0

For instance, if the programmer needed to set the fourth bit to ‘true’, the word would be ‘or ed’ with 0x08h.

if

((Valvecoil2.short = 1)

or

(Valvecoil2.open = 1))

then

data_to_dvc7a.output_status = ((data_to_dvc7a.output_status)

or

(0x08))

else

data_to_dvc7a.output_status = ((data_to_dvc7a.output_status)

and

(0xf7))

end

if

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

Advertising
This manual is related to the following products: