Main Site Documentation

I need a few pointers


#1

Hello,
I am ready to resurrect a project from a year ago and need some “enlightment”.
The jist of it is:
I have a small milling machine and a set of iGaging digital scales, motorized rotary table and motor drive on one axis.
A domino board is connected to a BlueTooth modem (COM2) , throught which it receives commands and sends scales readings.
In regard to the stepper motors, I’d like to have a limited “CNC” functionality, i.e. rotate the table x number of degrees or jog the axis x number of mils (.001"). That alone is easy (and working): I send a command from a PC to tick the stepper x times at some frequency.

The scales part is a bit tricky, thoug.
The protocol works as follows: the master (Domino) pulses the clock line at 9 kHz 21 times and reads the input on some other pin. I was able to do that with Thread.Sleep ( loop 21 times: pull clock pin high, wait for the rampup, read the input pin, set the clock pin low, sleep, etc.)

So far both things work fine in single threaded mode, but I would like to have a bit mode elegant solution. My idea would be to use PWM, for example, to tick the clock, and triggered pins to read the input. I think, even though I have 3 scales, one triggered pin cound fire the event that will check the other pins.

The thing is that I wan to do those things simalutaneously, i.e. jog the table and read the position, not “jog-stop-read-transmit-resume jogging”.

I’d really appreaciate some ideas how to do this efficiently.

Thank you
Yuriy


#2

isn’t that SPI protocol?

you could read position once, then predict number of steps to take and send the steps. put this in a while loop until you are on correct position. if the predict is fine you shoould only have a read, move and verify for each position.