;--------------------------------------------------------------------
;
; Code.asm
;
; Version 7 Datum: 19.05.2007
;
; PROGRAMER: Michael Frey
;
; Für PIC16F505 Prozessor mit internem RC Oszillator
;
; 8x8 LED Matrix Animation Engine
;--------------------------------------------------------------------
; Assembler Direktiven
list P=16F505, r=hex
include P16F505.inc
__CONFIG _WDT_OFF & _MCLRE_OFF & _CP_OFF & _IntRC_OSC_RB4EN ; Watchdogtimer & Masterclear OFF, Codeprotection OFF
movlf macro value,destfile
movlw value
movwf destfile
endm
movff macro source,destfile
movf source, w
movwf destfile
endm
movb macro source, sourcebit, dest, destbit
;BTFSS source,sourcebit Spart eine Anweissung
BCF dest,destbit
BTFSC source,sourcebit
BSF dest,destbit
endm
;--------------------------------------------------------------------
; Variablen
;--------------------------------------------------------------------
cblock h'10'
C0
C1
ptr
i ;Laufvariabel
j ;Laufvariabel
PortB0
PortC0
endc
;--------------------------------------------------------------------
; Initialisierung
;--------------------------------------------------------------------
goto UpMem ;More Space for the Look Up Table
TabRead:call Con1 ;Please max. 8 Instruction, if there
goto back ;are more you lose a frame.
con1: movwf PCL
TabA:
include test.asm
;include smile.asm
;include hangman.asm
;include blank.asm
TabE:
org 0x100
UpMem:
; init outputs to 0V
CLRF PortB
CLRF PortC
movlw B'11001111' ; Bit7: Enable Wake-up on Pin Change(PB0, PB1, PB3) 1:disable 0:enable
option ; Bit6: Enable weak pull-ups(PB0, PB1, PB3) 1:disable 0:enable
; Bit5: TMR0 clock source selection 1:T0clkPIN 0:internal Fosc/4
; Bit4: TMR0 source edge selection 1:hi to low 0:low to hi
; Bit3: Prescaler assignement 1:to WDT 0:to TMR0
; Bit2-0: Prescale value 000:min (1:1 WDT) (1:2 TMR0) 111:max (1:128 WDT) (1:256 TMR0)
movlw B'00001000' ;init value for tris-register
tris PortB
movlw B'00000000' ;init value for tris-register
tris PortC
MainLoop:
movlf tabA-8,i ;For i=tabA to tabE-8 step +8
For0: movlw d'8'
BCF Status,C
addwf i,f
movlf d'100',c1 ; For c1=100 to 0 step -1
For1: movlf h'08', j ; For j=7 to 0
For3: decf j,f
movff i,ptr
movff j,PortB0 ; PortB0 = -j, w = j
comf PortB0,f
BCF Status,C ; Table read
Addwf ptr,w
goto TabRead
back:
movwf PortC0 ; (prepare output)
movb PortC0,6, PortB0,4
movb PortC0,7, PortB0,5
movff PortB0, PortB ; Output
movff PortC0, PortC
movlf d'255',c0 ; ~ 500us
BL0: DECFSZ c0, F
goto BL0
movf j,w ; Next J
BTFSS Status,Z
Goto For3
DECFSZ c1, F ; Next c1
goto For1
movf i,w ;Next i
xorlw tabE-8
BTFSS Status,Z
Goto For0
goto MainLoop
end