Nigel,
i use my code with TB6560 controllers.
It works.
You must show, that in arduno-code only the Step-pin every time go to low.
void sendMotorCmd(byte cmd)
{
PORTB = (PORTB & 0xF0) | (cmd & 0x0f);
PORTD = (PORTD & 0x0F) | (cmd & 0xf0);
}
Here you must change the Code.
Re: Jedicut and Arduino over USB
112Hi Maes
Ihave changed the code to this
I have void sendMotorCmd(byte cmd)
{
PORTD = (PORTD & 0xF0) | (cmd & 0x0f); // Directions first!
PORTB = (PORTB & 0x0F) | (cmd & 0xf0); // and step
delayMicroseconds(30); // eventually wait a little bit
// and falling edge of step pulse
PORTB = (PORTB & 0xF0);
}
Now i have no rotation any thoughts?
Many thanks
Nigel
Ihave changed the code to this
I have void sendMotorCmd(byte cmd)
{
PORTD = (PORTD & 0xF0) | (cmd & 0x0f); // Directions first!
PORTB = (PORTB & 0x0F) | (cmd & 0xf0); // and step
delayMicroseconds(30); // eventually wait a little bit
// and falling edge of step pulse
PORTB = (PORTB & 0xF0);
}
Now i have no rotation any thoughts?
Many thanks
Nigel
Re: Jedicut and Arduino over USB
113Hi Maes
Iam still having no luck may i have a copy of your working code?
Thanks
Nigel
Iam still having no luck may i have a copy of your working code?
Thanks
Nigel
Re: Jedicut and Arduino over USB
114Nigel,
here my code for a dsPic4013(Microchip).
#bit Ser_IN_X1_S = Val.7
#bit Ser_IN_X1_R = Val.6
#bit Ser_IN_Y1_S = Val.5
#bit Ser_IN_Y1_R = Val.4
#bit Ser_IN_X2_S = Val.3
#bit Ser_IN_X2_R = Val.2
#bit Ser_IN_Y2_S = Val.1
#bit Ser_IN_Y2_R = Val.0
#bit Ser_ME_ovf = Ser_Merker.0
#bit Ser_ME_inProg = Ser_Merker.1
#bit Ser_ME_beendet = Ser_Merker.2
void sendMotorCmd(byte cmd)
{
//X1-Dir
if (Ser_IN_X1_R)
{
Out_X1_R_ON;
}
else
{
Out_X1_R_OFF;
}
//X1-Step
if (Ser_IN_X1_S)
{
Out_X1_S_ON;
}
else
{
Out_X1_S_OFF;
}
//Y1-Dir
if (Ser_IN_Y1_R)
{
Out_Y1_R_ON;
}
else
{
Out_Y1_R_OFF;
}
//Y1-Step
if (Ser_IN_Y1_S)
{
Out_Y1_S_ON;
}
else
{
Out_Y1_S_OFF;
}
//X2-Dir
if (Ser_IN_X2_R)
{
Out_X2_R_ON;
}
else
{
Out_X2_R_OFF;
}
//X2-Step
if (Ser_IN_X2_S)
{
Out_X2_S_ON;
}
else
{
Out_X2_S_OFF;
}
//Y2-Dir
if (Ser_IN_Y2_R)
{
Out_Y2_R_ON;
}
else
{
Out_Y2_R_OFF;
}
//Y2-Step
if (Ser_IN_Y2_S)
{
Out_Y2_S_ON;
}
else
{
Out_Y2_S_OFF;
}
delay_us(5);
Out_X1_S_OFF;
Out_X2_S_OFF;
Out_Y1_S_OFF;
Out_Y2_S_OFF;
}
Manfred
here my code for a dsPic4013(Microchip).
#bit Ser_IN_X1_S = Val.7
#bit Ser_IN_X1_R = Val.6
#bit Ser_IN_Y1_S = Val.5
#bit Ser_IN_Y1_R = Val.4
#bit Ser_IN_X2_S = Val.3
#bit Ser_IN_X2_R = Val.2
#bit Ser_IN_Y2_S = Val.1
#bit Ser_IN_Y2_R = Val.0
#bit Ser_ME_ovf = Ser_Merker.0
#bit Ser_ME_inProg = Ser_Merker.1
#bit Ser_ME_beendet = Ser_Merker.2
void sendMotorCmd(byte cmd)
{
//X1-Dir
if (Ser_IN_X1_R)
{
Out_X1_R_ON;
}
else
{
Out_X1_R_OFF;
}
//X1-Step
if (Ser_IN_X1_S)
{
Out_X1_S_ON;
}
else
{
Out_X1_S_OFF;
}
//Y1-Dir
if (Ser_IN_Y1_R)
{
Out_Y1_R_ON;
}
else
{
Out_Y1_R_OFF;
}
//Y1-Step
if (Ser_IN_Y1_S)
{
Out_Y1_S_ON;
}
else
{
Out_Y1_S_OFF;
}
//X2-Dir
if (Ser_IN_X2_R)
{
Out_X2_R_ON;
}
else
{
Out_X2_R_OFF;
}
//X2-Step
if (Ser_IN_X2_S)
{
Out_X2_S_ON;
}
else
{
Out_X2_S_OFF;
}
//Y2-Dir
if (Ser_IN_Y2_R)
{
Out_Y2_R_ON;
}
else
{
Out_Y2_R_OFF;
}
//Y2-Step
if (Ser_IN_Y2_S)
{
Out_Y2_S_ON;
}
else
{
Out_Y2_S_OFF;
}
delay_us(5);
Out_X1_S_OFF;
Out_X2_S_OFF;
Out_Y1_S_OFF;
Out_Y2_S_OFF;
}
Manfred
Re: Jedicut and Arduino over USB
115HI all
Thanks for all your help but i still an unable to get the stepper motors to run in both directions.
I dont have an understanding of the arduino code changes reqd can any one offer any more help?
Many thanks Nigel
Thanks for all your help but i still an unable to get the stepper motors to run in both directions.
I dont have an understanding of the arduino code changes reqd can any one offer any more help?
Many thanks Nigel
Re: Jedicut and Arduino over USB
116Hi Nigel,
I am sure, we need to solve only a little problem and your system will run. First of all please check again the following:
Which stepper board do you use?
Martin
I am sure, we need to solve only a little problem and your system will run. First of all please check again the following:
- Version of arduino code
Please make sure, that you use the latest arduino code (its revision r91) - Configuration within jedicut and wiring of your motors
Please refer to Configuration and wiring - Check the baud rate of the serial interface
Maybe you need to reduce the baudrate
- change the arduino code line 59 from Serial.begin(115200); to Serial.begin(57600);
- change the file comport.ini the value BAUDRATE = 115200 to BAUDRATE = 57600
Which stepper board do you use?
Martin
Re: Jedicut and Arduino over USB
117Hi martin
Thanks for your reply
Firstly I am using single TB6560 driver boards and a break out board.
I have got as far as the motors all running well in one direction.When the jedicut is running motors turning CW rotation is fine smooth and quiet.When the programme calls for a change of direction CCW the motors are very erratic with no real rotation if i now disconnect the dir pin from the arduinio the motors return to the CW rotation smooth and quiet although being commanded to run CCW.
If i then reconnect the DIR pin whilst the programming is still running the motors run very erattic.
I have had the stepper motor /drivers running on mach 3 with no problems.
I have the latest version of the code loaded and my pin outs are configured as per your posts.
I have now changed the baud rate in the arduino code as you have suggested but Iam a little lost as to changing the baud rate in the comport.ini
Is this step just a case of going into device manager and changing it in the port setting page?
Many thanks again for your help i was getting very close to scrapping the project!!!! Building the hardware was the easy part
Kind regards
Nigel
Thanks for your reply
Firstly I am using single TB6560 driver boards and a break out board.
I have got as far as the motors all running well in one direction.When the jedicut is running motors turning CW rotation is fine smooth and quiet.When the programme calls for a change of direction CCW the motors are very erratic with no real rotation if i now disconnect the dir pin from the arduinio the motors return to the CW rotation smooth and quiet although being commanded to run CCW.
If i then reconnect the DIR pin whilst the programming is still running the motors run very erattic.
I have had the stepper motor /drivers running on mach 3 with no problems.
I have the latest version of the code loaded and my pin outs are configured as per your posts.
I have now changed the baud rate in the arduino code as you have suggested but Iam a little lost as to changing the baud rate in the comport.ini
Is this step just a case of going into device manager and changing it in the port setting page?
Many thanks again for your help i was getting very close to scrapping the project!!!! Building the hardware was the easy part
Kind regards
Nigel
Re: Jedicut and Arduino over USB
118Hi Nigel,
the comport.ini is a file in the jedicut directory. To change the baudrate for jedicut, you only need to change the value in this file and in the arduino code.
When disconnecting the direction pin, the logical input to TB6560 is not defined, but may be held internally low or high. This commands a specific rotation direction. Manfred may be right when he assumes problems in the timing of the pulses for direction.
If your board has positive logic the sequence looks like this: We have here 3 timing values
[pre]
void sendMotorCmd(byte cmd)
{
PORTD = (PORTD & 0x0F) | (cmd & 0xf0); // Directions first!
delayMicroseconds(150); // Delay d1 <-------------------------------------------------------
PORTB = (PORTB & 0xF0) | (cmd & 0x0f); // and step
delayMicroseconds(150); // eventually wait a little bit Delay d2 <-------------------------------------------------
// and falling edge of step pulse
PORTB = (PORTB & 0xF0);
delayMicroseconds(150); // Delay d3 <-------------------------------------------------------
}
[/pre]
The delay d3 is as long as the time to the next call to sendMotorCmd. If it's to short, you can add a delay after linr PORTB=... in the function. If your board steps on falling edge of step pulse, it may a good idea to add a delay d3.
Start with "high" values (150 us) for d1,d2,and d3 and reduce them until it starts to become unsmooth.
Martin
the comport.ini is a file in the jedicut directory. To change the baudrate for jedicut, you only need to change the value in this file and in the arduino code.
When disconnecting the direction pin, the logical input to TB6560 is not defined, but may be held internally low or high. This commands a specific rotation direction. Manfred may be right when he assumes problems in the timing of the pulses for direction.
If your board has positive logic the sequence looks like this: We have here 3 timing values
- d1 - the time the direction must be valid before the step pulse has its rising edge
- d2 - the time the step pulse must me valid (high)
- d3 - the time the direction level must be valid after the falling edge of the step pulse
[pre]
void sendMotorCmd(byte cmd)
{
PORTD = (PORTD & 0x0F) | (cmd & 0xf0); // Directions first!
delayMicroseconds(150); // Delay d1 <-------------------------------------------------------
PORTB = (PORTB & 0xF0) | (cmd & 0x0f); // and step
delayMicroseconds(150); // eventually wait a little bit Delay d2 <-------------------------------------------------
// and falling edge of step pulse
PORTB = (PORTB & 0xF0);
delayMicroseconds(150); // Delay d3 <-------------------------------------------------------
}
[/pre]
The delay d3 is as long as the time to the next call to sendMotorCmd. If it's to short, you can add a delay after linr PORTB=... in the function. If your board steps on falling edge of step pulse, it may a good idea to add a delay d3.
Start with "high" values (150 us) for d1,d2,and d3 and reduce them until it starts to become unsmooth.
Martin
Re: Jedicut and Arduino over USB
119Hi Martin/Manfred
Well guys its good news. I have changed the baud rate as you suggested
I have set the audrino delays to the following:-
Delay#1 62
Delay#2 2400
Delay#3 62
I have also set the stepper drivers to 1/2 step
I now have smooth rotation in both cw and ccw and the motors appear to be indexing correctly with no missed steps.
I will over the next few days re attach the steppers to the hard ware and try some cuts .
i will keep you all posted.
Many thanks Nigel(tu)
Well guys its good news. I have changed the baud rate as you suggested
I have set the audrino delays to the following:-
Delay#1 62
Delay#2 2400
Delay#3 62
I have also set the stepper drivers to 1/2 step
I now have smooth rotation in both cw and ccw and the motors appear to be indexing correctly with no missed steps.
I will over the next few days re attach the steppers to the hard ware and try some cuts .
i will keep you all posted.
Many thanks Nigel(tu)
Re: Jedicut and Arduino over USB
120Hi Martin / Manfred
Progress update
I have now re connected the stepper motors to the hardware and carried out a few test cuts the motors are a little course /noisy at slow speeds.
the cut quality is very good although the speed adjustments in Jedicut does not seem to have any effect. More investigation required.
Next phase is heating control.
I have some pictures to post but i dont seem to be able to paste them onto this forum.
Nigel
Progress update
I have now re connected the stepper motors to the hardware and carried out a few test cuts the motors are a little course /noisy at slow speeds.
the cut quality is very good although the speed adjustments in Jedicut does not seem to have any effect. More investigation required.
Next phase is heating control.
I have some pictures to post but i dont seem to be able to paste them onto this forum.
Nigel