Forum >sen0604 address change
General

sen0604 address change

userHead luk.fox 2024-12-16 20:46:58 894 Views3 Replies

Hi there is no documentation regarding address update of SEN0604/SEN0601/SEN0602.

What frame structure is needed for function code 6 ? 

And how to calculate CRC ( if needed to be added in the end )with which seed ?

Basically I wan to connect all the above mentioned sensors on one bus and that's why I need to change address of the sensors.


Thanks a lot for your reply in advance!

2024-12-17 03:21:40

| Slave Address | Function Code | Register Address | Data | CRC |


Format ^^

| 0x01 | 0x06 | 0x07 0xd0 | 0x00 0x03 | 0xA0 0xB1 |


Slave Address = 1 (default address)
Function Code = 6

Register Address  = 0x07d0
new address = 0x0003
CRC = calculated from below function appended as followed

// ComWriteAdress[6] = (crc & 0xff00) >> 8;

// ComWriteAdress[7] = (crc & 0x00ff);

code for CRC from the example
unsigned int CRC16_2(unsigned char *buf, int len)

{

unsigned int crc = 0xFFFF;

for (int pos = 0; pos < len; pos++)

{

crc ^= (unsigned int)buf[pos];

for (int i = 8; i != 0; i--)

{

if ((crc & 0x0001) != 0)

{

crc >>= 1;

crc ^= 0xA001;

}

else

{

crc >>= 1;

}

}

}

Solved by my self
 

userHeadPic luk.fox
2024-12-16 22:16:31

0x7d0 is the R/W location which can be updated , I need to know the frame for format for that 

userHeadPic luk.fox
2024-12-16 21:19:45

I cannot see any way to change the address.

https://wiki.dfrobot.com/RS485_Soil_Sensor_Temperature_Humidity_EC_PH_SKU_SEN0604

Let's see what dfrobot has to say. 

userHeadPic lia.ifat