
Application Note
AN1060 — Rev. 1.0
232
MOTOROLA
 50               *****
 51               * Now wait for character from target to indicate it's ready for
 52               * data to be programmed into EPROM
 53 B627 132E20FC WT4FF      BRCLR  SCSR RDRF WT4FF  Wait for RDRF
 54 B62B 962F                LDAA   SCDR             Clear RDRF, don't need data
 55 B62D CED000              LDX    #EPSTRT          Point at start of EPROM
 56               * Handle turn-on of Vpp
 57 B630 18CE523D WT4VPP     LDY    #21053           Delay counter (about 200ms)
 58 B634 150402              BCLR   PORTB RED        Turn off RED LED
 59 B637 960A     DLYLP2     LDAA   PORTE            [3] Wait for Vpp to be ON
 60 B639 2AF5                BPL    WT4VPP           [3] Vpp sense is on port E MSB
 61 B63B 140402              BSET   PORTB RED        [6] Turn on RED LED
 62 B63E 1809                DEY                     [4]
 63 B640 26F5                BNE    DLYLP2           [3] Total loop time = 19 cyc
 64               * Vpp has been stable for 200ms
 65
 66 B642 18CED000            LDY    #EPSTRT          X=Tx pointer, Y=verify pointer
 67 B646 8D23                BSR    SEND1            Send first data to target
 68 B648 8C0000   DATALP     CPX    #0               X points at $0000 after last
 69 B64B 2702                BEQ    VERF             Skip send if no more
 70 B64D 8D1C                BSR    SEND1            Send another data char
 71 B64F 132E20FC VERF       BRCLR  SCSR RDRF VERF   Wait for Rx ready
 72 B653 962F                LDAA   SCDR             Get char and clr RDRF
 73 B655 18A100              CMPA   0,Y              Does char verify 
 74 B658 2705                BEQ    VERFOK           Skip error if OK
 75 B65A 150403              BCLR   PORTB (RED+GREEN) Turn off LEDs
 76 B65D 2007                BRA    DUNPRG           Done (programming failed)
 77 B65F                     
 78 B65F 1808     VERFOK     INY                     Advance verify pointer
 79 B661 26E5                BNE    DATALP           Continue till all done
 80 B663                     
 81 B663 140401              BSET   PORTB GREEN      Grn LED ON
 82 B666                     
 83 B666 150482   DUNPRG     BCLR   PORTB (RESET+RED) Red OFF, apply reset
 84 B669 20FE                BRA    *                Done so just hang
 85 B66B                     
 86               **************************************************
 87               * Subroutine to get & send an SCI char.  Also
 88               *  advances pointer (X).
 89               **************************************************
 90 B66B A600     SEND1      LDAA   0,X              Get a character
 91 B66D 132E80FC TRDYLP     BRCLR  SCSR TDRE TRDYLP Wait for TDRE
 92 B671 972F                STAA   SCDR             Send character
 93 B673 08                  INX                     Advance pointer
 94 B674 39                  RTS                     ** Return **
 95
F
Freescale Semiconductor, Inc.
For More Information On This Product,
  Go to: www.freescale.com
n
.