5 send receive bit / byte information, Send receive bit / byte information – High Country Tek emc-3L User Manual

Page 64

Advertising
background image

Second, add the following statements to the Always Code;


' This code will Monitor the engines RPM "RPM_Feedback" and adjust

' the throttle to maintain the desired SetPoint "RPM_SetPoint"

' regardless of engine load by monitoring the RPM Feedback and

' adjusting the Throttle Output to compensate for error.

' It will also shut down the output if the SetPoint exceeds it's

' Maximum Voltage Limit until it is reset by the Digital Input

' "Reset_RPM"

if

(RPM_SetPoint.MaxF)

then

Throttle.Enable = 0

'Sets the enable bit to Off or Disabled

Throttle.SetPoint = 0

'Forces the outputs Setpoint to 0

else

Throttle.Enable = RPM_SetPoint

'Sets the enable bit for the output to "On" when SetPoint >0%

Throttle.SetPoint = RPM_SetPoint

'Points the outputs SetPoint variable to the RPM_SetPoint Input

Throttle.Feedback = RPM_Feedback

'Points the outputs Feedback variable to the RPM_Feedback In

end

if

if

(Reset_RPM)

then

'Test the "Reset_RPM" switch and

RPM_SetPoint.MaxF = 0

'reset the RPM_SetPoint Max F Flag

end

if


Finely, Compile the application and load into a module for testing.

5.5 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

P/N: 021-00163, Rev. A.0 - for V5.2 Tools

Page | 64

Advertising
This manual is related to the following products: