I implemented interrupt support as per your excellent suggestion. Thank you very much for sharing this.
However, I didn't use your code but started from scratch.
Anyway, sometimes when reading the INTCAPA register (80h) i get a 0 value instead of the value of the button pressed.
Have you ever encountered this and found a solution?
Also i realized that software de-bounce with RPi.GPIO doesn't work with the current version (0.5.3a). Have you ever found out why? If i try to use software de-bounce the callback is fired just once and never again.
Interrupts do it better :-)
Moderators: adafruit_support_bill, adafruit
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Interrupts do it better :-)
Interesting question. I haven't done anything like this with a Pi, so I can't answer that part of it, but I think you could do this with an Arduino.phil.drummond wrote:Quick question about interrupts on the Raspberry Pi.
I have a radiation detector manufactured by Aware Electronics. It generates pulses for each event and the pulses are quite short. The refresh time of the tube/power supply is very fast allowing for count rates something like 200,000 pulses per second. (normal background levels around where I live are between 9 and 13 pulses a second for comparison
I would love to own Aware Electronics' display device but it's in the neighborhood of $400. It consists of a display, a few buttons and a PIC of some sort as well as electronics to shape and buffer the signal from the detector. 400 dollars is a lot of money and the hardware sounds like a Raspberry Pi, an Adafruit 16x2 display and not much els would be required to get going for much much less money
Have any of you messed with this kind of input?
Offhand, I can think of a few approaches.
If all you care about is counts/second, then you could
- tie the counter to an external interrupt line, and increment your count in a simple ISR.
- Tie to counter to an external clock input, and let the timer hardware do the counting for you.
Just check/reset the count periodically, run a rolling average, whatever.
If you want to know the interval between the ticks, then you can
- use the input capture feature of the hardware. You set up a timer to start freely incrementing. Tie the counter to the timer's "input capture" pin. Whenever the counter pulses the pin, the timer saves its current value, resets, and gives you an interrupt. In the ISR, you read the saved timer value, and increment your pulse count. Now you can plot counts vs. time.
By the way, we stock a Geiger counter kit. The product page links to the manufacturer's page - there are some tutorials on datalogging and other topics available there!
http://www.adafruit.com/products/483#Tutorials
- jumpzero
- Posts: 43
- Joined: Thu Feb 21, 2013 8:32 pm
Re: Interrupts do it better :-)
Hello,
Sorry for late answer
@phil.drummond: I dont know how fast a raspberry pi can count the interrupts, but a Linux guru has posted some tests on his blog, here
http://www.blaess.fr/christophe/2012/11 ... #more-3129
He has done some test and conclude to a 7microseconds respond time to an interrupt
It's in French but should be OK as it's technical (or Google translate)
On an other post he has done some test with a real time Linux kernel http://www.blaess.fr/christophe/2013/02 ... #more-3422
Here he demonstrates the Raspberry pi can handle 100kHz interrupts
@lightxx: No I never experienced reading zero in Intcapa register, but since I have done these tests I don't use it anymore. However I have a plan to drive an home automation system and plan to use it on a real use. I just need time... I'll let you know if any news.
--
Jmp0
Sorry for late answer
@phil.drummond: I dont know how fast a raspberry pi can count the interrupts, but a Linux guru has posted some tests on his blog, here
http://www.blaess.fr/christophe/2012/11 ... #more-3129
He has done some test and conclude to a 7microseconds respond time to an interrupt
It's in French but should be OK as it's technical (or Google translate)
On an other post he has done some test with a real time Linux kernel http://www.blaess.fr/christophe/2013/02 ... #more-3422
Here he demonstrates the Raspberry pi can handle 100kHz interrupts
@lightxx: No I never experienced reading zero in Intcapa register, but since I have done these tests I don't use it anymore. However I have a plan to drive an home automation system and plan to use it on a real use. I just need time... I'll let you know if any news.
--
Jmp0
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/