Applications Information
10-12
MC68307 USER’S MANUAL
MOTOROLA
10.3.2 M-Bus Master Mode Operation
Using interrupts to transmit data to the addressed slave is straight forward. During the M-
bus initialization, the MC68300 M-bus sets up the master transmitter mode, sets the M-bus
frequency, enables interrupts, provides an interrupt handler and STARTs the block transfer.
The targeted slave address (with LSB = 1 for slave receiver mode) is transmitted by writing
to the M-bus data register. On each subsequent end-of-byte interrupt, further data bytes are
transmitted by writing data to the M-bus data register until the block is complete. On the
interrupt at the end of the last byte the software STOPs the transfer.
For receiving from the addressed slave, the initialization is exactly the same. Remember that
even if receiving, the first operation is to transmit the targeted slave address (except that this
time LSB = '0'). In the interrupt handler at the end of the slave address transmit byte, the
transmit mode is changed to receive. Then, to initiate the first byte receive operation, the
MC68300 M-bus master software carries out a dummy read of the data register. No sensible
data is read at this point, but it is the action of this read which starts the data receive. At the
end of each subsequent received byte, the interrupt generated is used to read the data reg-
ister again for valid data, and to start the next byte receive. This continues until the master
receiver STOPs the block transfer.
The receiver is always responsible for the generation of acknowledges. The MC68300 M-
bus receiver can be programmed to generate acknowledges automatically for each byte
received. Most slave transmitters take an acknowledge from the master receiver to mean
that further bytes are desired. In fact, for some slave transmitters it is necessary for the mas-
ter receiver to acknowledge all received bytes except the last one, to indicate that more data
byte transmits are required. This is not a requirement of the MC68300 M-bus slave.
10.3.3 M-Bus Slave Mode Operation
Many of the principles discussed for the master operation also hold true for the slave
MC68300 M-bus. The main differences are that the MC68300 slave M-bus is not controlling
the transfer (STARTing and STOPping) or providing the M-bus clock, but is instead following
what the master dictates.
For slave operation, again initialize the M-bus frequency, M-bus slave address, interrupt
handler and interrupt enable. As the first transfer is always the receipt of the slave address,
slave receive mode should always be programmed initially. All target slave addresses which
are transmitted by the master (first byte after START) are then checked against the pro-
grammed MC68300 M-bus slave address for a match. When they match, the MC68300 M-
bus slave generates an interrupt (if enabled), and a status bit indicates the cause as M-bus
addressed-as-slave (MAAS).
On entering the corresponding interrupt handler, the software read/write status indicator is
read to determine whether the slave is to receive or transmit subsequent bytes and that the
transmit/receive mode is set accordingly. If in transmit mode, the first data byte transmit is
initiated by writing to the data register. If in receive mode, the first receive byte is initiated by
a dummy read of the data register. There is no sensible data read at this point, but having
started the receive process, data register reads in subsequent end-of-byte interrupts obtain