# How to set interrupt for a particular GPIO pin?

**URL:** https://forums.sifive.com/t/how-to-set-interrupt-for-a-particular-gpio-pin/1636
**Category:** HiFive1 Rev B
**Created:** [September 26, 2018, 4:42am UTC](https://forums.sifive.com/t/how-to-set-interrupt-for-a-particular-gpio-pin/1636 "2018-09-26T04:42:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 26, 2018, 4:42am UTC](https://forums.sifive.com/t/how-to-set-interrupt-for-a-particular-gpio-pin/1636/1 "2018-09-26T04:42:54Z")

</div>

What could be the equivalent code for the below code snippet

// Set up RX interrupts, but only if we have a valid RX baud rate  
if (\_rx\_delay\_stopbit)  
{  
if (digitalPinToPCICR(\_receivePin))  
{  
\*digitalPinToPCICR(\_receivePin) |= \_BV(digitalPinToPCICRbit(\_receivePin));  
\*digitalPinToPCMSK(\_receivePin) |= \_BV(digitalPinToPCMSKbit(\_receivePin));  
}  
tunedDelay(\_tx\_delay); // if we were low this establishes the end  
}

What should i do for interrupt? where can i get some ideas about interrupt enabling?

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 26, 2018, 4:45am UTC](https://forums.sifive.com/t/how-to-set-interrupt-for-a-particular-gpio-pin/1636/2 "2018-09-26T04:45:49Z")

</div>

And also i have this

#define digitalPinToInterrupt§ (INT\_GPIO\_BASE + variant\_pin\_map[P].bit\_pos)

taken from the arduino variants.
