Thanks Dave!
This is what is actually working for me thus far! At least some success:
Code:
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
DEFINE OSC 20 ' Running with a 20MHz x-tal
DEFINE HSER_BAUD 9600
DEFINE HSER_TXSTA 20h
@ __CONFIG _CONFIG1H, _HS_OSC_1H & _FSCM_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_1_2H
@ __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
@ __CONFIG _CONFIG3H, _CCP2MX_OFF_3H & _PBAD_DIG_3H & _MCLRE_OFF_3H
ADCON1 = 7
TRISB = %11110111 ' Set PortB direction.
T0CON = %10000001 ' 16 bit Prescaler assigned to TMR0, 1:4 ratio
TrigOut VAR PortB.3 ' Pin for 60Hz output
PreLoad VAR WORD
PreLoad = 52000
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR0_INT, _ISR, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE TMR0_INT ; Enable the 120Hz interrupt for the square wave generator.
Main:
Pause 2000
HSEROUT["Is This Working???",10,13] ' The lights are on... is anyone home?
GOTO Main
ISR:
IF TrigOut = 0 THEN ' If trig output is low....
TrigOut = 1 ' Set trig output high
ELSE
TrigOut = 0 ' Trig output was high, set it low.
ENDIF
TMR0L = PreLoad.LowByte ' TMR0 High and low bytes preloaded
TMR0H = PreLoad.HighByte
@ INT_RETURN
GOTO main:
Now to add to it
Bookmarks