Variable reading commands question

Section 4.g of the jrk manual lists some variable reading commands, but for the life of me I can’t figure out how to get the jrk to talk to me. I’m using a 12v12 jrk, a linear actuator with a pot, and an Arduino Mega. I have the tx/rx pins on the jrk connected to the Serial1 rx/tx set of pins of the Mega, ground to ground between jrk and Mega, and I can move the actuator back and forth with no problem. When I use the simple protocol to send a variable reading command 0xA5, I get nothing back from the jrk.

this works just fine:
Serial1.print(0xE1, BYTE);
Serial1.print(127, BYTE);

but this gets no response:
Serial1.print(0xA5, BYTE);
The 0xA5 command followed by a loop of Serial1.available() never returns more than 0. Sending a bad command raises the proper error, so the jrk hears me, but it doesn’t talk back.

So, I’m doing something wrong, but I don’t see it. It’s probably something basic, but nothing I try seems to work.

Is there supposed to be a data byte after the 0xA5 command byte?

Hello. I just tested the 0xA5 TTL serial command on a jrk 12v12 and it worked fine for me.

Here are some things I suggest trying:

  • Double check the connection from the Jrk’s TX to the Arduino’s RX.
  • Use Serial2 or Serial3 instead of Serial1.
  • Disconnect the jrk and see if you can successfully send a byte from Serial2 or Serial3 to Serial1.
  • Simplify your Arduino program as much as possible post it here, along with your jrk 12v12 saved configuration file.

Do you have an oscilloscope?

–David

Thank you sir! It’s amazing when it is something simple that does the trick. I added a 2nd Jrk 12v12 and put it on Serial2 using the same settings on both Jrks and the same Arduino code for Serial2… and it worked! It was Serial1 that just didn’t want to cooperate for whatever reason. Serial1 won’t reply, but Serial2 talks back. Why didn’t it work on Serial1? Would SoftwareSerial ever run into a similar issue? I was using a Mega just b/c I have a number of them lying around.

for what it’s worth, here is the simple Arduino code that would not talk on Serial1, but seems to work fine on Serial2:
//move 2 actuators out to their forward stop
Serial1.print(0xE1, BYTE);
Serial1.print(127, BYTE);
Serial2.print(0xE1, BYTE);
Serial2.print(127, BYTE);

//query Serial2 for the feedback
Serial2.print(0xA5, BYTE);
if (Serial2.available()>=2) //wait until we’ve got at least 2 bytes hanging around
{
byLowByte = Serial2.read();
byHighByte = Serial2.read();
uiFeedback = word(byHighByte, byLowByte); //slap em together
Serial.println(uiFeedback, DEC); //print it out for fun
}

I’m glad you got it working!

Probably your Arduino Mega’s RX1 line is just broken. IO lines can break, and when they do it affects any library that tries to use that line.

–David