LordSputnik
- Aug 11, 2011
- 45
- Joined
- Aug 11, 2011
- Messages
- 45
Dear all,
I'm writing a simple program in absolute mode, in order to get started with MPASM.
This program works as expected - an LED on B5 comes on and stays on:
However, if I want to add an interrupt routine, I need to use a goto in order to skip its execution at start up. With the GOTO in the program, the LED on B5 doesn't light up...
Does anyone know why this might be?
Let me know if you need any additional information in order to help! Many Thanks!
I'm writing a simple program in absolute mode, in order to get started with MPASM.
This program works as expected - an LED on B5 comes on and stays on:
Code:
LIST p=16f84
RADIX hex
#include <P16F84.inc>
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
var1 EQU 0x0C
ORG 0000h
;;; Initialization Code ;;;
start:
MOVLW 0xA0 ;; 10100000 Enable Global Interrupts, enable TMR0 interrupt.
BANKSEL INTCON
MOVWF INTCON
CLRF PORTB
MOVLW 0xD7 ;; 11010111 Set the TMR0 source to the internal clock, give the prescaler to TMR0, 1:128 Prescale.
BANKSEL OPTION_REG
MOVWF OPTION_REG
BANKSEL TRISB
CLRF TRISB ;; Set all of PORTB to be outputs.
BANKSEL PORTB
MOVLW 0x20
test:
MOVWF PORTB
GOTO test
END
However, if I want to add an interrupt routine, I need to use a goto in order to skip its execution at start up. With the GOTO in the program, the LED on B5 doesn't light up...
Code:
LIST p=16f84
RADIX hex
#include <P16F84.inc>
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
var1 EQU 0x0C
ORG 0000h
GOTO start
;;; Initialization Code ;;;
start:
MOVLW 0xA0 ;; 10100000 Enable Global Interrupts, enable TMR0 interrupt.
BANKSEL INTCON
MOVWF INTCON
CLRF PORTB
MOVLW 0xD7 ;; 11010111 Set the TMR0 source to the internal clock, give the prescaler to TMR0, 1:128 Prescale.
BANKSEL OPTION_REG
MOVWF OPTION_REG
BANKSEL TRISB
CLRF TRISB ;; Set all of PORTB to be outputs.
BANKSEL PORTB
MOVLW 0x20
test:
MOVWF PORTB
GOTO test
END
Does anyone know why this might be?
Let me know if you need any additional information in order to help! Many Thanks!