You are on page 1of 3

Products: ADAM-5510, ADAM-6022

Abstract:
Using ADAM-5510 to Set the SV Value of ADAM-6022 through a Modbus Address
Description:
Details on how to use an ADAM 5510E/TCP to set the point values on an ADAM-6022
Solution:
For the SV value of Loop0, users can write value to address 41021.
Example:
Set SV=43.605
must write 43605 to address 41021
Set SV=54.321
must write 54321 to address 41021
But the value users want to write to address 41021 is greater than 65535.
The data of address 41020 must to be 1.
Example:
Set SV=84.563
must write 84563-65536=19027 to address 41021
And write 1 to address 41020
Do not usePresetSingleRegto write value into address 41020&41021 separately.
Please usePresetMulRegsset value into address 41020&41021 at the same time.

For the SV value of Loop1, the modbus address is 41020 & 41021
For the SV value of Loop1, the modbus address is 41276 & 41277

Page

void main(void)
{
SOCKET SO_6022;
unsigned char HostData[4];
int nSValue1,nSValue2;
nSValue1 = 84563; //Set SV value of Loop1 to 84.563
nSValue2 = 54321; //Set SV value of Loop2 to 54.321

//Connect to ADAM-6022
if(ADAMTCP_Connect(&SO_6022, ServerIP, Server_Port)<=0)
{
perror("ADAMTCP_Connect()\n");
ADAMTCP_Disconnect(&SO_6022);
return 0;
}

//For Loop0 Address 41020 & 41021------------------------------------------//Decimal 84563 => hexadecimal


14A53
HostData[0]=0x00;
HostData[1]=0x01;
HostData[2]=0x4A;
HostData[3]=0x53;
if(ADAMTCP_PresetMultiRegs(&SO_6022, 3000, 0x01, 1020, 0x02, 4,
HostData)<=0)
{
adv_printf("ADAMTCP_PresetMultiRegs error\n");
ADAMTCP_Disconnect(&SO_6022);
return 0;
}

Page

//For Loop1 Address 41276 & 41277------------------------------------------//Decimal 54321 => hexadecimal


D431
HostData[0]=0x00;
HostData[1]=0x00;
HostData[2]=0xD4;
HostData[3]=0x31;
if(ADAMTCP_PresetMultiRegs(&SO_6022, 3000, 0x01, 1276, 0x02, 4,
HostData)<=0)
{
adv_printf("ADAMTCP_PresetMultiRegs error\n");
ADAMTCP_Disconnect(&SO_6022);
return 0;
}
ADAMTCP_Disconnect(&SO_6022);
}

Page

You might also like