works for me pic18f45k20
Code:,**************************************************************** '* Name : UNTITLED.BAS * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2015 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 4/14/2015 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** #CONFIG CONFIG FOSC = INTIO67 CONFIG FCMEN = OFF CONFIG IESO = OFF CONFIG PWRT = OFF CONFIG BOREN = SBORDIS CONFIG BORV = 18 CONFIG WDTEN = ON CONFIG WDTPS = 512 CONFIG CCP2MX = PORTC CONFIG PBADEN = OFF CONFIG LPT1OSC = OFF CONFIG HFOFST = ON CONFIG MCLRE = ON CONFIG STVREN = ON CONFIG LVP = OFF CONFIG XINST = OFF CONFIG DEBUG = OFF CONFIG CP0 = OFF CONFIG CP1 = OFF CONFIG CP2 = OFF CONFIG CP3 = OFF CONFIG CPB = OFF CONFIG CPD = OFF CONFIG WRT0 = OFF CONFIG WRT1 = OFF CONFIG WRT2 = OFF CONFIG WRT3 = OFF CONFIG WRTC = OFF CONFIG WRTB = OFF CONFIG WRTD = OFF CONFIG EBTR0 = OFF CONFIG EBTR1 = OFF CONFIG EBTR2 = OFF CONFIG EBTR3 = OFF CONFIG EBTRB = OFF #ENDCONFIG define OSC 64 osccon=$70 '64 mhz OSCTUNE.6=1 pause 2000 Serout2 PORTb.7,84,["ready",13,10] ' T0CON = %10000000 ; Prescaler = 2 ' T0CON = %10000001 ; Prescaler = 4 ' T0CON = %10000010 ; Prescaler = 8 ' T0CON = %10000011 ; Prescaler = 16 ' T0CON = %10000100 ; Prescaler = 32 T0CON = %10000101 ; Prescaler = 64 ' T0CON = %10000110 ; Prescaler = 128 ' T0CON = %10000111 ; Prescaler = 256 ' bit 7 TMR0ON: Timer0 On/Off Control bit ' 1 = Enables Timer0 ' 0 = Stops Timer0 ' bit 6 T08BIT: Timer0 8-Bit/16-Bit Control bit ' 1 = Timer0 is configured as an 8-bit timer/counter ' 0 = Timer0 is configured as a 16-bit timer/counter ' bit 5 T0CS: Timer0 Clock Source Select bit ' 1 = Transition on T0CKI pin ' 0 = Internal instruction cycle clock (CLKO) ' bit 4 T0SE: Timer0 Source Edge Select bit ' 1 = Increment on high-to-low transition on T0CKI pin ' 0 = Increment on low-to-high transition on T0CKI pin ' bit 3 PSA: Timer0 Prescaler Assignment bit ' 1 = TImer0 prescaler is NOT assigned. Timer0 clock input bypasses prescaler. ' 0 = Timer0 prescaler is assigned. Timer0 clock input comes from prescaler output. ' bit 2-0 T0PS2:T0PS0: Timer0 Prescaler Select bits ' 111 = 1:256 Prescale value ' 110 = 1:128 Prescale value ' 101 = 1:64 Prescale value ' 100 = 1:32 Prescale value ' 011 = 1:16 Prescale value ' 010 = 1:8 Prescale value ' 001 = 1:4 Prescale value ' 000 = 1:2 Prescale value INCLUDE "DT_INTS-18.bas" ' Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR0_INT, _ToggleLED, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM TRISA = %00000000 TRISB = %00000000 TRISC = %00000000 TRISD = %00000000 TRISE = %00000000 LED1 VAR PORTD.0 LED2 VAR PORTD.1 @ INT_ENABLE TMR0_INT ; enable Timer 0 interrupts PAUSE 1500 ' wait for PIC and LCD to stabilize LCDOUT $FE,1,"Timer test Lab X1" Main: TOGGLE LED2 PAUSE 500 GOTO Main ToggleLED: TOGGLE LED1 @ INT_RETURN END




Bookmarks