Data Sheet

41
ETHERIO24TCPDATASHEET
private void Ether_Scan_Click(object sender, EventArgs e)
{
//******************************************************
//Send out IO24 via broadcast(255.255.255.255) on port 2424
//******************************************************
//******************************************************
//fill sendBytes buffer with "IO24"
//******************************************************
sendBytes = Encoding.ASCII.GetBytes("IO24");
//******************************************************
//Broadcast UDP packet with IO24 on port 2424
//using the udpClient.send
//******************************************************
udpClient.Send(sendBytes, //buffer
sendBytes.Length, //buffer length
"255.255.255.255", //destination IP
2424); //destination Port
//******************************************************
//All units will respond with IO24
//+ 6 byte MAC address + Version Number
//******************************************************
}
}
}
READPORTDIRECTIONREGISTERSANDPORTVALUES
READPORTADIRECTIONREGISTER
private void Read_DirA_Click(object sender, EventArgs e)
{
//******************************************************
//Command data
//******************************************************
data[0] = Convert.ToByte('!');//"!"
data[1] = Convert.ToByte('a');//"a"
//******************************************************
//Sending out Command Data
//******************************************************
udpClient.Send(data, 2, EtherIP);
//******************************************************
//we expect a response of 3 bytes back from unit
//"!" + "A" + direction value of port A
//this data will be captured
//and then dealt with in ReturnUDPData
//******************************************************
}
READPORTAVALUEREGISTER
private void Read_PORTA_Click(object sender, EventArgs e)
{
//******************************************************
//Command data
//******************************************************
data[0] = Convert.ToByte('a');//"a"
//******************************************************
//Sending out Command Data
//******************************************************
udpClient.Send(data, 1, EtherIP);
//******************************************************
//we expect a response of 2 bytes back from unit
// "A" + port value of port A
//this data will be captured
//and then dealt with in ReturnUDPData
//******************************************************
}
©
2013ElexolPtyLtd Revision1.3