My last try. Loaded in another set. On the output from A 1 shows a led a steady on/off. So also at the entrance of B4. The led on A0 flashes very fast but there is no connection with the input.
Op zaterdag 24 september 2022 om 10:39:51 UTC+2 schreef hans: > Hi Rob, > I did already but no result. A led in the interrupt and one on the pinB4. > The last one shows the action but the led inside teh pragme not. > I have now made an procedure which i am calling on several places in my > program and it worked. > procedure DTMF_receive is > if portD_low != DTMF_old then > DTMF = portD_low > end if > end procedure > > Op zaterdag 24 september 2022 om 09:45:51 UTC+2 schreef [email protected] > : > >> Hi Hans, >> >> The code looks OK. Maybe as a test you can activate a LED in the >> interrupt routine to check if it gets there. >> >> What exactly the behaviour? >> >> Kind regards, >> >> Rob >> >> ------------------------------ >> *Van:* [email protected] <[email protected]> namens hans < >> [email protected]> >> *Verzonden:* zaterdag 24 september 2022 08:33 >> *Aan:* jallib <[email protected]> >> *Onderwerp:* Re: [jallib] Re: 18F4520 interrupt >> >> I have changed the program part as follows from the example port B0 , >> compiling is ok but no result >> >> -- alias the interrupt flags so they are readable. >> alias INT_0_ENABLE_BIT is INTCON_INT0IE >> alias INT_0_FLAG_BIT is INTCON_INT0IF >> alias INT_0_EDGE_BIT is INTCON2_INTEDG0 >> >> -- enable global interrupts >> INTCON_GIE = TRUE -- Enables all unmasked interrupts >> INTCON_PEIE = TRUE -- Enables all unmasked peripheral interrupts >> >> -- define your interrupt pin >> alias interrupt_pin is pin_B4 >> alias interrupt_pin_direction is pin_B4_direction >> interrupt_pin_direction = INPUT -- interrupt pin is input >> INT_0_ENABLE_BIT = TRUE -- interrupt pin enable bit for B0 >> procedure int_on_change_b0() -- procedure is written later >> >> -- main interrupt handler >> procedure interrupt() is >> pragma interrupt >> -- Check if interrupt pin 0 (B0) has an interrupt. >> if INT_0_FLAG_BIT then >> DTMF = portD_low >> INT_0_FLAG_BIT = FALSE -- reset interrupt flag >> end if >> end procedure >> >> a led on the interrupt pin B4 shows the short blink as soon as a dtmf >> tone is received. The received value remains on portD-low untill the next >> tone. So i can read it afterwards. My idea was to wait some time before >> reading the port. >> >> Op zaterdag 24 september 2022 om 08:08:47 UTC+2 schreef hans: >> >> Here is how i have started and having no reslut i did the (wrong??) >> chnages >> >> -- 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 >> DTMF = portD_low >> end procedure >> >> Op zaterdag 24 september 2022 om 08:07:18 UTC+2 schreef hans: >> >> Hello, >> I tried to use the example in the ample sequence 18F4620 Interrupt on >> change for the 18F4520. It does not work. What's going on? >> regards >> Hans >> >> Op zaterdag 24 september 2022 om 07:42:24 UTC+2 schreef >> [email protected]: >> >> Hi Vasile, he is using the interrupt on change library. It has "pragma >> interrupt" and needs the strange line "const byte int_on_change_pins[] = >> {"B",4}". >> >> I agree about the delay, but that depends on the use as you pointed out. >> It may be ok for the code that is there now, but another way would be to >> start a timer then when the timer is up use the timer interrupt to read >> portD_low. >> >> There is also sample 18f4620_interrupt_on_change_pin_b0.jal that shows >> the use of interrupt on change without using the library. >> >> Matt. >> >> On Saturday, September 24, 2022 at 1:21:09 AM UTC-4 vasile wrote: >> >> Hans, >> I do not see any "pragma interrupt", it's that OK? >> An interrupt procedure needs it no matter the name it has, without it >> there would be no jump to the ISR interrupt vector. >> >> This line looks strange to me here (but I'm not a master of programming): >> const byte int_on_change_pins[] = {"B",4} >> >> BTW, you do not want to use a software delay in an ISR routine, an ISR >> must be fast by definition because it consumes a period of time which is >> lost in the main loop. Exceptions for hardware resources of which >> programming time do not interfere too much with the main loop. Check if >> your pic has registers to detect which edge is used on interrupt on change. >> If yes you should program those too. >> >> I hope these would be helpful. In my opinion you should solve the problem >> by yourself, is the only way you can understand. >> >> >> On Sat, Sep 24, 2022 at 8:03 AM Matthew Schinkel <[email protected]> >> wrote: >> >> 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 >> >> <https://groups.google.com/d/msgid/jallib/df18aa34-b7fc-4d5d-bfe5-65e1a4b741d9n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- >> 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/f9987acb-6a37-40e6-8f36-d32046365d44n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jallib/f9987acb-6a37-40e6-8f36-d32046365d44n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/f98b07ff-f89e-4290-99b8-9a8e3b611c44n%40googlegroups.com.
18f4520_interrupt_test.asm
Description: Binary data
