Hi Guys,
I have a HX750 amplifier which uses UART communication.
I am trying the following code but I am getting garbage.
I would be thankful if someone helps me program the loadcell.
I can't upload the amplifier datasheet since I am new here.
Thanks
#include <SoftwareSerial.h>
SoftwareSerial TRY_Serial(2, 3); // Arduino RX, Arduino TX
byte message[] = {0xB0, 0x31, 0xE1};
char val;
String readString;
void setup() {
Serial.begin(9600);
TRY_Serial.begin(9600);
}
void loop() {
Serial.println(0xB0);
Serial.println(0x31);
Serial.println(0xE1);
//Serial.write(message, sizeof(message));
while (TRY_Serial.available()) {
delay(1000); //small delay to allow input buffer to fill
char c = TRY_Serial.read(); //gets one byte from serial buffer
if (c == ',') {
break;
} //breaks out of capture loop to print readstring
readString += c;
} //makes the string readString
if (readString.length() >10) {
Serial.println(readString); //prints string to serial port out
readString=""; //clears variable for new input
}
}
According to the data sheet posted by @zeus2kx, the baud rate is right, but it looks like what you need to send and receive from the device is not human readable. It doesn't look especially complex, but it likely explains why what you got looked like garbage.
Thanks @wildbill .
I tried to understand the communication between computer and this amplifier (connected through FTDI cable) using a logic analyzer. Please see attached.
Channel 0 is send and channel 2 is received signal.
The data input and output is as described in the datasheet.
You're interpreting the entire data you're getting as a humanly readable string, which it is not.
It is comprised of a 1 byte header, a 4 byte high order integer, and a 1 byte checksum.