Arduino Leonardo and linears encoders.

More
01 Feb 2013 21:04 #29440 by andypugh

This pendant is part of my final carreer project, and i have to try to link correctly with linuxcnc,


In that case, I think that the right thing to do is write a driver based on shuttlexpress.c

Most of the setup code can stay the same, except for the ID numbers. I think you already have that part working.

The next thing to do is to see what data you are getting. If you look at lines 132 to 141 in shuttlexpress.c you can see that it is looking at an array of "packets"
The first thing I would do would be to create some new HAL pins, of type U32, one for each "packet" and see what data is being received.
The HAL pins are created and defined in lines 222 to 273. 258 creates an S32 type, but U32 might be clearer.

You can then work on creating a HAL pin for every button, and for the jogwheel, etc.

With luck you might also find out how to interface the LCD. Is there any sign of an _input_ pin being created in HAL by hidcomp?
The following user(s) said Thank You: casetero

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

More
02 Feb 2013 00:44 - 02 Feb 2013 00:52 #29449 by casetero
Now i´m not with the machine, but seeing the code of shuttlexpress.c, the position of the arrays is when it put

packet[3] & 0x10 for example??

So i have to put one line for each position of the array, suposing that it has "0" colums and "80" rows??

Reallty the normal buttons of the pendant i think i can manage them with the comp function and hidcomp. But maybe is better to link all to the modificated shuttlexpress.

The counts of the jogwheel are readed in lines 154-159, are they? Wich value have i to modify in these lines to try another source signal to read? this one *s->hal->spring_wheel_s32 = packet[0]??

The PINs that hidcomps creates are just these:

hidcomp.0.PIN1.raw
hidcomp.0.PIN1.ivalue
hidcomp.0.PIN1.fvalue
hidcomp.0.PIN2.raw
hidcomp.0.PIN2.ivalue
hidcomp.0.PIN2.fvalue
hidcomp.0.PIN3.raw
hidcomp.0.PIN3.ivalue
hidcomp.0.PIN3.fvalue
hidcomp.0.PIN4.raw
hidcomp.0.PIN4.ivalue
hidcomp.0.PIN4.fvalue
hidcomp.0.PIN5.raw
hidcomp.0.PIN5.ivalue
hidcomp.0.PIN5.fvalue

And all them are linked to buttons, so hidcomps doesn´t create PINs for the LCD i think. But maybe i have to do something in hidcomp for working with LCD, i haven´t investigate it yet.

Another thing i saw is that when i start hidcomp in the custom.hal (hal ini file) with my pendant linked, and in the next line i do the same with shuttlexpress, the last one doesn´t work. And vice versa. So in some kind of way when one of them link the device, this one keep with it and doesn´t get shared ( maybe they are jealous).

Thank you Andy.
Last edit: 02 Feb 2013 00:52 by casetero.

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

More
02 Feb 2013 17:29 #29474 by andypugh

Now i´m not with the machine, but seeing the code of shuttlexpress.c, the position of the arrays is when it put

packet[3] & 0x10 for example??

So i have to put one line for each position of the array, suposing that it has "0" colums and "80" rows??


No, it's not that complicated.

I am thinking in terms of just
...
87 hal_u32_t debug1
88 hal_u32_t debug2
89 hal_u32_t debug3
90 hal_u32_t debug4
...
143 s->hal->debug1 = packet[0]
144 s->hal->debug2 = packet[1]
145 s->hal->debug3 = packet[2]
146 s->hal->debug4 = packet[3]
...
261 r = hal_pin_u32_newf(HAL_OUT, &(s->hal->debug1), hal_comp_id, "%s.%d.debug1", modname, num_devices);
262 if (r != 0) goto fail1;

(and so on)
The following user(s) said Thank You: casetero

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

More
02 Feb 2013 21:14 #29486 by casetero
Ok, i think i have understood you.

Continue on monday...

Thank you!!

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

Time to create page: 0.249 seconds
Powered by Kunena Forum