Babatunde Ajilore

Getting started with MC9S12XDP512

Discussion created by Babatunde Ajilore on Oct 12, 2007
Latest reply on Dec 11, 2007 by Babatunde Ajilore
    I have been trying to work with the MC9S12XDP512 (AdaptS12X)  mcu module. I purchased this module from technologicalarts. I wrote a simple program - in assembly-  to  make Port PA7 high. This port is connected in series with a resistor and a diode. So when it goes high, the diode will be on. When I load the program using codewarrior, nothing happens ( There are also no errors generated). I've also tried using ubug12x to load the s19 file generated by codewarriror onto the module. It keeps giving an flash/eeprom error. I was told to convert the s19 file from codewarrior which is banked to a linear one and then tried to load it. This procedure gave me "Index was outside the bounds of the array" error and sometimes an unkonwn error. I have pasted a copy of my *.asm file.
   I need help getting started!!!!!!!!
;* This stationery serves as the framework for a                 *
;* user application (single file, absolute assembly application) *
;* For a more comprehensive program that                         *
;* demonstrates the more advanced functionality of this          *
;* processor, please see the demonstration applications          *
;* located in the examples subdirectory of the                   *
;* Freescale CodeWarrior for the HC12 Program directory          *
; export symbols
            XDEF Entry            ; export 'Entry' symbol
            ABSENTRY Entry        ; for absolute assembly: mark this as application entry point
; include derivative specific macros
            INCLUDE ''
ROMStart    EQU  $4000  ; absolute address to place my code/constant data
; variable/data section
            ORG RAMStart
 ; Insert here your data definition.
Counter     DS.W 1
FiboRes     DS.W 1

; code section
            ORG   ROMStart
Entry:      BSET DDRAB_DDRA7, #%00000001
            BSET PORTA_PA7, #%00000001
            MOVB #0, DDRJ_DDRJ0
            MOVB #0, PTJ_PTJ0
            LDS   #RAMEnd+1       ; initialize the stack pointer
            CLI                   ; enable interrupts
            LDX   #1              ; X contains counter
            STX   Counter         ; update global.
            BSR   CalcFibo
            STD   FiboRes         ; store result
            LDX   Counter
            CPX   #24             ; larger values cause overflow.
            BNE   couterLoop
            BRA   mainLoop        ; restart.
CalcFibo:  ; Function to calculate fibonacci numbers. Argument is in X.
            LDY   #$00            ; second last
            LDD   #$01            ; last
            DBEQ  X,FiboDone      ; loop once more (if X was 1, were done already)
            LEAY  D,Y             ; overwrite second last with new value
            EXG   D,Y             ; exchange them -> order is correct again
            DBNE  X,FiboLoop
            RTS                   ; result in D
;*                 Interrupt Vectors                          *
           ORG   $FFFE
            DC.W  Entry           ; Reset Vector