PDA

View Full Version : PBP and DT_INTs problems



comwarrior
- 11th December 2012, 18:33
I'm not sure how many issues i actually have here but i'll list the symptoms...

1) MCS compiles PBP files and then says cancelled once it's complete (i turned silent off so i KNOW it completed without error). Date time stamp on the hex file etc are updated. However, the new hex file does not contain the changes. tried deleting everything except the pbp file and it still contains the old code.

2) DT_INTs does not jump to interrupt subroutine on 16F1824 when ether external int or IOC pin is toggled.



'************************************************* ***************
'* Name : test.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 01/08/2011 *
'* Version : 1.0 *
'* Notes : 16F1824 *
'* : *
'************************************************* ***************
@ __config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
@ __config _CONFIG2, _WRT_OFF & _PLLEN_ON & _STVREN_ON & _BORV_25 & _LVP_OFF

Define OSC 32 ' Set clock speed

OSCCON.7 = 1
OSCCON.6 = 1
OSCCON.5 = 1
OSCCON.4 = 1
OSCCON.3 = 0
OSCCON.1 = 0
OSCCON.0 = 0

INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts

TRISA = %11011111
TRISC = 0
PORTC = 0

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _UPDATE, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

OPTION_REG.6 = 1

@ INT_ENABLE INT_INT



Thanks

Darrel Taylor
- 11th December 2012, 20:20
2) DT_INTs does not jump to interrupt subroutine on 16F1824 when ether external int or IOC pin is toggled.

And neither would any ON INTERRUPTs, ASM interrupts or simple IF PORTA.2 = 1 tests, since you haven't enabled Digital inputs on your Analog pins.

longpole001
- 14th December 2012, 11:45
old config with comments for the same size PIC as 16F1824 ( well close ) this is for 16F1825 , as a ref hope it may be useful

cheers


' config for 16F1825

#CONFIG
;----- CONFIG1 Options --------------------------------------------------
__config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_ON

;----- CONFIG2 Options --------------------------------------------------
__config _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_HI & _LVP_OFF
#ENDCONFIG

' ---------- Set up DT_INTS-14 Routine for Instant Interupt handling -----------

INCLUDE "DT_INTS-14.bas"

INCLUDE "ReEnterPBP.bas"
ASM
INT_LIST macro ; IntSource , Label , Type, ResetFlag?

INT_Handler TMR0_INT,_Timer0_Count, PBP, yes ; call Timer0_Count subroutine
INT_Handler IOC_INT,_GetIRcode , PBP, yes ; call GetIRcode subroutine on Interupt

endm
INT_CREATE ; Creates the Interrupt Processor
ENDASM

#HEADER
ERRORLEVEL -306 ; Suppress page boundry warning for DT_INTS-14 macro during a compile
#ENDHEADER

'----------- 16F1825 - PIC chip settings --------------------

OSCCON = $70 ' Select 8Mhz , internal clock
' Bit 7 0 = 4xPLL disabled 1= 4xPLL enables ( overrided by conf word 2 setting - PLLEN)
' bits6-3 - 1111 = 16Mhz , 1110 = 8MHz or 32Mhz ( depends on 4xPLL - conf word 2) 1101 = 4 MHz, 1100 = 2MHz 1011 = 1MHz
' bitS 0-1 - 00= Clock set by Conf word ,01 = Timer1 OSC , 1x = internal Osc Block

APFCON0 = %00000000 'All Default - No change when using SPI use SDO1 = RC2 , bit6=0
APFCON1 = %00000000 'All Default APFCON1 = %00000000



CM1CON0 = $00 ' Disable / Clear comparator 1
CM1CON1 = $00 ' Used with CM1CON0
CM2CON0 = $00 ' Disable / Clear comparator 2
CM2CON1 = $00 ' Used with CM2CON0
CMOUT = $00 ' Disable Comparitors output register - used only if comparitor on

ANSELA = %00000000 ' Set Port A - Digital I/O , 0 = Digital 1 = Analog
ANSELC = %00000000 ' Set Port C - Digital I/O , 0 = Digital 1 = Analog

INLVLA = %00000000 ' Set Port A to TTL Levels 0 = TTL , 1 = SCHMITT TRIGGER - Used port reads and Interupt on Change
INLVLC = %00000000 ' Set Port C to TTL Levels 0 = TTL , 1 = SCHMITT TRIGGER - Used port reads and Interupt on Change
SRCON0 = %00000000 ' Disable Latched Outputs
SRCON1 = %00000000 ' Used with SRCON0 register

ADCON0 = $00 ' Disable A/D
ADCON1 = $00 ' Disable A/D - used with ADCON0 settings

WPUA = %00001100 ' Port A - Turn off week Pullups 1=ON , for each port ( globle enable set in option_reg.7)set wpu on PortA.3 as input only - ref spec
WPUC = %00000000 ' Port C - Turn off week Pullups 1=ON For each port

DACCON0 = $00 ' Disable D/A
DACCON1 = $00 ' Disable D/A - used with DACCON0
FVRCON = $00 ' Disable Fixed Voltage Ref


IOCAN.4 = 1 ' Enable interupt on change on portA.4 for negative going edge ( for getIR routine )
IOCAF.4 = 0 ' Clear Interupt on Change flag on portA.4

OPTION_REG.7 = 1 ' Weak Pullups disabled 1 = globel disable 0 = globel enable ( set by each port - WPUA & WPUC settings)
OPTION_REG.6 = 0 ' Interupt on Falling Edge of INT pin 0= falling edge 1= rising edge
OPTION_REG.5 = 0 ' TMR0 clock source - 1=T0clk pin 0=internal clock
OPTION_REG.4 = 0 ' TMR0 0=L/H of TOCKI pin 1=H/L of TOCKI pin
OPTION_REG.3 = 0 ' Use Prescaller for TMR0 0= Yes , 1 = No
OPTION_REG.2 = 1 ' Timer0 prescaler Rate Select bits 2-0(set to 1:256)
OPTION_REG.1 = 1 ' 000 = 1:2 , 001= 1:4 , 010 = 1:8 , 011 = 1:16
OPTION_REG.0 = 1 ' 100 = 1:32 , 101 = 1:64, 110 = 1:128 , 111 = 1:256

T1CON = %01110100 ' Timer 1 ,bit7-6 = TMR1 CLK source 00 = Instuction Clk(Fosc/4),01 =sys clk,10=ext clk,11=cap sense osc
' bit5-4 = TMR1 prescale 11= 1:8 ,bit3=0 LP off,bit2=1 no sync ext CLK ,bit1= 0 n/a,Bit0=0 Timer 1 on/off
T1GCON = %00000000 ' Timer 1 Gate Control bit7 0= counts regardless of gate 1 = gates in use , bit6 gate active when 1= High ,0=low
' bit5 0= toggle mode diabled 1= enabled bit4 single pulse mode 1- en 0= dis, bit 2 -status bit,1-0 - gate source sel

T2CON = %01110011 ' Timer 2 off + 1:15 postscale ,1:64 prescale ( bit 7 = x, bit6-3 1110 = 1:15 postscale, bit2=0 timer off ,bit1-0 = prescale 10 = 16 , 11= prescale 64
T4CON = %00000000 ' POSTSCALER 1/1,STOP,PRESCALER 1/1
T6CON = %00000000 ' POSTSCALER 1/1,STOP,PRESCALER 1/1

TMR0 = 0 ' Clear TMR0 MODULE REGISTER

TMR1H = 0 'CLEAR TMR1H MODULE REGISTER
TMR1L = 0 'CLEAR TMR1L MODULE REGISTER

TMR2 = 0 'CLEAR TMR2 MODULE REGISTER
TMR4 = 0 'CLEAR TMR4 MODULE REGISTER
TMR6 = 0 'CLEAR TMR6 MODULE REGISTER

'PR2 = 255 ' Timer 2 Preload value
'PR4 = 255 ' Timer 4 Preload value
'PR6 = 255 ' Timer 6 Preload value