Picaxe 40X2 + stepper driver DRV8825 and Visual Basic 6

JanJor

Member
Dear Forum,

I use a Picaxe 40X2 + two stepper drivers DRV8825 to drive two stepper motors, and that works perfect. The two stepper motors will in due time be driving an x-y table, for use in a simple 2D/3D-plotter.
However, I have the following problem: if I use the sin and cos function in the Picaxe, the results obtained when I want my x-y table to make a full circle are rather coarse. Using Visual Basic 6 to dive the Picaxe could solve this problem: VB6 can handle a formula for circles in high resolution.
I know how to send a byte from the Picaxe to the PC and red it in VB6, and I know how to send a byte from the PC (From VB6) to the Pixace (all that works flawless).
BUT: what I do not know is the following: how do I send a byte from VB6 to the Picaxe (in fact a stream of bytes, all sequentially giving a new value for x and y on a circle (or an ellipsoid), let the Picaxe handle the new x-y position of the stepper moters, send a signal back to VB that the Picaxe is ready (steppers in new position) and let VB send the next byte for the next x-y position?
So, briefly: I manage to send bytes from VB6 to the Pic, and also, in a separate program, from the Pic to VB6, but a continuous flow of bytes from VB6 to the Pic, the Pic using that byte to drive the steppers, sending a message back to VB6 that the Pic (and steppers) is ready, followed by a new byte from VB6 with the new x-y position, the Pic using that byte, sending a message back to VB6 that the Pic is ready, and so on, that seems impossible.
At least: after many evenings of desparate programming, I still did not manage.
I do realise that this formum is about Picaxe and Picaxe-programming, but if anuyone has solved this problem, could you please send me a very simple, brief, basic example of a VB6-program that does what I would like to do?
Thanks very much in advance,
Ronald
 

hippy

Ex-Staff (retired)
What you propose should be possible but it's not just a five minute job to explain how to. In simple terms; only send from PC to PICAXE when the PC receives a signal from the PICAXE.

An alternative may be to create less coarse SIN and COS functions. Using a lookup table spread across EEPROM and TABLE you can have a 0-90 degree segment of SIN or COS with 0.25 degree resolution and a 0.5% result resolution using byte values, or 0.5 degree resolution with hugely more result resolution using word values.
 
Top