mc68hc05bs8 Freescale Semiconductor, Inc, mc68hc05bs8 Datasheet - Page 72

no-image

mc68hc05bs8

Manufacturer Part Number
mc68hc05bs8
Description
Mc68hc05 Family Of Low-cost Single-chip Microcontrollers.
Manufacturer
Freescale Semiconductor, Inc
Datasheet
8
MIF bit in the interrupt routine first. The MCF bit can be cleared by reading the M-Bus Data I/O
Register (MDR) in receive mode or writing to the MDR in transmit mode. Software may serve the
M-Bus I/O in the main program by monitoring the MIF bit if the interrupt is disabled. The following
is an example of a software response by a master in transmit mode in the interrupt routine (see
Figure 8-4).
ISR
TRANSMIT
8.4.4
A data transfer ends with a STOP signal generated by the master device. A master in transmit
mode can simply generate a STOP signal after all the data have been transmitted. The following
is an example showing how a STOP condition is generated by a master in transmit mode.
MASTX BRSET 0,MSR,END
END
EMASTX RTI
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 achieved by setting the transmit acknowledge bit
(TXAK) before reading the 2nd 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 in receive mode.
MASR
8-12
LDA
BEQ
LDA
STA
DEC
BRA
BCLR
DEC
BEQ
LDA
DECA
BNE
Generation of the STOP Signal
BCLR
BRCLR 5,MCR,SLAVE
BRCLR 4,MCR,RECEIVE ; CHECK THE MODE FLAG,
BRSET 0,MSR,END
LDA
STA
TXCNT
END
DATABUF
MDR
TXCNT
EMASTX
5,MCR
RXCNT
ENMASR
RXCNT
NXMAR
1,MSR
DATABUF
MDR
M-BUS SERIAL INTERFACE
; TRANSMITTING COUNTER
; IF NO MORE DATA, BRANCH TO
; END
; TRANSMIT THE DATA
; CHECK LAST 2ND BYTE TO BE READ
; IF NO ACK, BRANCH TO END
; GET VALUE FROM THE
; GET NEXT BYTE OF DATA
; DECREASE THE TXCNT
; EXIT
; GENERATE A STOP CONDITION
; RETURN FROM INTERRUPT
; LAST BYTE TO BE READ
; NOT LAST ONE OR LAST SECOND
; BRANCH IF SLAVE MODE
; BRANCH IF IN RECEIVE MODE
; IF NO ACK, END OF
; TRANSMISSION
; TRANSMIT THE DATA
; CLEAR THE MIF FLAG
; CHECK THE MSTA FLAG,
; CHECK ACK FROM RECEIVER
; GET THE NEXT BYTE OF DATA
MC68HC05BS8
TPG

Related parts for mc68hc05bs8