The basic file:

  include 18f4520                     -- target PICmicro
--
-- This program uses the internal oscillator at 4 MHz.
pragma target clock    4_000_000       -- oscillator frequency
--
pragma target OSC      INTOSC_NOCLKOUT           -- internal oscillator
pragma target WDT      CONTROL                   -- watchdog
pragma target XINST    DISABLED                  -- do not use extended 
instructionset
pragma target DEBUG    DISABLED                  -- no debugging
pragma target BROWNOUT DISABLED                  -- no brownout reset
pragma target FCMEN    DISABLED                  -- no clock monitoring
pragma target IESO     DISABLED                  -- no int/ext osc switching
pragma target LVP      DISABLED                   -- low voltage programming
pragma target MCLR     EXTERNAL                  -- external reset
--
-- The configuration bit settings above are only a selection, sufficient
-- for this program. Other programs may need more or different settings.
--
WDTCON_SWDTEN = OFF                 -- disable WDT
OSCCON_SCS = 0                      -- select primary oscillator
OSCCON_IRCF = 0b110                 -- 4 MHz
OSCTUNE_PLLEN = FALSE               -- no PLL
--
enable_digital_io()                 -- make all pins digital I/O
--

-- DTMF programma
pin_D0_direction       = input
pin_D1_direction       = input
pin_D2_direction       = input
pin_D3_direction       = input
pin_B4_direction       = input -- for interrupt


var byte DTMF

-- choose pins to use for int on change
const byte int_on_change_pins[] = {"B",4}
include interrupt_on_change
int_on_change_init()

-- interrupt for pin B4
procedure int_on_change_callback_0() is
   pragma inline
   pin_C3 = low
   delay_1mS(400)
   DTMF = portD_low
   pin_C3 = high
end procedure


Op vrijdag 23 september 2022 om 14:59:53 UTC+2 schreef hans:

> Hello,
> I am trying to read a DTMF module with an interrupt on a 18F4520.pin B4. I 
> found something in the examples. Is thissufficient and  correct? Direct 
> reading of portD_low is working correct. 
>
> -- choose pins to use for int on change
> const byte int_on_change_pins[] = {"B",4}
> include interrupt_on_change
> int_on_change_init()
>
> -- interrupt for pin B4
> procedure int_on_change_callback_0() is
>    pragma inline
>    delay_1mS(400)
>    DTMF = portD_low
> end procedure
> regards
> Hans
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/38993319-e5c4-44bd-af44-c205184131aen%40googlegroups.com.

Reply via email to