My setup is 2 actuators with feedback connected to two JRK21V3. TX lines from JRK’s feed into 74LS08 Quad 2-Input AND Gate. Output from AND gate and RX lines from JRK’s are connected to Arduino. When not daisy chained the modules work fine individually and I am able to transmit and receive serial data without a problem. With the AND gate connected I can apparently receive transmissions from one of the JRK units, but not the second. My test code is attached. My output from the test code is attached. The output from actuator 12 matches the second reported position from actuator 11 which seems odd. So my apparent problem statement is I cannot receive position feedback from actuator 12. For reference both actuators accept the move statements fine and respond accordingly.
My code
[code]#define RX_pin 4
#define TX_pin 6
#include <SoftwareSerial.h>
SoftwareSerial mySerial(RX_pin, TX_pin); word target = 0;
int end_position;
char response[2];
void Move(byte device, int x) {
word target = x; //only pass this ints, i tried doing math in this and the remainder error screwed something up
mySerial.write(0xAA); //tells the controller we’re starting to send it commands
mySerial.write(device); //This is the pololu device # you’re connected too that is found in the config utility(converted to hex). I’m using #11 in this example
mySerial.write(0x40 + (target & 0x1F)); //first half of the target, see the pololu jrk manual for more specifics
mySerial.write((target >> 5) & 0x7F); //second half of the target, " " "
}
int GetRawPosition(byte device){
int rpos = 0;
mySerial.write(0xAA); //tells the controller we’re starting to send it commands
mySerial.write(device);
mySerial.write(0xA5); //raw feedback
mySerial.readBytes(response,2);
rpos = word(response[1],response[0]);
return rpos;
}
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
Serial.println(“Setup Complete “);
Serial.println(””);
}
void loop() {
Serial.println(" “);
Serial.println(“Actuator 11 top of loop”);
Move(0xB, 100);
delay (5000);
end_position = GetRawPosition(0xB);
Serial.print(end_position);
Serial.print(” 100?, “);
Move(0xB, 1000);
delay (5000);
end_position = GetRawPosition(0xB);
Serial.print(end_position);
Serial.print(” 1000?, “);
Serial.println(” “);
Serial.println(“Actuator 12 starting”);
Move(0xC, 200);
target = 200;
delay (5000);
end_position = GetRawPosition(0xC);
Serial.print(end_position);
Serial.print(” 200?, “);
Move(0xC, 3000);
delay (5000);
end_position = GetRawPosition(0xC);
Serial.print(end_position);
Serial.print(” 3000?, ");
}
[/code]
My output
Setup Complete
Actuator 11 top of loop
193 100?, 990 1000?,
Actuator 12 starting
990 200?, 991 3000?,
Actuator 11 top of loop
196 100?, 990 1000?,
Actuator 12 starting
991 200?, 990 3000?,
Actuator 11 top of loop
192 100?, 990 1000?,
Actuator 12 starting
990 200?, 990 3000?,