Hi Hans, without me testing or knowing the DTMF module your using. I think
it looks ok. It should be easy to test.
Just to make your code easier to read I would alias the pins and directions
to useful names. You read code 10 times more than you write it. I don't
know what pin_C3 is for, and pin_C3_direction isn't being set.
Looks like your code will wait for an interrupt on pin_B4 then read the
lower 4 bits of portd
If the original sample works for you, you can add a sample for 18F4520. The
library may need to be modified to support more chips.
Matt.
On Friday, September 23, 2022 at 12:44:59 PM UTC-4 hans wrote:
> 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/df18aa34-b7fc-4d5d-bfe5-65e1a4b741d9n%40googlegroups.com.