English
Language : 

MC68HC705E5 Datasheet, PDF (91/148 Pages) Freescale Semiconductor, Inc – General Release Specification
Freescale Semiconductor, Inc.
Motorola Bus (M Bus) Interface
Programming Considerations
11.8.4 Generation of the Stop Signal
A data transfer ends with a stop signal generated by the master device.
A master transmitter can simply generate a stop signal after all the data
has been transmitted.
The following is an example showing how a stop condition is generated
by a master transmitter.
MASTX
BRSET
LDA
BEQ
END
EMASTX
LDA
STA
DEC
BRA
BCLR
RTI
0,MSR,END
TXCNT
END
DATABUF
MDR
TXCNT
EMASTX
5,MCR
; IF NO ACK, BRANCH TO END
; GET VALUE FROM THE
; TRANSMITTING COUNTER
; IF NO MORE DATA, BRANCH TO
; END
; GET NEXT BYTE OF DATA
; TRANSMIT THE DATA
; DECREASE THE TXCNT
; EXIT
; GENERATE A STOP CONDITION
; RETURN FROM INTERRUPT
If a master receiver wants to terminate a data transfer, it must inform the
slave transmitter by not acknowledging the last byte of data. This can be
done by setting the transmit acknowledge bit (TXAK) before reading the
second to the last byte of data. Before reading the last byte of data, a
stop signal must be generated first.
The following is an example showing how a stop signal is generated by
a master receiver.
MASR
LAMAR
DEC
BEQ
LDA
DECA
BNE
BSET
BRA
ENMASR BCLR
NXMAR LDA
STA
RTI
RXCNT
ENMASR
RXCNT
NXMAR
3,MCR
NXMAR
5,MCR
MDR
RXBUF
; LAST BYTE TO BE READ
; CHECK LAST 2ND BYTE TO BE READ
; NOT LAST ONE OR LAST SECOND
; LAST SECOND, DISABLE ACK
; TRANSMITTING
; LAST ONE, GENERATE 'STOP'
; SIGNAL
; READ DATA AND STORE
MC68HC705E5 — Rev. 1.0
General Release Specification
Motorola Bus (M Bus) Interface
For More Information On This Product,
Go to: www.freescale.com