PDA

View Full Version : DT Ints work around for IOCA Register?



kevlar129bp
- 5th January 2010, 22:49
Hello all,

Thought I would start a new thread real quick, rather than this question getting buried in my Digitizing Arm post. I'm scribbling some code for the PIC16F688, and would love to use the DT Ints library. Will the library work on the IOCA Reg, or am I stuck with PBP interrupts? Can I change a few lines in DT_INTS-14.bas and make it work? Any help would be great.

Thanks guys,
Chris

Bruce
- 6th January 2010, 01:03
Don't have a 16F688 to test, but this works in MPSIM --


@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF

DEFINE OSC 4

OSCCON = %01100000 ' 4MHz internal
ANSEL = 0 ' Set portA outputs to Digital / No ADC
CMCON0 = 7 ' comparators disabled
PORTA = 0
TRISA = %00000001 ' RA0 input
OPTION_REG.7 = 0 ' pull-up global enable
WPUA = %00000001 ' pull-up enabled on RA0

include "DT_INTS-14.bas"
include "ReEnterPBP.bas"

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RAC_INT, _MyInt, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor

INT_ENABLE RAC_INT ; Enable RA change interrupt
ENDASM

WHILE !PORTA.0 ' read for wake up om change
WEND
IOCA.0=1 ' RA0 int-on-change enabled

Main:
TOGGLE PORTA.2
PAUSE 500
GOTO Main

MyInt:
WHILE !PORTA.0
WEND ' wait for button release
TOGGLE PORTA.1
@ INT_RETURN
Just added these to DT_INTS-14 --


#define RAC_INT INTCON,RAIF ;-- RA Port Change Interrupt

ifdef RAIF ;----{ RA Port Change Interrupt }--------------[INTCON, RAIF]---
INT_Source INTCON, RAIF, INTCON, RAIE
endif

kevlar129bp
- 6th January 2010, 01:20
Thanks a ton Bruce. I'll give that a run. I just didn't want to really screw somethin' up! :D

Thanks again,
Chris