Well, it's refreshing to learn something new. Anyway, here's the code that didn't come through earlier.
Code:;This program will blink a light on portb.1 at a 1 hz rate -- 'with another LED on portd.1 blinking at a different rate 'different TMR1 preloads to get desired frequencies wsave VAR BYTE $70 SYSTEM ' alternate save location for W ' if using $70, comment wsave1-3 wsave1 VAR BYTE $A0 SYSTEM ' location for W if in bank1 wsave2 VAR BYTE $120 SYSTEM ' location for W if in bank2 wsave3 VAR BYTE $1A0 SYSTEM ' location for W if in bank3 LED1 VAR PORTB.1 led2 VAR portd.0 INCLUDE "DT_INTS-14.bas" ' Base Interrupt System INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts DEFINE osc20 ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR1_INT, _ToggleLED1, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM T1CON = %00000001 ; Prescaler = 1:1, TMR1ON @ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts preload VAR WORD preload = 61476 '60543 by MultiCalc should yields about 200Hz but '60643 yeilds exactly 100 Hz ' 48876 29.8cps ' 57209 yields 59.5cps ' 61376 yields tmr1l = preload.LowByte tmr1h = preload.HighByte Main: PAUSE 500 TOGGLE led2 PAUSE 500 TOGGLE led2 GOTO Main '---[TMR1 - interrupt handler]------------------------------------ ToggleLED1: t1con.0 = 0 tmr1l = preload.LowByte tmr1h = preload.HighByte t1con.0 = 1 TOGGLE LED1 @ INT_RETURN




Bookmarks