Sorry, it is PIC16F15345. Attached is modified DT_INTS-14 but does not work.
Code:' DISABLE DEBUG #CONFIG __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_OFF __config _CONFIG2, _MCLRE_ON & _PWRTE_ON & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_OFF & _WDTCWS_WDTCWS_6 & _WDTCCS_HFINTOSC __config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF __config _CONFIG5, _CP_OFF #ENDCONFIG ' OSCFRQ = %101 ' 16mhz DEFINE OSC 16 ' lcd setup DEFINE lcd_lines 4 DEFINE lcd_commandus 1500 DEFINE lcd_dataus 44 DEFINE LCD_DREG PORTB DEFINE LCD_DBIT 4 DEFINE LCD_RSREG PORTC DEFINE LCD_RSBIT 7 DEFINE LCD_EREG PORTC DEFINE LCD_EBIT 6 ' '-------------------- I/O ------------------------------------------------------ ' TRISC.4=1 ' input TASTER TRISC.5=0 ' output LED1 ANSELA = %000000 ' ADC off all ANSELB = %00000000 ' ANSELC = %00000000 ' ' '******************************************************************************* ''************************* DT_INTS-14 ***************************************** ' INCLUDE "DT_INTS-14_16F15345-A.bas" ' Base Interrupt System INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts ' ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR1_INT, _ToggleLED1, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM ' T1CON = $31 ; Prescaler = 8, TMR1ON @ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts ' '------------------------------------------------------------------------------- ;-- Place a copy of these variables in your Main program ------------------- ;-- The compiler will tell you which lines to un-comment -- ;-- Do Not un-comment these lines -- ;--------------------------------------------------------------------------- wsave VAR BYTE $20 SYSTEM ' location for W if in bank0 'wsave VAR BYTE $70 SYSTEM ' alternate save location for W ' ' if using $70, comment wsave1-3 ' ' --- IF any of these three lines cause an error ?? ------------------------ ' Comment them out to fix the problem ---- ' -- Which variables are needed, depends on the Chip you are using -- 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 '------------------------------------------------------------------------------- ' '*************************** PIN NAMES ***************************************** TASTER VAR portC.4 ' LED1 VAR portC.5 ' ' test program for PIC16F15345 with DT_INTS-14 ' when button pressed, display "LED-blinky" ' TMR1 interupts toggle LED1 start: GOSUB clearLCD LCDOUT $FE,$80," TEST 16F15345" LCDOUT $FE,$94," 20250825" LCDOUT $FE,$D4," push button" ' WHILE TASTER = 1 : WEND ' wait for pressed taster PAUSE 500 ' GOSUB clearLCD LCDOUT $FE,$80," LED-blinky" ' Main: PAUSE 1 GOTO Main ' '******************************************************************************* ' clearLCD: LCDOUT $FE,$01 RETURN ' '---------------------[TMR1 - interrupt handler]-------------------------------- ToggleLED1: TOGGLE LED1 @ INT_RETURN


Reply With Quote

Bookmarks