The other two languages that works are C and Python.
C was a console app, and Python was a GUI app. Xojo was also a GUI app. I haven’t tried the C application in a GUI.
I could try and write the application in Xojo as a console and see how that works. Thanks for the suggestion.
that would be a much more fair comparison I think
Would it make sense to off-load the time-critical work to a micro-controller like an Arduino and then have the Arduino pass the results to the Raspberry Pi? The Raspberry Pi isn’t really suited to handling time-critical processing. But an Arduino is ideal for that kind of work.
Hi Wes,
Yes, that is an option to have this work sent to an Arduino, and it works well.
I guess the part that I have a difficult time with is that the programs work well with other languages and not with Xojo. The other languages ‘just work’ where I have to create work-arounds to try and make it work with Xojo. Don’t get me wrong, I like programming in Xojo and the pesky work-around just get old after-a-while.
If I will need to program the code in C for an Arduino and then send the data to the Raspberry Pi, why wouldn’t I just use the same Arduino or use another more responsive language on the Raspberry Pi to do the same job. I was hoping for an easy answer to make it work in Xojo, that is all.
That’s the price you pay for having the convenience of a do-everything framework at your fingertips.
I mentioned earlier that almost all of the chips that I have to communicate with are standard clock line plus data line interfaces which are not timing critical, and will communicate reliably with all kinds of random delays in the signals. If you’re using a device that has strict timing requirements, then even if you manage to eliminate the garbage collection delays in your Xojo app, there’s still the operating system to deal with. It has its own housekeeping tasks that could conceivably create timing problems.
For the one application where I did have to communicate between a Xojo application and a device with a serial UART interface, I did as Wes suggested: a small Arduino compatible ESP8266 go-between, converting serial data from the field instrument to TCP/IP via wifi to the Xojo application.
[quote=480630:@Eugene Dakin]I am seeing general issues from high frequency Bit-Banging (reading a pressure sensor with millisecond data), to communication with integrated circuits (the binary hand-shaking shows up with lower and higher duration times on my oscilloscope and prevents successful hand-shakes), to something simple like the timing on a stepper motor (slow motor turn rates and the motor stopping). Again, checking the oscilloscope shows the bits are not evenly spaced.
Running the exact same programs on a competitive IDEs in other languages works well. Xojo programs on the Raspberry Pi work better when global variables are used and the performance is poor. Shrug, I don’t know what else to say?[/quote]
I would have guessed, without trying it ;), that the main problem on the Pi would be the OS and the fact that none of these are real time so your program could be held out at any moment for an unknowable amount of time.
I would definitely do the writing in a tight loop of xojo code with the disable background tasks pragma to stop any of that, but that wont stop the freeing of memory.
i wonder if it would be possible to do the low level communication treating the bit banging as a serial port? Since it does not have the clock pulse it must act as one. I know the pigpio stuff has the ability to use any pin as a serial port and is very configurable for speed and format and such. It might be possible to make something that already handles the timing in the kernel like that do it. I dont know if the format of the data would make itself possible or not of course. It might be worth experimenting with as it would be fairly easy to setup.
If you need a separate app or a helper app you can do that too. Perhaps a very simple console app with nothing else happening in it in Xojo would work to send the data and you can start it up via an async shell in your app and pass it packets of data through the shell pipe or an IPC Socket or something. If you need to go with a completely different language or a small compiled C program to do the low level bit banging then it too could accept data via its pipes and send it down the proper pin and be launched from the Xojo app. Any of that would be simpler than starting over in another language completely.