English
Language : 

M68HC11E Datasheet, PDF (252/268 Pages) Motorola, Inc – Microcontrollers
Application Note
Freescale Semiconductor, Inc.
150
****************************************************
151
* Main bootloader starts here
152
****************************************************
153
* RESET vector points to here
154
155 BF54
BEGIN EQU *
156 BF54 8E01FF
LDS #RAMEND
Initialize stack pntr
157 BF57 CE1000
LDX #$1000
Point at internal regs
158 BF5A 1C2820
BSET SPCR,X $20
Select port D wire-OR mode
159 BF5D CCA20C
LDD #$A20C
BAUD in A, SCCR2 in B
160 BF60 A72B
STAA BAUD,X
SCPx = ÷4, SCRx = ÷4
161
* Writing 1 to MSB of BAUD resets count chain
162 BF62 E72D
STAB SCCR2,X
Rx and Tx Enabled
163 BF64 CC021B
LDD #DELAYF
Delay for fast baud rate
164 BF67 ED16
STD TOC1,X
Set as default delay
165
166
* Send BREAK to signal ready for download
167 BF69 1C2D01
BSET SCCR2,X $01 Set send break bit
168 BF6C 1E0801FC
BRSET PORTD,X $01 * Wait for RxD pin to go low
169 BF70 1D2D01
BCLR SCCR2,X $01 Clear send break bit
170 BF73
171 BF73 1F2E20FC
BRCLR SCSR,X $20 * Wait for RDRF
172 BF77 A62F
LDAA SCDAT,X
Read data
173
* Data will be $00 if BREAK OR $00 received
174 BF79 2603
BNE NOTZERO
Bypass JMP if not 0
175 BF7B 7EB600
JMP EEPMSTR
Jump to EEPROM if it was 0
176 BF7E
NOTZERO EQU *
177 BF7E 81FF
CMPA #$FF
$FF will be seen as $FF
178 BF80 2708
BEQ BAUDOK
If baud was correct
179
* Or else change to ÷104 (÷13 & ÷8) 1200 @ 2MHZ
180 BF82 1C2B33
BSET BAUD,X $33
Works because $22 -> $33
181 BF85 CC0DB0
LDD #DELAYS
And switch to slower...
182 BF88 ED16
STD TOC1,X
delay constant
183 BF8A
BAUDOK EQU *
184 BF8A 18CE0000
LDY #RAMSTR
Point at start of RAM
185
186 BF8E
WAIT
EQU *
187 BF8E EC16
LDD TOC1,X
Move delay constant to D
188 BF90
WTLOOP EQU *
189 BF90 1E2E2007
BRSET SCSR,X $20 NEWONE Exit loop if RDRF set
190 BF94 8F
XGDX
Swap delay count to X
191 BF95 09
DEX
Decrement count
192 BF96 8F
XGDX
Swap back to D
193 BF97 26F7
BNE WTLOOP
Loop if not timed out
194 BF99 200F
BRA STAR
Quit download on timeout
195
196 BF9B
NEWONE EQU *
197 BF9B A62F
LDAA SCDAT,X
Get received data
198 BF9D 18A700
STAA $00,Y
Store to next RAM location
199 BFA0 A72F
STAA SCDAT,X
Transmit it for handshake
200 BFA2 1808
INY
Point at next RAM location
201 BFA4 188C0200
CPY #RAMEND+1
See if past end
202 BFA8 26E4
BNE WAIT
If not, Get another
AN1060 — Rev. 1.0
252
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com