summaryrefslogtreecommitdiff
path: root/software/ihu/ihu.asm
diff options
context:
space:
mode:
Diffstat (limited to 'software/ihu/ihu.asm')
-rw-r--r--software/ihu/ihu.asm23
1 files changed, 16 insertions, 7 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm
index a4c53a4..e84eb9a 100644
--- a/software/ihu/ihu.asm
+++ b/software/ihu/ihu.asm
@@ -32,8 +32,13 @@
LIST p=16F887
include "p16f887.inc"
- __config _CONFIG1, _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_NSLEEP & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
- __config _CONFIG2, _BOR21V & _WRT_OFF
+ ;; This is specified via bootloader-IHU.asm
+ ;; __config _CONFIG1, _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_NSLEEP & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
+ ;; __config _CONFIG2, _BOR21V & _WRT_OFF
+
+BOOTLOADER EQU H'003'
+USERVECT EQU H'100'
+ISRVECT EQU H'104'
;; -------------------------------------
;; DEFINES
@@ -114,12 +119,12 @@ STATUS_TEMP EQU H'007F'
;; -------------------------------------
;; Reset Vector
- org 0
+ org USERVECT ; end of bootloader
goto init
;; -------------------------------------
;; Interrupt Vector
- org 4
+ org ISRVECT ; replocated ISR vector
;; save context
movwf W_TEMP
swapf STATUS,W
@@ -199,7 +204,8 @@ init
clrf PSTRCON ; disable pulse steering
movlw b'00010000' ; preselct 125 kHz, clock source as configured by configuration word
movwf OSCCON
- movlw b'11001111' ; input: RA0-RA3(analog),RA6-RA7(OSC); output: RA4-RA5(1wire)
+ ;; movlw b'11001111' ; input: RA0-RA3(analog),RA6-RA7(OSC); output: RA4-RA5(1wire)
+ movlw b'11011111' ; input: RA0-RA3(analog),RA6-RA7(OSC), RA4(BOOTPIN); output: RA5(1wire)
movwf TRISA
movlw b'11111111' ; input: all (interrupts and stats)
movwf TRISB
@@ -235,14 +241,17 @@ init
call i2c_init
clrf TMR0
- bsf INTCON,GIE
clrf TMP
+ bsf INTCON,GIE
+
+ btfsc RTC_RST ; if RTC is already finished, initialize it!
+ call rtc_init ; this maybe happend already via interrupt but better save than sorry
goto main
;; -------------------------------------
;; TABLES
- include "tables.inc"
+ include "tables.inc" ; this needs to stay inside 0x100 and 0x200
;; -------------------------------------
;; SUBROUTINES