twin processor arduino ?

I have a project where i want to count highspeed pulses on an knturrupt and do some calculations and then send data to the serial port.

The arduino is jamming because the interrupt is stopping the serial communication from continuing.

Could i use 2 arduinos or a twin processor one for counting and one for serial comms

Is there an alternative to counting high speed pulses using an interrupt ?

http://forum.arduino.cc/index.php/topic,77745.0.html

Gadget999:
Is there an alternative to counting high speed pulses using an interrupt ?

Yes.

You can use a pin as a clock source for a timer, the timer will count the pulses.
.

thanks for the advice guys

i will try pulsein

i didnt realise it will stop and wait for a pulse for a while before it continues

is there a twin processor arduino on the market that can be used to read multiple high speed pulses ?

how do you get 2 arduinos to talk to each other and transmit information back and forth

Gadget999:
thanks for the advice guys

i will try pulsein

i didnt realise it will stop and wait for a pulse for a while before it continues

is there a twin processor arduino on the market that can be used to read multiple high speed pulses ?

how do you get 2 arduinos to talk to each other and transmit information back and forth

I do not think there is a board with two of the same chips for sale, just the yun, tre and zero ( soon ).

To communicate between them in serial, SPI would be the fastest, or if you have enough spare pins a set of parallel lines to flag interrupts and latch blocks of data.

Gadget999:
i will try pulsein

pulsein() doesn't count number of pulses, it tells you how long they are.

nb. Counting number of pulses and getting the length of pulses can all be done in hardware, just don't expect the standard Arduino functions to do it for you...

fungus:

Gadget999:
i will try pulsein

pulsein() doesn't count number of pulses, it tells you how long they are.

nb. Counting number of pulses and getting the length of pulses can all be done in hardware, just don't expect the standard Arduino functions to do it for you...

yes - understood

i just use it as a flag to let me know a pulse has taken place and then measure the time between them if the pulse width > 0

:slight_smile:

Gadget999:
i just use it as a flag to let me know a pulse has taken place and then measure the time between them if the pulse width > 0

It will all depend on the frequency of your pulses and the accuracy you need.

(Both things that you're keeping secret - in case we give good answers...?)

worst case would be 90,000 pulses a second !!

realistically - 500 to 3,000 pulses a second

Gadget999:
The arduino is jamming because the interrupt is stopping the serial communication from continuing.

Are you absolutely sure that this is the problem?
You are not trying to print from an ISR are you because that will not work. But there are ways round this that should not cause a jam.

HI Mike

i am not sure it is the problem - the serial transmission stops when the speed of pulses increases

i am assuming the interrupt is stopping the serial transmission from continuing

what is an ISR ?

ok the isr is the interrupt

no i am not printing from the interrupt but from the main loop

i can print either event based - ie every 100 pulses
or time based - ie 10 times a second

I think you would have to post your code to get a clearer picture of what you are doing.

the serial transmission stops when the speed of pulses increases

That could be for many reasons, do you know the frequency that this happens at? Is the ISR (Interrupt Service Routine ) taking too long? Is it printing a lot of data? Is the speed it happens dependent on the serial baud rate? Have you tried faster baud rates?
What arduino are you using, for example a Leonardo does not actually use the baud rate value in the serial port.

Hi Mike - yes it is a Leonardo

i will try some faster rates and see what happens and report back

i will try some faster rates and see what happens and report back

Don't bother, when communicating back to the computer with a Leonardo the baud rate setting is totally irrelevant, the transfer happens at the fastest rate no matter what the speed. Do some simple tests and see.