Serial Data communication Arduino

2019-09-05 11:33发布

问题:

I currently am trying to read the serial output from a small capacitance meter(model DN060-02v04 from JYETECH). I have the arduino UNO set up to read the meter output. I do get data, but it is not readable and does not correspond to the format outlined in the manual. My baud rates match at 38400bps. The meter claims a 8-N-1 configuration. I'm using the SerialSoftware example in the Arduino Library to read it.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()  
{
  Serial.begin(38400);
  Serial.println("Begin");
  mySerial.begin(38400);
}

void loop() // run over and over
{
 if (mySerial.available())
    Serial.write(mySerial.read());
 if (Serial.available())
    mySerial.write(Serial.read());
}

This is what i get:

3M$¦Ò)ºÁÁ¹aà3PL¦©ÊÁÁ¹eà3PL&rÂÉÁa\`à
3&ÓrÒÍÁa\`à
3PL&râÕÁa\bà
3M$¦+rÊÙÁa\dà3PL&+rÚáÁa\`à
3Ji¹ÁåA``\1¸3PL&SÉQÁÁ¹aà3N$¦SÉÁÁ¹eà3PL&S)Éi¢ÁÁ¹eà3L$¦S+Éu²ÁÁ¹aà
3PL&SKÉÚÁÁyaà
3&ÓSSÉIÊÁÁ¹aà3PL&+iÉ    ÁÁ¹eà
3M$¦SkÉAÒÁÁ¹eà
3PL&iÉÚÁÁ¹eà
3JiÒ¹ÉÕA``\0¸3PL&SÉaºÁÁ¹aà3N$¦S«É   ÂÁÁ¹eà3PL&S«ÉQÂÁÁ9eà
3L$¦S«ÉÁÁ¹aà3PL&3ÉÉ)ÚÁÁ¹aà
3&ÓSÓÉi¢ÁÁ¹aà3PL&SëɲÁÁ¹eà3M$¦SëÉQºÁÁ¹ià3PL&SëÉÊÁÁ¹eà3Ii
¢Æá¹Ñe@``®¸Ã3PL&SrâÉÁa\`à
3N$¦S+rÊÑÁa\bà3PL&#)rÚÕÁa\bà
3L$¦ÉÚÁÁ9aà
3PL&ÉÂÁÁ¹aà3ÓS  É©ÁÁ¹aà3PL&+É1ÁÁ¹eà3M$¦
+ÉqÁÁ¹ià3PL&KÉ)ªÁÁ¹aà3JiʹÕÙA``\0¸3PL&IÉ©ÂÁÁ¹aà
3N$¦kÉ1ÊÁÁ¹eà
3PL&SiÉÁÁ¹ià3L$¦ÉIÒÁÁ¹aà
3PL&KÉÉâÁÁ¹aà
3&Ó³É   ²ÁÁ¹aà3PL&«ÉEºÁÁ¹eà3M$¦«É
ÊÁÁ¹ià3PL&ËÉ1ÁÁ¹aà3JiÚ¹ÝÉA``\1¸3PL&SéÉ)ÁÁ¹aà3N$¦ëÉ©ÊÁÁ9aà