a 16f648a@20mhz just passes 8khz with a 32 step lu in asm for a 4 bit r2r ladder on portb
my lu values may be dodgy i just guessed them, result looks awful @ any freq
Code:
#CONFIG __config _INTOSC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_OFF & _MCLRE_ON & _BODEN_ON & _LVP_OFF & _DATA_CP_OFF & _CP_OFF
#ENDCONFIG
DEFINE OSC 20
inx var byte bank0
trisb=%11110000
goto overasm
asm
table
addwf PCL, F
retlw 8
retlw 9
retlw 10
retlw 11
retlw 12
retlw 13
retlw 14
retlw 14
retlw 15
retlw 14
retlw 14
retlw 13
retlw 12
retlw 11
retlw 10
retlw 9
retlw 8
retlw 6
retlw 5
retlw 4
retlw 3
retlw 2
retlw 1
retlw 1
retlw 0
retlw 1
retlw 1
retlw 2
retlw 3
retlw 4
retlw 5
retlw 6
_lu
movf _inx ,w
call table
MOVE?AB PORTB
RETURN
ENDASM
overasm:
inx=0
loopp:
CALL lu
inx=inx+1
inx =inx&31
goto loopp
Bookmarks