Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8XC196Kx,8XC196Jx,87C196CA microcontroller family user's manual.1995.pdf
Скачиваний:
57
Добавлен:
23.08.2013
Размер:
3.97 Mб
Скачать

CAN SERIAL COMMUNICATIONS CONTROLLER

12.8 FLOW DIAGRAMS

The flow diagrams in this section describe the steps that your software (shown as CPU) and the CAN controller execute to receive and transmit messages. Table 12-13 lists the register bits shown in the diagrams along with their associated registers and a cross-reference to the figure that describes them.

Table 12-13. Cross-reference for Register Bits Shown in Flowcharts

Bit Mnemonic

Register Mnemonic

Figure and Page

 

 

 

CPUUPD

CAN_MSGxCON1

Figure 12-15 on page 12-26

 

 

 

DIR

CAN_MSGxCFG

Figure 12-12 on page 12-21

 

 

 

DLC

CAN_MSGxCFG

Figure 12-12 on page 12-21

 

 

 

ID

CAN_MSGxID

Figure 12-13 on page 12-22

 

 

 

INT_PND

CAN_MSGxCON0

Figure 12-14 on page 12-24

 

 

 

MSGLST

CAN_MSGxCON1

Figure 12-15 on page 12-26

 

 

 

MSGVAL

CAN_MSGxCON0

Figure 12-14 on page 12-24

 

 

 

NEWDAT

CAN_MSGxCON1

Figure 12-15 on page 12-26

 

 

 

RMTPND

CAN_MSGxCON1

Figure 12-15 on page 12-26

 

 

 

RXIE

CAN_MSGxCON0

Figure 12-14 on page 12-24

 

 

 

TXIE

CAN_MSGxCON0

Figure 12-14 on page 12-24

 

 

 

TX_REG

CAN_MSGxCON1

Figure 12-15 on page 12-26

 

 

 

XTD

CAN_MSGxCFG

Figure 12-12 on page 12-21

 

 

 

12-35

8XC196Kx, Jx, CA USER’S MANUAL

Power Up

(All bits undefined)

 

 

 

 

 

 

 

 

 

 

 

 

 

MSGVAL

:= 1

 

 

INT_PND

:= 0

 

 

TXIE

:= (Application specific)

Initialization

RXIE

:= (Application specific)

NEWDAT

:= 0

 

 

 

 

RMTPND

:= 0

 

 

TX_REQ

:= 0

 

 

MSGLST

:= 0

 

 

DLC

:= (don't care)

 

DIR

:= 0 (receive)

 

XTD

:= (Application specific)

 

ID

:= (Application specific)

 

 

 

 

NEWDAT := 0

Process message contents.

Process

Yes

NEWDAT = 1?

Restart Process

No

No

Request update?

Yes

TX_REQ := 1

A2594-01

Figure 12-22. Receiving a Message for Message Objects 1–14 — CPU Flow

12-36

CAN SERIAL COMMUNICATIONS CONTROLLER

Power Up

(All bits undefined)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

MSGVAL

:= 1

 

 

 

INT_PND

:= 0

 

 

 

RXIE

:= (Application specific)

Initialization

NEWDAT

:= 0

 

 

 

RMTPND

:= 0

 

 

 

MSGLST

:= 0

 

DIR

:= 0 (receive)

XTD

:= (Application specific)

ID

:= (Application specific)

MASK

:= (Application specific)

 

Process message contents.

 

INT_PND := 0

 

NEWDAT := 0 and RMTPND := 0

Process

 

 

Yes

 

NEWDAT = 1?

 

Restart Process

 

No

A2597-02

Figure 12-23. Receiving a Message for Message Object 15 — CPU Flow

12-37

8XC196Kx, Jx, CA USER’S MANUAL

Yes

No TX_REQ=1?

MSGLST=0?

Yes

NEWDAT := 0 Load identifer and control into buffer

Send remote frame

No

Transmission

successful?

Yes

TX_REQ := 0

RMTPND:= 0

No

TXIE = 1?

Yes

INT_PND := 1

Bus idle?

No

Received frame with

No

same identifer as this

 

 

message object?

 

Yes

NEWDAT = 1?

MSGLST := 1

Store message

NEWDAT := 1

TX_REQ := 0

RMTPND := 0

No

RXIE = 1?

Yes

INT_PND := 1

A2598-01

Figure 12-24. Receiving a Message — CAN Controller Flow

12-38

CAN SERIAL COMMUNICATIONS CONTROLLER

Power Up

(All bits undefined)

 

MSGVAL

:= 1

 

INT_PND

:= 0

 

TXIE

:= (Application specific)

Initialization

RXIE

:= (Application specific)

NEWDAT

:= 0

 

 

RMTPND

:= 0

 

TX_REQ

:= 0

 

MSGLST

:= 0

 

DLC

:= (Application specific)

 

DIR

:= 1 (transmit)

 

XTD

:= (Application specific)

 

ID

:= (Application specific)

 

CPUUPD := 1

 

NEWDAT := 1

Update

Write/calculate message contents.

 

CPUUPD := 0

Yes

Want to send?

 

 

TX_REQ := 1

 

 

 

No

Yes

 

Update message?

 

 

A2596-01

Figure 12-25. Transmitting a Message — CPU Flow

12-39

8XC196Kx, Jx, CA USER’S MANUAL

Bus free?

Yes

No

TX_REQ= 1?

 

 

CPUUPD= 0?

No

Received remote frame

No

with same identifer as

 

 

this message object?

 

Yes

NEWDAT := 0 Load message into buffer

Send message

No

 

 

 

Transmission

 

 

 

successful?

 

 

 

 

Yes

 

 

 

 

 

 

 

 

 

No

 

 

NEWDAT = 1?

TX_REQ := 0

 

 

 

 

RMTPND := 0

 

 

 

 

Yes

No

TXIE = 1?

Yes

INT_PND := 1

Yes

TX_REQ := 1

RMTPND := 1

No

RXIE = 1?

Yes

INT_PND := 1

A2595-02

Figure 12-26. Transmitting a Message — CAN Cont roller Flow

12-40

Соседние файлы в предмете Электротехника