MESA 5i25 + 7i76D --> Program with Python (?) or Program in Gambas (?)

More
20 Apr 2019 16:10 #131319 by Askjerry
I have a computer set up with a MESA 5i25 and 7i76D card... and I can do configurations in LinuxCNC just fine.

I am wondering... since I am starting to learn a little about Python programming on a Raspberry Pi... I started wondering if I could somehow treat the 7i76D input/output pins like GPIO?? If I can get that to work... then later on I can look at the PWM generators normally used for the 5-axis... and tinker with them as well.

I've got a 6-Axis robot arm... and I was thinking it would be great to make it work with something other than LinuxCNC. At the moment... I do not have it configured to work with LinuxCNC... I need to replace the control electronics first... so for now I'd be happy detecting switch closures and turning on LEDs.

Is this possible??

I also played with GAMBAS (A Visual BASIC clone) and if it is possible to do it there... that is another option.
I'm more familiar with programming Gambas than Python... but either would be a cool experiment to work with.

Anyone here done that???

Thanks,
Jerry

Please Log in or Create an account to join the conversation.

More
20 Apr 2019 23:26 #131341 by andypugh
7i76 GPIO pins are only updated at servo-thread rate.

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 00:06 - 21 Apr 2019 07:04 #131345 by Askjerry
Last edit: 21 Apr 2019 07:04 by Askjerry. Reason: Redundant

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 00:08 #131346 by Askjerry
How would there be a servo thread if I am not running LinuxCNC? Hence placing this in the off topic section.

Im talking about running a totally independent software package written in either Gambas or Python to use the MESA as a digital interface.

Im talking about starting in Python 3 and figuring out how to tead a switch and light an LED.

Basically a command line process which would evolve into a graphical interface... Presuming I can even get started. I can do it with a Raspberry Pi... But the MESA may offer more options.

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 01:49 #131359 by tommylight
@ Jerry
It looks like your Caps_Lock is working again, but it is set for redundancy ! :)
Back on topic:
Mesa cards need a servo period for communicating with Linuxcnc at given intervals as they do most heavy lifting on them and just report back from time to time and accept new commands at said intervals, gathered and properly folded.
Mesa cards can output and read signals up to 10MHz, so 10 million times per second and that would be way to much information to send back and forth so it sends and receives updated data at 1ms intervals or 1000 times a second ( this can be set up to 4000 times easily ).
What you are trying to do is similar to Arduino, write code to control something directly. And even arduino has different modes of controlling pins, the usual way with the Arduino ide will give you about 1000 pulses or reads from a pin, but the direct access way will get to up to 1 Mhz. So it most probably can be done, but i do not see a reason why.
On the other side, Mesa cards are very flexible and can be programmed to do many things so bringing that capacity to an ............. it just looks like crippling all the possibilities.
You can always use halrun to do what you want without any programming, but that is part of linuxcnc and you do not want to use that.
Python is used by Linuxcnc for many things, and it is very powerful, but visual basic ???? Hell that was the reason i quit programming some 20 years ago. It was and is utterly useless.
Maybe other members can shed more light on this.
Regards.

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 02:01 #131360 by rodw
Before you settle on the Mesa cards you know, maybe look at what else is out there including solutions from Mesa that are not designed for the LinuxCNC environment. I got a basic rotary table controller written in 200 lines of code in an hour or so on thew Arduino.

The Arduino is very capable as a step generator and with interrupt driven code, can get up to 8 Mhz (on a 16 MhZ clock with one cycle on and another off).

Python is used by Linuxcnc for many things, and it is very powerful, but visual basic ???? Hell that was the reason i quit programming some 20 years ago. It was and is utterly useless.
Maybe other members can shed more light on this.
Regards.


I was very pleased to kiss BASIC goodbye before Visual Basic arrived on the scene, moving t Pascal, and then C before using a higher level datacentric language/development environment called Clarion. I recently watched some of the cool Google Python tutorials and now use it a bit because I found it pretty gobsmacking to see you could write stuff in Python in 100 lines of code that would take 1000's of lines in C.

Its probably not conceptually hard to do this in other languages. you just need to chain into the system timer interrupt to replace the servo thread.

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 02:07 #131362 by tommylight
But for a 6 axis robot ?
Kinematics !!!

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 07:13 - 21 Apr 2019 07:16 #131373 by Askjerry
Ok... sounds like more of a pain in the backside than it's worth.

I'll either configure it in LinuxCNC and use canned G-Code... or use some combination of Atmel AVR and Raspberry Pi to create something. BASIC... not great for speed... but for making a conceptual mock-up it works. I use VBA in Excel all the time... it gets the job done. In fact, I use BASCOM which is a basic compiler for the Atmel... after you plug in the library and get it running... it's all compiled to machine code anyway. Best answer... eh probably not... but I have a few hundred projects out in the world and none have failed so far. (They are stable.)

Starting now with the Raspberry Pi... everyone seems to use Python... although some variant of C would probably suit me better... still learning Python... kinda odd using tabs to delimit routines and such. At least C follows a syntax similar to BASIC... start a loop... close a loop... throw in some semicolons and such... but similar. BASIC...been programming in that since 1978... so I can do it blindfolded. C, Javascript, PHP, I can code in fairly well... learning Python... just a matter of what works... then go that route.

So I guess for now... LinuxCNC... I know enough to be dangerous there.

Jerry
Last edit: 21 Apr 2019 07:16 by Askjerry.

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 07:46 #131374 by andypugh

How would there be a servo thread if I am not running LinuxCNC?


That wasn't apparent to me from the first message.

Unless the Mesa cards are polled regularly the watchdog will bite.
You might be able to bypass this by settings.

You would need to create a driver for the 5i25 and then for the smart-serial protocol to access the 7i76 GPIO.
Does your Gambas allow register-level access to the PCI bus to communicate with the 5i25?

Please Log in or Create an account to join the conversation.

More
21 Apr 2019 07:51 #131375 by Askjerry
I seriously doubt it. It is a very amateur version of Visual Basic... which is more of a hobby language than anything else.
As I said in my last post... not worth pursuing any further.

Please Log in or Create an account to join the conversation.

Time to create page: 0.161 seconds
Powered by Kunena Forum