Using Pin change interrupt instead of INT0
- 
				NewbeeV-USB
- Posts: 4
- Joined: Sun Aug 13, 2017 5:28 am
Using Pin change interrupt instead of INT0
Can I use pin change interrupt available in ATmega328p to connect to vusb instead of INT0 to connect to D+.
			
			
									
									
						Re: Using Pin change interrupt instead of INT0
Yes, you can do so. I did it for an ATtiny85, have a look at my project here in the forum.
You have to define it in the file usbconfig.h
Ciao, Martin
			
			
									
									
						You have to define it in the file usbconfig.h
Code: Select all
...
/* ----------------------- Optional MCU Description ------------------------ */
/* The following configurations have working defaults in usbdrv.h. You
 * usually don't need to set them explicitly. Only if you want to run
 * the driver on a device which is not yet supported or with a compiler
 * which is not fully supported (such as IAR C) or if you use a differnt
 * interrupt than INT0, you may have to define some of these.
 */
#define USB_INTR_CFG            PCMSK
#define USB_INTR_CFG_SET        (1 << USB_CFG_DPLUS_BIT)
#define USB_INTR_CFG_CLR        0
#define USB_INTR_ENABLE         GIMSK
#define USB_INTR_ENABLE_BIT     PCIE
#define USB_INTR_PENDING        GIFR
#define USB_INTR_PENDING_BIT    PCIF
#define USB_INTR_VECTOR         PCINT0_vect
Ciao, Martin
Re: Using Pin change interrupt instead of INT0
I find this rather interesting, could anyone explain the advantages/disadvantages or reason for wanting to do so?  I'm thinking it would allow the device to sync to the usb poll better but not sure I follow the intention.
			
			
									
									
						

