Skip to main content

You are here

event counter with interrupt

5 posts / 0 new
Last post
paolometeo
event counter with interrupt

I want to use a Jeenode in order to count random events in a certain time interval, i.e. geiger counter, then I want to transmit this number. If I use the atmega interupt, does it interact with the Jeenode RFM12 comunications ? thank-you paolo

padvinder95

The RFM12b uses one of the two hardware interrupts that are available (or if you use level change interrupts you can use any pin). So, hardware-wise, you're fine.

If your interrupt routine is short, as it should be in any case (only set a boolean flag "I've got one!" or incrementing a counter) and handle all other processing in the loop() function, you should be fine. (Not sure how familiar you are with interrupts and ATmega coding, but remember to declare variables that are accessed and changed within the ISR as volatile.)

paolometeo

I have used this interrupt intruction on arduino board: attachInterrupt(0,GetEvent,FALLING); where "GetEvent" is the counting function. The pin used is 2.

padvinder95

I think that's the one that's used for the radio, so if you change it to attachInterrupt(1,[...]) then you should be fine. As a matter of fact, this interrupt line (pin 3 in Arduino labels, PD3 in ATmega labels, and interrupt source 1) is broken out to every JeeNode port (labeled "I" I think) so it's easy to access.

paolometeo

OK, I will try and then report. Thanks

Premium Drupal Themes by Adaptivethemes