The closest match i have to that chip is 16f18875 and i can confirm it does not work
for ioc int with modified file. the chip works fine using that ioc ints with asm code
totally unsure why dt ints fails at this point
Code:'****************************************************************'* Name : Test_IOCAN.pbp * '* Author : * '* Date : * '* Device : 16F18875 * '* Version : 1.0, PBP 3.1.5.4 * '* Notes : Test interrupt code for pushbutton on A.2 pulled * '* : up 10k. * '**************************************************************** #CONFIG __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON __config _CONFIG2, _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON & _DEBUG_OFF __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_ON & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC __config _CONFIG4, _WRT_OFF & _SCANE_available & _LVP_OFF __config _CONFIG5, _CP_OFF & _CPD_OFF #ENDCONFIG ' -----[ Initialization 16F18875]--------------------------------------------------------------------------------------- DEFINE OSC 32 ' Adjust to suit design. IOCAF = 0 ' Clear the Int flag. INTCON = %11000000 ' Enable GIE, PEIE, falling edge. PIE0 = %00010001 ' Enable IOCIE, INTE bits. IOCAP = 0 ' Disable IOC rising edge A. IOCAN = %00000100 ' Enable IOC falling edge A2. ANSELA = %00000000 ' All Dig. ANSELC = %00000000 ' All Dig. TRISA = %000100 ' A.2 pulled up, pushbutton to ground. TRISC = %000000 ' C.5 serout to PC via 1k, C.4 led to ground via 1k. DEFINE DEBUG_REG PORTC DEFINE DEBUG_BIT 5 DEFINE DEBUG_BAUD 9600 DEFINE DEBUG_MODE 0 LATC.5 = 1 LED var PORTC.4 ' Led via 1k to ground. DEFINE INTHAND PB DEBUG "I'm Alive!",13 Switch var bYTE $7f SYSTEM switch = 0 Begin: LED = 1 ' On. if switch=1 then switch=0 DEBUG "Int!",13 endif pause 500 ' 2hz. LED = 0 ' Off. if switch=1 then switch=0 DEBUG "Int!",13 endif pause 500 ' 2hz. goto begin ' Cycle. ASM PB banksel IOCAF btfsc IOCAF,2 bsf Switch,0 ; set bit0 in Switch to 1 bcf IOCAF,2 RETFIE endasm end




Bookmarks