AN1212 Freescale Semiconductor / Motorola, AN1212 Datasheet - Page 24

no-image

AN1212

Manufacturer Part Number
AN1212
Description
J1850 Multiplex Bus Communication Using the MC68HC705C8 and the SC371016 J1850 Communications Interface (JCI)
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Freescale Semiconductor, Inc.
AN1212/D
As soon as a qualified message is stored in one of the JCI’s two Rx buffers, the
INT output is asserted. This output is connected to the MC68HC705C8 IRQ
input, generating a CPU interrupt. The interrupt service routine first retrieves
and discards the priority/type byte of the message. The second byte of the
message, the target address byte, is then retrieved. This byte is compared to
each functional I.D. for which a received message buffer has been reserved.
As soon as a match is found, the received message buffer pointer
corresponding to that functional I.D. is loaded into the X register. The target
address byte is then discarded, as is the next byte retrieved, the source
address byte. It is not necessary to retain these bytes of the message, since a
logical assumption is that the functional I.D. must be known to the receiver
already, and the source address is of no use since the function, and not the
source, of the message data is what is important.
The data bytes are then retrieved by the host MCU until the JCI status shows
the Rx buffer to be empty. Each of the retrieved data bytes is loaded into host
MCU RAM beginning at the RAM location whose value is in the appropriate
received message buffer pointer. The number of data bytes contained in each
received message is not saved because the number of data bytes of any
message transmitted on the J1850 MUX bus is pre-defined, and therefore the
user should already know how many data bytes will be retrieved for each
functional I.D. specified.
At anytime during the retrieval of a message from the JCI, if the host MCU
determines that the message is of no interest, the host MCU can call the
RXFLUSH subroutine. This subroutine will command the JCI to clear the
current Rx buffer immediately. Once the entire message has either been
retrieved or cleared from the JCI’s Rx buffer, the buffer is released to receive
another message from the MUX bus. The interrupt service routine then returns
to the point in the user’s application software where the interrupt occurred.
Refer to
Figure 14
for the sequence followed during the IRQ interrupt service
routine.
This procedure results in each host MCU RAM receive buffer containing the
latest data received for a specified functional I.D., where the host MCU can
access it whenever it needs updated data. Whenever this stored data is
accessed, however, the host must first set the I bit to inhibit a receive interrupt.
If a receive interrupt is serviced while the host is accessing this stored data, it
is possible that the host could end up reading partial data from two different
received messages. Also, if physically addressed, or "node-to-node" messages
are to be utilized in the user’s system, it is a simple matter to modify the receive
routine to store the source address of the node-to-node message, if necessary,
in the first RAM location of a received message buffer, and to store the number
of data bytes received, if necessary, in a temporary storage location for use by
the host MCU.
24
J1850 Multiplex Bus Communication Using the MC68HC705C8
MOTOROLA
and the SC371016 J1850 Communications Interface (JCI)
For More Information On This Product,
Go to: www.freescale.com

Related parts for AN1212