Hi guys,
i'm a bit lost with a very small and simple program which does not compile when using DT interrupt library on the 18F2580.
I was hopping someone more inteligent could help figure out how i can modify the library so it can be compatible with this MCU.
This is the entire program:
ThanksCode:'**************************************************************** '* Name : IC_3_COMTEST.PBP * '* Author : Rui Cabral * '* Notice : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 19/12/2024 * '* Version : 1.0 * '* Notes : 18F2580 - MAINBOARD V2.2 * '* : * '**************************************************************** ' ' ' ' ;----[18F2580 Hardware Configuration]------------------------------------------- #IF __PROCESSOR__ = "18F2580" #DEFINE MCU_FOUND 1 #CONFIG CONFIG OSC = IRCIO67 ; Internal oscillator block, port function on RA6 and RA7 CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor disabled CONFIG IESO = OFF ; Oscillator Switchover mode disabled CONFIG PWRT = OFF ; PWRT disabled CONFIG BOREN = OFF ; Brown-out Reset disabled in hardware and software CONFIG BORV = 3 ; VBOR set to 2.1V CONFIG WDT = OFF ; WDT disabled (control is placed on the SWDTEN bit) CONFIG WDTPS = 512 ; 1:512 CONFIG PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset CONFIG LPT1OSC = OFF ; Timer1 configured for higher power operation CONFIG MCLRE = OFF ; RE3 input pin enabled; MCLR disabled CONFIG STVREN = ON ; Stack full/underflow will cause Reset CONFIG LVP = OFF ; Single-Supply ICSP disabled CONFIG BBSIZ = 1024 ; 1K words (2K bytes) boot block CONFIG XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode) CONFIG DEBUG = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins CONFIG CP0 = OFF ; Block 0 (000800-001FFFh) not code-protected CONFIG CP1 = OFF ; Block 1 (002000-003FFFh) not code-protected CONFIG CP2 = OFF ; Block 2 (004000-005FFFh) not code-protected CONFIG CP3 = OFF ; Block 3 (006000-007FFFh) not code-protected CONFIG CPB = OFF ; Boot block (000000-0007FFh) not code-protected CONFIG CPD = OFF ; Data EEPROM not code-protected CONFIG WRT0 = OFF ; Block 0 (000800-001FFFh) not write-protected CONFIG WRT1 = OFF ; Block 1 (002000-003FFFh) not write-protected CONFIG WRT2 = OFF ; Block 2 (004000-005FFFh) not write-protected CONFIG WRT3 = OFF ; Block 3 (006000-007FFFh) not write-protected CONFIG WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected CONFIG WRTB = OFF ; Boot block (000000-0007FFh) not write-protected CONFIG WRTD = OFF ; Data EEPROM not write-protected CONFIG EBTR0 = OFF ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks CONFIG EBTR1 = OFF ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks CONFIG EBTR2 = OFF ; Block 2 (004000-005FFFh) not protected from table reads executed in other blocks CONFIG EBTR3 = OFF ; Block 3 (006000-007FFFh) not protected from table reads executed in other blocks CONFIG EBTRB = OFF ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks #ENDCONFIG #ENDIF ;----[Verify Configs have been specified for Selected Processor]---------------- ; Note: Only include this routine once, after all #CONFIG blocks #IFNDEF MCU_FOUND #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]" #ENDIF '***************************************************************************** 'OSCCON =%01110000 '8MHz INTOSC 'OSCTUNE=%11000000 'PLLEN enabled 'OSCTUNE=%10000000 'PLLEN DISABLED OSCCON =%01110010 '8MHz INTOSC <-------------------TEST THIS MODE (Internal Osc Block) OSCTUNE=%01000000 'PLLEN DISABLED <-------------------TEST THIS MODE (31KHZ DEVICE CLOCK) 'DEFINE OSC 8 DEFINE OSC 32 '***************************************************************************** '#DEFINE IOC_INT PIR0,IOCIF, PIE0,IOCIE 'https://www.picbasic.co.uk/forum/showthread.php/26778-IOC-on-pin-going-HIGH-and-LOW?p=156080#post156080 'https://www.picbasic.co.uk/forum/showthread.php/26776-SOLVED-Can-t-get-IOC-on-pin-change-working 'https://www.picbasic.co.uk/forum/showthread.php/26783-Can-t-get-IOC-on-pin-change-working 'https://support.melabs.com/forum/picbasic-pro-compiler-3-0-and-later/asm-assembly-language-in-picbasic-pro/7003-customizing-the-dt_ints-xx-bas-instant-interrupt '***************************************************************************** INCLUDE "ALLDIGITAL.pbp" DEFINE SHOWDIGITAL 1 '***************************************************************************** INCLUDE "DT_INTS-18.bas" 'INCLUDE "DT_INTS-14.bas" 'INCLUDE "ReEnterPBP.bas" INCLUDE "ReEnterPBP-18.bas" 'INCLUDE "ReEnterPBP-18LP.bas" DEFINE HSER_BAUD 9600 DEFINE HSER_RCSTA 90h ' SPEN + CREN DEFINE HSER_TXSTA 24h ' TXEN + BRGH DEFINE HSER_CLROERR 1 RXBYTE VAR BYTE RXFLAG VAR BIT RX1 VAR BYTE RX2 VAR BYTE ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler USART_RX_INT, _RxISR, PBP, yes ENDM INT_CREATE ENDASM PIE1.5 = 1 ' RCIE INTCON = %11000000 ' GIE + PEIE '***************************************************************************** PORTA=%00000000 PORTB=%00000000 PORTC=%00000000 TRISA=%00000000 TRISB=%00000000 TRISC=%10000000 'RC7 - RX pin as input '***************************************************************************** 'PORTS & PINS IC_RX var PORTC.7 'IC3 INPUT LED1 VAR PORTC.3 LED2 VAR PORTC.4 'Communication between MCUs (COMM)--------------------- 'PORTB.5 (IC2,3,4,5,6) COMM 'PORTA.1 (IC1) COMM CT VAR BYTE CT2 VAR BYTE INTFLAG VAR BYTE MOODCHANGE VAR WORD '***************************************************************************** 'wsave var byte $20 system ;location for W if in bank0 'wsave var byte $70 system ;location for W if in bank0 '..... If any of these next 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 bank0 wsave2 var byte $120 system ;location for W if in bank0 wsave3 var byte $1A0 system ;location for W if in bank0 '***************************************************************************** INIT: clear pause 100 goto main '***************************************************************************** main: toggle LED1 pause 1000 goto main '***************************************************************************** RxISR: 'xa$23.IC102 ' HSERIN [WAIT("IC1"), RXBYTE] ' Espera até encontrar "IC1" HSERIN [WAIT("IC1"), RX1, RX2] ' RX1 = "0" ' RX2 = "2" if RX1="0" and RX2="2" then high led2 else low led2 endif 'HSERIN [WAIT(":"), RX1, RX2, RX3] 'HSERIN [WAIT($02), RXBYTE] 'HSERIN [WAIT("A"), RXBYTE] RXFLAG = 1 @ INT_RETURN '*****************************************************************************


Reply With Quote

Bookmarks