Applications Information
MOTOROLA
MC68307 USER’S MANUAL
10-21
10.3.7.2 SOFTWARE LISTING 2—M-BUS SLAVE SOFTWARE
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
*
MOTOROLA 68307 IMBP TEST BOARD -
M-bus
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
*
MODULE:
MBM_INT.SRC
DATE:
8/4/94
*
Developed by :
Motorola
*
HI-END Applications
*
East Kilbride.
*
NOTES:
*
Slave M-bus Routine using interrupts for a Master/Slave Test
*
The number of bytes transmitted and received is completely
*
controlled by the master. (i.e. When the slave is receiving data,
*
it acknowledges all the time, and the master dictates the number of
*
bytes to transfer. When the slave is transmitting, the master
*
receiver acknowledges dictate whether the slave is to send further
*
bytes or not.
*
The Slave:
*
1) Recognizes its slave chip address, and receives 2 data bytes.
*
2) Recognizes its slave chip address, and transmits the 2 bytes
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
*
External Reference Declarations
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
XREF
SCR
; System Control Reg
XREF
PBCNT
; Port B Control Reg
XREF
PIVR
; Peripheral Interrupt Vector Reg
XREF
PICR
; Peripheral Interrupt Control Reg
XREF
MADR
; M-bus Address Reg
XREF
MFDR
; M-bus Freq Divider Reg
XREF
MBCR
; M-bus Control Reg
XREF
MBSR
; M-bus Status Reg
XREF
MBDR
; M-bus Data Reg
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
*
Constants
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
UVECBASE
EQU
$100
; User Vector Base
MBUSVEC
EQU
UVECBASE+($D*4)
; M-bus vector location
MBUSHAN
EQU
$15000
; M-bus Interrupt Handler location
S307_AD
EQU
$66
; Slave 68307 M-bus Address
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
*
Main Program
*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
ORG
$10000
; Random location for assembly
AND.L
#$FFFFFEFF,SCR
; Clear SCR bit 8, M-bus Clock Active
MOVE.B
#$40,PIVR
; Vector = #$40, Vector @ address $100
OR.W
#$000D,PICR
; M-bus Interrupt level = 5
MOVE.L
#MBUSHAN,MBUSVEC ; Set up M-bus Interrupt Handler