Frequency measurement with hardware interrupt handler
Amani4791 last edited by
I need to measure frequency output of a flow meter 0-1000Hz.
(Core2, Pin GPIO27)
I have setup some code in UIFlow and defined IRQ and handler in "Execute Code" block.
Reading works but very unstable (Jumps between 300..1000).
Probably I need to run the handler in IRAM?
Where/ how can I put the IRAM_ATTR?
My execute code block:
global counter, semaphore
Thanks a lot!
IAMLIUBO last edited by
Hi @amani4791 ,
Did you try download to device and run it?
Yes, I ran it on Core2.
It measures frequency but very unstable.
I meanwhile found that it's better if I introduce a wait loop. Looks like writing to the display consumes too much time.
But I think there should be a possibility to use iram. It shouldn't happen that such a relatively "slow" signal can be missed?...
Somewhere I read that it's possible to use the "button" element to get interrupt: but how to link GPIO to the button?
ajb2k3 last edited by ajb2k3
@amani He means did you save it to the Core2 so that it loads when the core2 powers up and not just press the > button.
Have you looked under the Hardwares>pin menu and tried with these blocks?
@ajb2k3 : thanks for clarification. I really only used "play" button 😬
So after donloading and booting directly from Core2 it performed better.
But after I reintroduced temperature sensor reading (i2c) it was again very unstable.
To me it looks like there is not really interrupt driven counting activated...
(If I e.g. load the frequency measurement only and only update LCD w/o delay the frequency reading is totally off (too small count). With some delay it is better. But with some more workload it is not reliable that way?...