PDA

View Full Version : DT_INTS and 18F26k22



Mike2545
- 21st August 2017, 01:02
Hi all, I am using PIC 18F26K22 and INCLUDE "DT_INTS-18.bas"

I get error: Symbol not previously defined (INT_ENTRY_H)

Any clues?

Thanks

Mike

richard
- 21st August 2017, 01:22
Any clues?

any hints like :-


pbp ver = ?
dt_ints ver= ?
interrupt your trying to create = ?
code ?


or do we have to guess ?

Mike2545
- 21st August 2017, 01:37
Terribly Sorry Richard, though it might be a fuse setting :confused:

PBP ver = 2.60A
DT_INTS ver = 3.3

So far I have just a debug statement and a high/ low/ pause on PORTB.2
I added the Include and it threw the error

richard
- 21st August 2017, 01:45
if you don't create at least one valid interrupt no interrupt handler is created
hence
Symbol not previously defined (INT_ENTRY_H) error occurs

the dt_ints include has nothing to work with and just can't cope

Mike2545
- 21st August 2017, 01:53
Thank you for cluing me in :D

Mike2545
- 7th September 2017, 02:06
I have had some issues with the different versions of PBP so I upgraded to Vs PBPX 3.1.0.4

This program compiles just fine but it does not enter the interrupt on RX

INCLUDE "modedefs.bas"
include "ALLDIGITAL.pbp"
INCLUDE "C:\PBP\DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "C:\PBP\ReEnterPBP-18.bas" ; Include if using PBP interrupts

Define PULSIN_MAX 1000
DEFINE HSER_RCSTA 90h 'Hser receive status init
DEFINE HSER_TXSTA 24h 'Hser transmit status init
DEFINE HSER_BAUD 9600 'Hser baud rate
DEFINE HSER_SPBRG 25
DEFINE HSER_CLROERR 1
DEFINE OSC 4
OSCCON =$D2 'clock speed
mem1 var byte

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX1_INT, _read_serial, PBP, yes


endm
INT_CREATE ; Creates the interrupt processor
ENDASM

@ INT_ENABLE RX1_INT ; enable external (RX) interrupts


MAIN:

SEROUT2 PORTB.0 ,16468,["here",cr,cr]

pause 500
GOTO MAIN

read_serial:
hserin 250 , NoRS232,[mem1,mem1]

serout2 PORTB.0,16468,["got it",cr]
Pause 1000

@ INT_RETURN

NoRS232:

serout2 PORTB.0,16468,["No rs232",cr]

@ INT_RETURN

The exact same code runs in the 18F1320 except the OSCCON is $60 for the 18F1320 and $D2 for the 18F26K22.

Does anyone know where I might be needing to look?


Mike

mpgmike
- 7th September 2017, 12:51
A few things I learned about the DT_INT routines is:

1 - You must have a copy of the DT_INT and ReEnterPBP code in the file where you save your current program. PBP3 will not search the computer and create a path. Thus, I have multiple copies of the code on my computer.

2 - It is helpful to open the DT_INT in PBP3 and look at how the "RX1_INT" is structured in the code, and where it is looking for PIE, PIR, etc. The K22 family is relatively new, and as you stated, OSCCON SFR is structured differently than for older chips. You may have to alter the DT_INT itself, or alter the way you INT_LIST your IntSource.

3 - At the top of the DT_INT (I believe for the PIC12F/16F) there are multiple wsave options that you have to comment out or uncomment, depending. I don't remember the -18 requiring that, but I may be wrong. On the lower chips, you must include one of the wsave options in your variable declarations of your main code (wsave VAR BYTE $20 SYSTEM for example).

I'd wager a guess the issue you're having is #1, your interrupt routines are not in the folder you're saving your current program.

Dave
- 7th September 2017, 13:50
mpgmike, I have been using DT_INTS-18 for quite a while with 18F26K22 parts as soon as Microchip released them. It's been a few years now. I have never had to change anything to do with Darrels code. What are you talking about?

MichelJasmin
- 7th September 2017, 17:27
1 - You must have a copy of the DT_INT and ReEnterPBP code in the file where you save your current program. PBP3 will not search the computer and create a path. Thus, I have multiple copies of the code on my computer.



FYI: You can specify a relative path. I have a separate folder for all my includes. It is located in the same root folder of all my projects:




C:\
---Somewhere
---MyPBPProjects
---MyIncludes
---Project1
---Project2
---Project3



Here my include folder is named _Include



INCLUDE "..\_Include\DT_INTS-18\DT_INTS-18.bas" ' Base Interrupt System
INCLUDE "..\_Include\DT_INTS-18\ReEnterPBP-18.bas" ' Include if using PBP interrupts

...

INCLUDE "..\_Include\DT_INTS-14_V110\DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "..\_Include\DT_INTS-14_V110\ReEnterPBP.bas" ' Include if using PBP interrupts

...

INCLUDE "..\_Include\ESP8266_Base.pbp"
INCLUDE "..\_Include\NMEA_base.pbp"
'etc

Dave
- 7th September 2017, 18:28
Michel, That is exactly the way I have been doing mine for years....

Mike2545
- 7th September 2017, 21:24
Dave, are you using DT_INTS for RX1/RX2 interrupts? If so, how?


Mike

Dave
- 8th September 2017, 14:41
Mike, Here are some snipits from a program I wrote about 4 years ago:

TX485 VAR PORTB.6 '0-OUTPUT COMMUNICATIONS PORT PIN RS-485
RX485 VAR PORTB.7 '1-INPUT COMMUNICATIONS PORT PIN RS-485

TX232 VAR PORTC.6 '0-OUTPUT COMMUNICATIONS PORT PIN RS-232
RX232 VAR PORTC.7 '1-INPUT COMMUNICATIONS PORT PIN RS-232

BAUD1 CON 416 'TX/RX BAUD RATE (64000000/4/38400) - 1 (HIGH BAUD/16 BIT)
BAUD2 CON 416 'TX/RX BAUD RATE (64000000/4/38400) - 1 (HIGH BAUD/16 BIT)

BAUDCON1 = %00001000 'SET FOR 16 BIT BAUDRATE
SCRATCH = BAUD1
SPBRG1 = SCRATCH.LOWBYTE 'SET LOW BYTE OF BAUD GENERATOR
SPBRGH1 = SCRATCH.HIGHBYTE 'SET HIGH BYTE OF BAUD GENERATOR
RCSTA1 = %10010000 'ENABLE RECEIVER,CONTINUOUS
TXSTA1 = %00100100 'ENABLE TRANSMIT,HIGH BAUD

BAUDCON2 = %00001000 'SET FOR 16 BIT BAUDRATE
SCRATCH = BAUD2
SPBRG2 = SCRATCH.LOWBYTE 'SET LOW BYTE OF BAUD GENERATOR
SPBRGH2 = SCRATCH.HIGHBYTE 'SET HIGH BYTE OF BAUD GENERATOR
RCSTA2 = %10010000 'ENABLE RECEIVER,CONTINUOUS
TXSTA2 = %00100100 'ENABLE TRANSMIT,HIGH BAUD

'************************************************* ********************
asm
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TX1_INT, _UARTTX1, PBP, no
INT_Handler RX1_INT, _UARTRX1, PBP, no
INT_Handler TX2_INT, _UARTTX2, PBP, no
INT_Handler RX2_INT, _UARTRX2, PBP, no
endm
INT_CREATE ; Creates the High Priority interrupt processor
ENDASM

@ INT_ENABLE RX1_INT ; Enable RX UART Interrupts
@ INT_ENABLE RX2_INT ; Enable RX UART Interrupts

GOTO MAINLOOP 'JUMP OVER INTERRUPTS

'************************************************* ********************
UARTRX1: 'INTERRUPT SERVICE ROUTINE FOR UART RECEIVER
'************************************************* ********************
@ INT_RETURN

'************************************************* ********************
UARTTX1: 'INTERRUPT SERVICE ROUTINE FOR UART TRANSMITTER
'************************************************* ********************
@ INT_RETURN

'************************************************* ********************
UARTRX2: 'INTERRUPT SERVICE ROUTINE FOR UART RECEIVER
'************************************************* ********************
@ INT_RETURN

'************************************************* ********************
UARTTX2: 'INTERRUPT SERVICE ROUTINE FOR UART TRANSMITTER
'************************************************* ********************
@ INT_RETURN

' ************************************************** ******************

Mike2545
- 9th September 2017, 15:12
Thanks Dave, no matter what I try on the 18F26K22 it will not jump to the interrupt. I'm ordering some different chips with 2 UARTS to give them a try.


Mike

richard
- 9th September 2017, 15:24
this works for me


#CONFIG
CONFIG FOSC = INTIO67
CONFIG PLLCFG = OFF
CONFIG PRICLKEN = OFF
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRTEN = OFF
CONFIG BOREN = SBORDIS
CONFIG BORV = 190
CONFIG WDTEN = ON
CONFIG WDTPS = 32768
CONFIG CCP2MX = PORTC1
CONFIG PBADEN = OFF
CONFIG CCP3MX = PORTB5
CONFIG HFOFST = ON
CONFIG T3CMX = PORTC0
CONFIG P2BMX = PORTB5
CONFIG MCLRE = EXTMCLR
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


;INCLUDE "modedefs.bas"
;INCLUDE"ALLDIGITAL.pbp"
;INCLUDE "HomeAutomationVars.bas" 'Open with PBP editor
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts

define OSC 8


DEFINE DEBUG_REG PORTB
DEFINE DEBUG_BIT 7
DEFINE DEBUG_BAUD 9600
' Set Debug mode: 0 = true, 1 = inverted
DEFINE DEBUG_MODE 0
x var word
rxflag var bit
rxchar var byte
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX1_INT , _read_serial, PBP, no
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
OSCCON = $60 ; OSC 8
anselc = 0
RCSTA = $90 ' Enable serial port & continuous receive
TXSTA = $20 ' Enable transmit, BRGH = 0
SPBRG = 51 ' 9600 Baud @ 8MHz, 0.16%
SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
baudcon1= baudcon1&%11001111 ;invert tx/rx polarity for usb-tty adapter
TRISB.7 = 0 ;DEBUG
LATB.7 = 1 ;DEBUG


@ INT_ENABLE RX1_INT ; enable external (RX) interrupts
debug "running",13,10
Main:
debug "."
for x = 1 to 1000
if rxflag then
Debug 13,10,"got !! asc chr ",#rxchar,13,10
rxflag=0
endif
pauseus 1000
next x

Goto main


read_serial:
rxflag = 1
rxchar = rc1reg
@ INT_RETURN



this is much better , get rid of all those nasty pauses and goto's



;pic18f26k22 rx1 int demo
#CONFIG
CONFIG FOSC = INTIO67
CONFIG PLLCFG = OFF
CONFIG PRICLKEN = OFF
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRTEN = OFF
CONFIG BOREN = SBORDIS
CONFIG BORV = 190
CONFIG WDTEN = ON
CONFIG WDTPS = 32768
CONFIG CCP2MX = PORTC1
CONFIG PBADEN = OFF
CONFIG CCP3MX = PORTB5
CONFIG HFOFST = ON
CONFIG T3CMX = PORTC0
CONFIG P2BMX = PORTB5
CONFIG MCLRE = EXTMCLR
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


INCLUDE "DT_INTS-18.bas" ;

define OSC 8
DEFINE DEBUG_REG PORTB
DEFINE DEBUG_BIT 7
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_MODE 0
x var byte bank0
flag var byte bank0
rxflag var flag.7
dotflag var flag.0
rxchar var byte
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX1_INT , _read_serial,asm,no
INT_Handler TMR1_INT , _TOCK,asm,no
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
clear
OSCCON = $60 ; OSC 8
anselc = 0
RCSTA = $90 ' Enable serial port & continuous receive
TXSTA = $20 ' Enable transmit, BRGH = 0
SPBRG = 51 ' 9600 Baud @ 8MHz, 0.16%
SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
T1CON=1 ;32mS tick
TRISB.7 = 0 ;DEBUG
LATB.7 = 1 ;DEBUG
baudcon1= baudcon1&%11001111 ;invert tx/rx polarity for usb-tty adapter
pause 2000 ;give me time to setup debug
@ INT_ENABLE RX1_INT ; enable external (RX) interrupts
debug 13,10 ,"listening "
@ INT_ENABLE TMR1_INT
x=31
while 1
if rxflag then
;Debug 13,10,"got asc chr ",#rxchar,13,10
tx1reg = rxchar ;echo back
rxflag = 0
endif
if dotflag then
debug "."
dotflag=0
endif
wend
end
read_serial:
ASM
bsf _flag ,7
MOVE?BB RC1REG,_rxchar
INT_RETURN
ENDASM
TOCK:
asm
DECFSZ _x,F
BRA BREXIT
movlw 31
bsf _flag ,0
movwf _x
BREXIT
BCF PIR1 ,0
INT_RETURN
ENDASM

Mike2545
- 9th September 2017, 16:08
Bingo!

Thanks Richard, this line
anselc = 0 '0 = Digital input buffer enableddid it!


Mike