AnsweredAssumed Answered

Doubt with interrupts with MC9s08sh8

Question asked by Gaston Avanses on Nov 3, 2012
Latest reply on Nov 6, 2012 by Gaston Avanses

Hi, i'm trying to make a program that when i put VCC on one pin of the PortA, the program jump to an Interrupt and turns on a Led on Port B.

The problem is that i can't configure the interrups, and i can't find my error, can anyone help me?? Thanks

it's a simply test program, here it's:

 

 

; Include derivative-specific definitions

            INCLUDE 'derivative.inc'

; export symbols

;

            XDEF _Startup

            ABSENTRY _Startup

 

; variable/data section

;

            ORG    RAMStart         ; Insert your data definition here

            ORG    ROMStart

 

_Startup:

       LDA SOPT1 ;Deshabilita COP

       AND #%00111111

       STA SOPT1

       LDHX #RAMEnd+1 ; initialize the stack pointer

       TXS

 

       MOV #%00000001,PTBDD

       MOV #%00000000,PTCDD

 

       MOV #%00000000,PTAES ;SLEW RATE

       MOV #%00000000,PTADD ;IN/OUT

       MOV #%00111111,PTAPE ;PULL-UP/PULL-DOWN

       MOV #%00001111,PTASC ;INTERRUP STATUS AND CONTROL

       MOV #%00001111,PTAPS ;HABILITAR/DES INTERRUPCIONES

       ;MOV #%00001111,PTAES ;

 

       CLI

 

 

INICIO:

       BCLR 0,PTBD

ini

       JMP ini

 

;**************************************************************

;* spurious - Spurious Interrupt Service Routine.             *

;*             (unwanted interrupt)                           *

;**************************************************************

interrup:

            NOP   

            SEI

            BSET 0,PTBD

            CLI   

            RTI   

 

 

spurious: ; placed here so that security value

            NOP ; does not change all the time.

       RTI   

 

 

;**************************************************************

;*                 Interrupt Vectors                          *

;**************************************************************

  ORG $FFD6

  DC.W interrup

 

 

  ORG $FFFA

 

 

  DC.W  spurious ;

  DC.W  spurious ; SWI

  DC.W  _Startup ; Reset

Outcomes