lgt8fx icon indicating copy to clipboard operation
lgt8fx copied to clipboard

How to use PCINT4?

Open brother-yan opened this issue 2 years ago • 1 comments

Since mega328p doesn't have this interrupt vector. How to use this interrupt in lgt8f328p? Thanks!

brother-yan avatar Jul 24 '21 16:07 brother-yan

I never use pin change interrupts. I found few examples for you: https://thewanderingengineer.com/2014/08/11/arduino-pin-change-interrupts/ https://www.teachmemicro.com/arduino-interrupt-tutorial/ https://github.com/NicoHood/PinChangeInterrupt I think it is quite simple. You need only change the names of ports or interrupt vector names.

LaZsolt avatar Jul 25 '21 12:07 LaZsolt

@brother-yan what was your results with LaZsolt's suggestions?

dwillmore avatar Jan 12 '23 18:01 dwillmore

Since the @brother-yan hasn't loggen in the Github for two years, I close this issue.

LaZsolt avatar Jan 26 '23 14:01 LaZsolt

That's perfectly fine, I added them in #40

jayzakk avatar Jan 26 '23 16:01 jayzakk

@dwillmore I don't use LGT MCU since 2020. I have a solution: just add a *.S file in your sketch folder

添加文件:IVT_extended.S

#include <avr/io.h>

#ifdef __AVR_MEGA__
  #define XJMP jmp
  #define XCALL call
#else
  #define XJMP rjmp
  #define XCALL rcall
#endif

.section .vectors, "ax", @progbits
  .weak __vector_26
  ;.set __vector_26, __bad_interrupt
  XJMP  __vector_26
  .weak __vector_27
  ;.set __vector_27, __bad_interrupt
  XJMP  __vector_27
  .weak __vector_28
  ;.set __vector_28, __bad_interrupt
  XJMP  __vector_28
  .weak __vector_29
  ;.set __vector_29, __bad_interrupt
  XJMP  __vector_29

即可

brother-yan avatar Feb 13 '23 05:02 brother-yan

Thank you for the answer.-

LaZsolt avatar Feb 14 '23 15:02 LaZsolt