I am trying to determine in Xojo is feasible for a Raspberry Pi 4 application. In this app I need to utilize two GPIO inputs for the separate counting of pulses from two mechanical switches. Does Xojo support vectored interrupts? Can two independent GPIO interrupts be set up at the same time - separate routines for each of the two inputs. If so, in that interrupt routine it would perform two long integer additions (Count1=Count1+1, TotalCount=TotalCount+1) and set a variable to false. Does anyone have a guess how many interrupts per second the Pi 4 / Xojo combo could handle?
Second question - is it possible for the Xojo app on the Pi to save data files (txt/csv) to a shared drive on a Windows 10 PC? Is that tricky?
you could do that with a simple (but a fast variation) arduino ?
what are your interrupt frequency requirements ?
Thanks for the reply! I did not explain the entire project, my apologies, but there is much more to it than the counting. There is a touch screen UI that will interact with the user and present data stats and request user input. As far as the count frequency 20 counts per second would be the maximum. The count signal should be denounced (switch closure chatter / bouncing) before hitting the GIO on the Pi so that will not be a consideration. If it were, I would need to developed a software denounce handler in the code. I am mainly questioning if the Pi 4 / Xojo combo will be able to keep up with the two interrupts. Do the interrupts have priorities? What if interrupt 1 fires and is in its IRQ1 routine while interrupt 2 fires. Will the IRQ 2 event be pending until the IRQ1 handler is complete?
I still would do it with an arduino. 20 interrupts/sec is definitely “slow”.
I would add an intelligent display like a nexion to handle the user interface
the problem with the Pi is that it is a linux underlying, and so it is not a real time OS
pretty sure it could miss some interrupts, but the arduino is a small system, but completely real time.
and should perform better.
ps: this is only my 2 cts.
ps2 : and you should not have to use interrupts for 20 Hz
The Pi does not seem to have interrupt pins per se. If the ARM chip has an interrupt pin, it does not seem to be exposed on the IO pins. If you use Raspberry Pi OS, this is a Linux distro and my guess is that interrupts would be handle by Linux.
What I found out searching is that in Python there is a library that detects IO pin state change - detect a rising or falling edge - and maps that to a function. This is done by using an add_event_detect() Callback Mechanism.
@Jean-Yves_Pochez suggestion is to use an Arduino which means bare metal programming. If you wish to use a Raspberry Pi and Xojo provides something like detecting changing edges then that could be a different way similar to programming in Python. Both ways RasPi OS runs and that means it loads the ARM CPU to a certain extent.