Re: Jedicut and Arduino over USB

83
Hi,
There are 2 functions for the heat : ON/OFF and the dynamic heat.
For the On/Off function don't think the synchronization is needed.
But for the dynamic heat, I think that the heat value is calculated with many parameters, wich need a fixe reference timer to adjust heat when the cutting wire do a tight curve, to prevent radiation of the wire and obtain a bad cutting. So it's very more difficult :p

Re: Jedicut and Arduino over USB

85
Hi All.
Is it just Me; does the motor command output from the .dll not match what is expected in the Arduino code e.g.

The PC sends "M"0xnn where nn in binary is defined as :-
8 4 2 1 8 4 2 1
x1dir x1step y1dir y1step x2dir x2step y2dir y2step

The arduino expects ...

void sendMotorCmd(byte cmd)
{
PORTD = (PORTD & 0x0F) | (cmd & 0xf0); // Directions first!
PORTB = (PORTB & 0xF0) | (cmd & 0x0f); // and step
delayMicroseconds(10); // eventually wait a little bit
PORTB = (PORTB & 0xF0);
}

It's not a problem as i coded a work around in the arduino. (Haven't programmed in C++ since 1996 !).
The Stepper Motors are now tuned to perfection. I even built my own Arduino clone, although i had to buy another Atmel chip as my first one didn't want to boot up.

I think there is only one issue with the Arduino code as it stands. My stepper driver board seems to need the motors enabled some time before the first step pulses come along. Most of the mis-stepping occurs at the begining of a step cycle. I think there might need to be a separate delay for the enable signal.


Thanks to Martin and Jerome. Best wishes for 2013.

Re: Jedicut and Arduino over USB

86
Hi Rick,

if you configure the communication settings as I described here. then the output from the dll will fit perfectly to the arduino code and you do not need to modify it.
The issue of adding a little delay after turning on the motors will not be a problem. How long should the delay be? I will add it, because it will not harm the function of other stepper driver boards.

Best wishes for the new year too

Martin

Re: Jedicut and Arduino over USB

87
Hello All.
I've been looking more closely at the Arduino code ... this time with an oscilloscope !.
It looks like the timer#2 interrupt service routine slows down when processing commands. I guess this is because the counter is reloaded at the end of the ISR. So in effect it's like a one shot (monostable).
Also, using timer#2 prevents the use of analogWrite() function on pin 3 as i believe this uses timer#2 channel b.

I've now changed my code to use timer#0 for the command processing ISR. PWM on pin 3 now works.
Also the ISR is now unaffected by the processing of the commands. This is because I configured timer#0 to be in mode 7 (fast pwm).
You could use mode 2 (CTC), but mode 7 is more elegant due to the double buffering of the output compare register.
See circa page 150 of the Atmel datasheet.

I hope this information can be of help to someone.

Regards, Rick.

Re: Jedicut and Arduino over USB

89
Hey Jerome,
Why not build your own Arduino. After all this is a hobby.
rsz_ard_rear.jpg rsz_ard_rear.jpg Vu 4608 fois 242.39 Kio
... and the backside.
rsz_ard_rear.jpg rsz_ard_rear.jpg Vu 4608 fois 242.39 Kio
All the resistors are to reduce the current to the Opto-couplers. If I hadn't put these in the "Arduino" would have fried ! (crazy chinese driver board).

P.S.
My version of Martins code is now stable.
PWM now works.
All my cnc signals are active low.

PM me if you wan't a copy.

Now I must go and build a Glider as the weather is getting better and I really need to fly.

Rick.
Fichiers joints
rsz_ard_front.jpg rsz_ard_front.jpg Vu 4608 fois 243.84 Kio

Re: Jedicut and Arduino over USB

90
Hi,

I think Rick is right, I've overseen that the pwm function of pin3 uses timer2. But timer0 is used for delay functions and if they are used, timer0 shouldn't be used for the main stepper timing, too. May be timer1 (which is used for tone functions, we do not need) can be used without side-effects. Or the pwm is software generated within the timer loop we already have.
Until now I didn't notice, that processing the commands slows down the isr, but I have no oscilloscope. So using the fast pwm mode may be a better solution.
I think I will experiment a little bit and adapt the arduino code. Rick, do you share your arduino code with us?


Martin
`); }); })(jQuery, window, document, phpbb);