4 using the interrupt function – Campbell Hausfeld SDM-CAN User Manual

Page 38

Advertising
background image

SDM-CAN CAN-Bus Interface User Guide

3.5.4 Using the Interrupt Function

By indexing (‘--‘) the No. of bits parameter, when a new value that an instruction
refers to is received the SDM-CAN I/O interrupt is enabled. This can be used to
set a control port high and run an interrupt subroutine. An example of using the
interrupt function is shown below.

;{CR23X}

;

*Table 1 Program

01: 1 Execution Interval (seconds)

;Set flag 1 high to set SDM-CAN internal software switches

1: If Flag/Port (P91)

1: 11 Do if Flag 1 is High

2: 30 Then Do

;Load input location with value for switches

2: Z=F (P30)

1: 10 F

2: 0 Exponent of 10

3: 3 Z Loc [ Switches ]

;Send switch settings to SDM-CAN

3: SDM-CAN (P118)

1: 0 SDM Address

2: 2 Time Quanta

3: 5 Tseg1

4: 2 Tseg2

5: 1 ID Bits 0..10

6: 0 ID Bits 11..23

7: 0 ID Bits 24..28

8: 32 Set switches

9: 00 Start Bit No.

10: 00 No. of Bits

11: 00 No. of Values

12: 3 Loc [ Switches ]

13: 1.0 Mult

14: 0.0 Offset

;Set flag 1 low after sending switch settings

4: Do (P86)

1: 21 Set Flag 1 Low

5: End (P95)

*Table 2 Program

02: 0.0000 Execution Interval (seconds)

*Table 3 Subroutines

3-20

Advertising