summaryrefslogtreecommitdiff
path: root/software/ihu
diff options
context:
space:
mode:
Diffstat (limited to 'software/ihu')
-rw-r--r--software/ihu/ihu.asm48
1 files changed, 43 insertions, 5 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm
index 3cde059..e080b7c 100644
--- a/software/ihu/ihu.asm
+++ b/software/ihu/ihu.asm
@@ -33,14 +33,27 @@
LIST p=16F887
include "p16f887.inc"
;; TODO: set correct configuration bits
- __config _FCMEN_OFF & _IESO_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
+ __config _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
+
;; -------------------------------------
;; DEFINES
- ;; TODO: find right address for context save registers
+ ;; constants
+
+ ;; I/O Pins
+LED EQU 5
+
+ ;; variables
+ ;; page 0 only
+CNT0 EQU H'0020'
+CNT1 EQU H'0021'
+
+ ;; all pages
W_TEMP EQU H'007E'
STATUS_TEMP EQU H'007F'
+ ;; bits
+
;; -------------------------------------
;; Reset Vector
org 0
@@ -54,6 +67,9 @@ STATUS_TEMP EQU H'007F'
swapf STATUS,W
movwf STATUS_TEMP
+ bcf STATUS,RP0
+ bcf STATUS,RP1
+
;; TODO: implement interrupt service routines
interrupt_end
@@ -67,8 +83,23 @@ interrupt_end
;; -------------------------------------
;; INIT
init
- ;; bank 1
- ;; TODO: do init stuff
+ ;; bank 1
+ bsf STATUS,RP0
+ bcf STATUS,RP1
+
+ movlw b'11000111'
+ movwf OPTION_REG
+ clrf PSTRCON
+ movlw b'00010000'
+ movwf OSCCON
+ movlw b'11011111'
+ movwf TRISD
+ bcf STATUS,RP0
+
+ ;; bank 0
+ bsf PORTD,LED
+ clrf TMR0
+
goto main
;; -------------------------------------
@@ -84,11 +115,18 @@ init
;; -------------------------------------
;; MAINLOOP
main
+ bcf INTCON,T0IF
+loop
+ btfss INTCON,T0IF
+ goto loop
- ;; TODO: add main code
+ movlw b'00100000'
+ xorwf PORTD,f
+ goto main
powerdown
sleep
+ nop
goto main
;; -------------------------------------