Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rs485 port with kc868-a16s.
#1
Photo 
i want to receive 16 bytes data through rs485 port with kc868-a16s.
but the received value is strange.
please le me know what should i check.


#define A16S_RS485_RX  32
#define A16S_RS485_TX  33

void setup() {
  Serial.begin(115200);
  Serial2.begin(19200,SERIAL_8N1,A16S_RS485_RX,A16S_RS485_TX); //A16S
  Serial.println("A16S RS485 OK");
}
void loop() {
  if (Serial2.available() > 0) {
    Serial.print("rs485 received value : ");
    Serial.println(Serial2.read());         
  }
  delay(1000);
}


18:57:15.956 -> rs485 received value : 1
18:57:16.936 -> rs485 received value : 134
18:57:17.966 -> rs485 received value : 160
18:57:19.011 -> rs485 received value : 255
18:57:19.932 -> rs485 received value : 255
18:57:20.964 -> rs485 received value : 255
18:57:21.944 -> rs485 received value : 240
18:57:22.973 -> rs485 received value : 0
18:57:23.950 -> rs485 received value : 0
18:57:24.938 -> rs485 received value : 0
18:57:25.967 -> rs485 received value : 30
18:57:26.948 -> rs485 received value : 165




sending data attached.


Attached Files Image(s)
   
Reply
#2
if you have connect with RS485 device (maybe you are monitor the battery), i suggest you connect a USB-RS485 adapter to see what have received firstly. Then you can compare with the data if received by KC868-A16S.
Reply
#3
(10-12-2024, 12:48 AM)admin Wrote: if you have connect with RS485 device (maybe you are monitor the battery), i suggest you connect a USB-RS485 adapter to see what have received firstly. Then you can compare with the data if received by KC868-A16S.

now ok.
thank you!
Reply
#4
ok, good.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)