Re: Jedicut and Arduino over USB

52
[quote=MAES]
Vincent,

i think the problem is here:
in funktion "void handleCommand()".
"sendMotorCmd(0); // and turn motors off, falling edge of pulse"

You must show, that only the step-impuls goes "low".
The direction only change, when the direction-bit in "val" change.

Manfred[/quote]

You're right, I've seen this...So for my mm2001 I must update the arduino code AND the dll ::o

Re: Jedicut and Arduino over USB

53
Vincent,

You can take its so:
call the funktion "void handleCommand(val)" only one time.

Pin X1-Step = Val.7
Pin X1-Dir = Val.6

Pin Y1-Step = Val.5
Pin Y1-Dir = Val.4

Pin X2-Step = Val.3
Pin X2-Dir = Val.2

Pin Y2-Step = Val.1
Pin Y2-Di r = Val.0

in funktion "void handleCommand()", you can write it so:

if(Val.7==1)
{
Pin X1-Step =1;
}
else
{
Pin X1-Step =1;
}

make this for all pin's, step and dir.
after this, make the delay

delayMicroseconds(50);

now make pin-step low
Pin X1-Step =0;
Pin X2-Step =0;
Pin Y1-Step =0;
Pin Y2-Step =0;

Manfred

Re: Jedicut and Arduino over USB

57
Hi everybody,
I have an arduino board (duemilanove with 328P) and would like to upload this program onto it. When I tried to do it the compiler of arduino complains that
'class HardwareSerial' has no member named 'readBytes'. I checked the commands of arduino and the comand Serial.readBytes() is there. Does anybody have a clue whats wrong with the program, maybe some hex file is missing. I am using arduino-0022
Thanks, Simon

Re: Jedicut and Arduino over USB

59
Manfred,

I think your changes in checkInput may lead to unwanted behaviour. The ReadFile command may block until 2 Bytes are in the input buffer. If only a 'S' is sent by arduino readFile will not return and the plugin will continue to send data. Maybe it is better to make a two step solution like this:
[pre]
void checkInput()
{
int n;
char inBuf;

ReadFile(hCOM, &inBuf, 1, (LPDWORD)((void *)&n), NULL);
if(n=1)
{
switch(inBuf)
{
case 'S': // stop transmission
mcBusy = true;
break;
case 'C': // continue transmission
mcBusy = false;
break;
case 'E': // Limit switch hit TODO
break;
case 'A': // Stop the complete cut TODO
break;
case 'H': // PWM heating value from the machine
ReadFile(hCOM, &inBuf, 1, (LPDWORD)((void *)&n), NULL);
PWM_Value = inBuf;
break;
}
}
}
[/pre]

Martin

Re: Jedicut and Arduino over USB

60
Vincent,

If the motor directions can't be configured within jedicut we need to modify the dll code. There is no need to change the microcontroller code. It can be done in the arduino code (inverting the direction bits), but everybody needs to modify the arduino code to adapt the motor directions to the machine. I will look into the code why the inverse box of the cnc controller settings doesn't work. As soon as I corrected it, I will update the dll in the repository. In the meantime you may rewire your motors, if it is easy possible.

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