Hello again,
Thanks to DT's advice I was able to get my elapsed timer test program working well. I modified the original Elasped_INT routine in order to keep track of time in seconds and tenths of seconds to suit my purpose. My test circuit using this program worked perfectly, with good accuracy when checked against a stopwatch.
However, when adding another interrupt source there was no response from the breadboard circuit. The new source was RAC_INT, interrupt on portA change. The circuit has switches on several portA pins. Input changes on the pins was verified, but the test progarm did not respond as expected.
427 wordsCode:'device is PIC 16F684 'set registers OPTION_REG.7 = 0 'enable porta pullups CMCON0 = 7 'comparators off ANSEL = 0 'porta pins all digital TRISA = %111111 'set porta pins as input TRISC = %001101 'set portc pins 0,2,3 as input, all others output OSCCON = %1110000 'set internal osc. at 8 mhz, wait for stable freq. OSCTUNE = 0 'internal osc. running at factory calibration DEFINE OSC 8 '8 Mhz oscillator while OSCCON.2 = 0 'wait for osc.to be stable wend 'declare variables led var portc.3 'led output on portc.3 DTtime var word sum var word start: low led 'flash red LED for 0.5 sec pause 500 input led pause 2000 'pause 2 seconds INCLUDE "DT_INTS-14 for F684.bas" 'Base interrupt with wsave selected for 16F684 INCLUDE "ReEnterPBP.bas" 'Using PBP interrupts INCLUDE "Elapsed_INT_RI.bas" 'Elasped timer counting seconds and tenths seconds ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR1_INT, _ClockCount, PBP, yes INT_Handler RAC_INT, _RDT, PBP, yes endm INT_CREATE ; Creates the interrupt processor INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts INT_ENABLE RAC_INT ; Enable PortA Change Interrupt ENDASM DTtime = 1800 ' 180.0 second test Gosub ResetTime ' Reset Time to 0d-00:00:00.00 Gosub StartTimer ' Start the Elapsed Timer Main: low Led 'turn on led sum = 10*Seconds + Tenths if sum => DTtime then high led 'turn off led goto halt endif GOTO Main '-------Interrupt Handler for RDT------------ RDT: low led 'turn led on pause 2000 'pause 2 seconds @ INT_RETURN '--------------------------------------------- halt: end




Bookmarks