RS485 Wind Speed and Wind Direction changing address

userHead Carson.Fisk 2022-10-17 08:51:45 1700 Views5 Replies

Hi,

 

I am having a hard time reading the sensor after changing the address. I also cant change the address to anything other than slave address =0x03. When I use address =0x03 I get the slave response 00 10 10 00 00 01 04 D8 as expected according to the documentation. Indicating that the modification was successful. However now I cant read wind direction data.

 

I changed the reference frame to the new address.  {0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x39}

 

Before I attempted to change the address and I was using {0x02, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x39}; it was working well.

 

 

Please find the code that I am using to change the address  below:

byte address_ref_frame[] = {0x00, 0x10, 0x10, 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0xFA, 0x00};byte buf[11];

void setup(){   Serial.begin(9600);   Serial.println("Start");}

void loop(){//    Serial.println("-----------------------------------------------");//    //    Serial.println("Send");   delay(1000);   Serial.write(address_ref_frame, sizeof(address_ref_frame));   Serial.flush();   Serial.readBytes(buf, 11);   delay(1000);

   Serial.println("Buffer");   Serial.println(buf[0], HEX);   Serial.println(buf[1], HEX);   Serial.println(buf[2], HEX);   Serial.println(buf[3], HEX);   Serial.println(buf[4], HEX);   Serial.println(buf[5], HEX);   Serial.println(buf[6], HEX);   Serial.println(buf[7], HEX);   Serial.println(buf[8], HEX);   Serial.println(buf[9], HEX);   Serial.println(buf[10], HEX);   Serial.println(buf[11], HEX);      Serial.flush();   delay (600000);}

 

 

 

Please find the code that I am using to read the sensor  below:

byte wind_direction_ref_frame[] = {0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x39};byte buf[8];int wind_direction;static const char *direction_list[] = {"North", "Northeast by North", "Northeast", "Northeast by East", "East", "Southeast by East", "Southeast", "Southeast by South", "South", "Southwest by South", "Southwest", "Southwest by West", "West", "Northwest by West", "Northwest", "Northwest by North", "Invalid reading"};  

 

void setup(){   Serial.begin(9600);   Serial.println("Start");}

void loop(){

   Serial.println("-----------------------------------------------");   Serial.println("Sending read request");   delay(2000);   Serial.write(wind_direction_ref_frame, sizeof(wind_direction_ref_frame));   Serial.flush();   Serial.readBytes(buf, 8);   delay(1000);

   wind_direction = buf[3], DEC;   Serial.println("");   Serial.print("Wind Direction: ");   Serial.println(direction_list[wind_direction]);

   Serial.println("Buffer");   Serial.println(buf[0], HEX);   Serial.println(buf[1], HEX);   Serial.println(buf[2], HEX);   Serial.print(buf[3], HEX);   Serial.println(" !");   Serial.println(buf[4], HEX);   Serial.println(buf[5], HEX);   Serial.println(buf[6], HEX);

   Serial.flush();   delay (3000);}

 

 

Many thanks

2022-10-18 13:02:48

THIS IS AMAZING! It works! Thank you very much. I spent weeks try all sorts of things :( 

 

Could you please point me in the direction of information on how to get this answer for myself?  Suppose I want to change the address to 0x04 or something.

 

Knowing the write questions to ask can be the biggest challenge.

 

 

Thank you

userHeadPic Carson.Fisk
jenna wrote:

You can learn some protocol checksum related information.

 

2022-10-18 16:03:18
Carson.Fisk wrote:

Perfect. Thank you.

2022-10-18 16:26:52
2 Replies
2022-10-17 14:35:33

Please modify the check digit of the command: 03 03 00 00 00 01 85 E8

userHeadPic jenna
Carson.Fisk wrote:

THIS IS AMAZING! It works! Thank you very much. I spent weeks try all sorts of things :( 

 

Could you please point me in the direction of information on how to get this answer for myself?  Suppose I want to change the address to 0x04 or something.

 

Knowing the write questions to ask can be the biggest challenge.

 

 

Thank you

2022-10-18 13:11:36
1 Replies