completely untested, should work anyway...
Code:
define OSC 20
include ".\include_routines\DT_INTS-14.bas"
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _SINUS, ASM, yes
endm
INT_CREATE
endasm
'------- Configurações iniciais --------------------
TRISA = %00000000 ' PORTA
TRISB = %00000000 ' PORTB
TRISC = %00000000 ' PORTC
TRISD = %00000000 ' PORTD
TRISE = %00000000 ' PORTE
OPTION_REG = %00000000
ADCON1 = %10001111 ' all digital
T1CON = %00000000 ' TMR1 1:1 prescaler
PIE1 = %00000001 ' Henable TMR1 INT
@TIMER1=TMR1L
TIMER1 var word EXT
INT VAR PIR1.0 ' OVERFLOW flag
START VAR T1CON.0 ' START TMR1
LOAD CON 65404 ' INT. 36KHz
TIMER1=LOAD
START = 1
@ INT_ENABLE TMR1_INT
PORTB.0 = 1
MAIN:
GOTO MAIN
SINUS:
ASM
MOVE?CT 0, T1CON, TMR1ON ; Stop Timer1
MOVLW LOW(_LOAD) ; Reload timer1
ADDWF TMR1L,F ; but add current Timer
BTFSC STATUS,C ; value
INCF TMR1H,F ;
MOVLW HIGH(_LOAD) ;
ADDWF TMR1H,F ;
MOVE?CT 1, T1CON, TMR1ON ; Start Timer1
ENDASM
toggle PORTB.0
@ INT_RETURN
Bookmarks