Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 22 of 23

Bulletin 1771 Communication Controller Module (Cat. Nos. 1771-KE, -KF) User's Manual, pages 211 to 220

Pages 211 to 220 of 228

The original document is the PDF (9.6 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1771-KE

Page 211 read from a scan by OCR; it may hold reading errors

Page B-17 Detailed Flow Charts

TRANSMIT INTERRUPT, NOTE: This figure assumes the use of a Z80 $10. { NOTE:UART transmit interrupt must be enabled and disabled without

WAKEUP affecting the current state of the receive and status interrupt enable flags.

Resume Process Sleeping At TXWAIT

1 t INTERRUPT RETURN

11670

Figure B.17, TRANSMIT INTERRUPT Subroutine

Page 212 read from a scan by OCR; it may hold reading errors

Page B-18 Detailed Flow Charts

SLEEP

: j

An Implementation Dependent Routine to Suspend Own Process at a Sleep Variable Until Another Process Wakes This One Up

RETURN

WAKEUP

Uo

An Implementation Dependent Routine to Wake Up the Process at a Sleep Variable if Any is Sleeping There l ( RETURN )

Input: ® The Address of a Sleep Variable. Sleep Variables:

¢ Typically an address of a stack or

@ process or context save area.

A process can suspend itself and place its address in a sleep variable.

Subsequently another process can wake up the sleeping process by referring to sleep variable. When no process is sleeping at a sleep variable, a WAKEUP has no effect.

Input:

© The Address of a Sleep Variable

Figure B.18, SLEEP and WAKEUP Subroutines

Page 213 read from a scan by OCR; it may hold reading errors

Page B-19 Detailed Flow Charts

NOTE: SLEEP and WAKEUP are always used in connection with some type of indivisible interprocess interlock. Indivisibly is achieved on many processors (e.g. - 2-80) by disabling processor interrupts. For this reason SLEEP and WAKEUP assume that interrupts are off when they are called. They will always return with interrupts off.

The interaction of SLEEP and WAKEUP:

When one process calls SLEEP, the result is a return froma WAKEUP by another process. When a process calls WAKEUP, the result is a return from a call to SLEEP by another process. An interrupt subroutine that calls WAKEUFP is viewed as a subroutine of the interrupted process.

PROCESS A

©

SLEEP el

©

OmxO)

In the example in figure B.18 Process B woke up Process A some time ago. Now, at 1, when A goes to sleep, actual execution resumes after the wakeup call in B at 3 and 4. Sometime later, process C (at an interrupt, for example) calls WAKEUP at 5. Execution flow proceeds to the instructions at 8 following the call to SLEEP in Process A. The next time A calls SLEEP, the WAKEUP call in C will terminate.

NOTE: This is not the only possible implementation of SLEEP and WAKEUP.

Another implementation would allow a process to call WAKEUP without losing immediate control of the processor. Context switching would be deferred until B itself executed a SLEEP.

PROCESS B

A Previous Wakeup

A third alternative would cause a context switch of a process performed a WAKEUP on a higher priority process. If a WAKEUP was performed on a lower priority process the context switch would be deferred until the first process went to SLEEP.

The first alternative is the result of implementing the driver totally at interrupt level. The third alternative would be used if the driver were implemented as tasks, under a multitasking operating system. Such an implementation might be easier, but would probably be limited to lowever baud rates

PROCESS C

Q. - =toe--=-@

NOTE: Sequence of processor execution is indicated by circled numbers.

WAKEUP

11672

Figure B.19, SLEEP and WAKEUP Interaction

Page 214 read from a scan by OCR; it may hold reading errors

Page B-20

Detailed Flow Charts

Powerup: At powerup the Z-80 starts executing code at location 0. The powerup routine starts the XMIT and RCVE processes by executing a SPAWN. A SPAWN is very similar to a WAKEUP, except the corresponding SLEEP is imaginary, and is located ahead of the first instruction of the SPAWNed process.

POWERUP

SPAWN RCVE

SPAWN XMIT

Continue Initialization

11673

Figure B.20, POWERUP Routine

Page 215 read from a scan by OCR; it may hold reading errors

Page B-21 Detailed Flow Charts

The Address of a Queue is

_ - the Address of its Root.

ROOT

MESSAGE CONTROL BLOCKS

FIRST

NEXT

MESSAGE a

MESSAGES

LAST

SIZE

STATUS

NOTE: Messages are added to the end of the queue and removed from the head.

NEXT

MESSAGE

Network Data Block

SIZE

STATUS

Q

MESSAGE

Network Data Block

SIZE

STATUS

Network Data Block

11674

Figure B.21, Message Queue

Page 216 read from a scan by OCR; it may hold reading errors

Page B-22 Detailed Flow Charts

Input:

( UNLINK ) e Address of Queue Output:

¢ Message Control Block

An Implementation Dependent Routine that Removes a Message from a Queue f ( RETURN )

11675

Figure B.22, UNLINK Subroutine

Input: LINK * Address of Queue Message Block

An Implementation Dependent Routine that Places a Message onto a Queue

( RETURN )

11676

Figure B.23, LINK Subroutine

Page 217 read from a scan by OCR; it may hold reading errors

Page B-23

Detailed Flow Charts

C=)

Y

Reset Buffer Flag: Set HEADER to Illegal Value

Y

GET BUFFER

Get a Buffer a

.

LAST = NAK

Variables:

LAST: Value of Last Response

HEADER: DST, SRC, CMD, STS and TNS from last message

BUFFER: Whether an Empty Buffer is Read

Receiver error flag

,

Reset Receiver Error Flag i

GET CODE

Get Next Input

Control

Code ?

SEND CTL

DLE ENQ Yes 9

XMSG

Transfer Message to Network Layer

Ignore Flag (0) ?

No

Save Response (ACK or NACK) in LAST

L

Transmit LAST

NOTE: XMSG Returns ACK, NACK, or 0 (for Ignored Message)

11654

Figure B.24, Receiver Routine for Full-Duplex Protocol

Page 218 read from a scan by OCR; it may hold reading errors

Page B-24

Detailed Flow Charts

Yes

( XMSG )

j

GETBUF

Check Availability of Receive Buffer r

Clear CRC Accumulator

GETCODE

Get a Code

Link Data

No

Output Flag: e ACK if Message is OK e NAK if Message is in Error

¢ Oif Message is to be Ignored

?

Code =

Station No.

Buffer Available

Buffer

Overflow 2

Save Byte in Buffer

GETCODE

Get Next Code y

Return An Ignore Flag (0)

©

DLE ETX

No

Available ?

Yes

Did

Buffer Yes

Overflow ?

Yes

Message

Too Small

Compare Message with HEADER

Duplicate Message ?

Save New Header y

SENDNET

Send Link Data to Network Layer

GETBUF

Try to Get Another Buffer

Return an ACK

Return a NAK

11678

Figure B.25, XMSG Subroutine

Page 219 read from a scan by OCR; it may hold reading errors

Page B-25 Detailed Flow Charts

Y

GETRAW

Get Byte From UART

BCC DLE No ? Add Data Bytes to BCC Yes

GETRAW

Return Byte and Data Flag

Get Byte From UART

Save ACK or NAK in RESP

WAKEUP

Resume XMIT if Sleeping at WTRESP

Return Byte and Control Flag GETRAW Get BCC Output: 1 ® BYTE, What Was Received BCC ® Control Data, Set if BYTE is a control character which was Include in Check preceded by a DLE

NOTE: BCC should Now Equal Zero.

Return EXT and Control Flag

11679

Figure B.26, GETCODE Subroutine

Page 220 read from a scan by OCR; it may hold reading errors

Page B-26 Detailed Flow Charts

( GETRAW )

Disable Processor Interrupts

Set Receiver Error Flag

Discard Bad Data

Reset UART Error Flag

Yes

Enable UART Receive Interrupt

Byte in UART

Yes

SLEEP

Wait For RXD Interrupt at RXDWAIT

Disable UART Received Interrupt

Check Parity Framing, and Receiver Overrun

NOTE: This figure assumes the use of a Z80 Si0.

No

Get Byte From UART

J y

Enable Processor Interrupts

RETURN

11680

Figure B.27, GETRAW Subroutine