chandrapal
Member
Hi all,
I new to here and new to PLC. Basically i am an software engineer.In my project i am using Mitsubishi PLC(CPUModel Q03UDV) is to exchange the data. I am connect with mxComponents software.Below is my code to connect.I am able to connect and exchanging the data successfully,But after 30 mins its automatically disconnecting.
Communication type is Ethernet.
Can anyone please help on this,I am badly stuck here.
private void PLCconnect()
{
int iReturnCode;
int iLogicalStationNumber;
if (PGetIntValue(1, out iLogicalStationNumber) != true)
{
return;
}
axActUtlType1.ActLogicalStationNumber = iLogicalStationNumber;
// axActUtlType1.ActPassword = txt_Password.Text
iReturnCode = axActUtlType1.Open();
if (iReturnCode == 0)
{
//Connected
lblStatus.Text = "Connected";
lblStatus.ForeColor = Color.Green;
// tmrPLC.Start();
}
else
{
//Not Connected
lblStatus.Text = "Not Connected";
lblStatus.ForeColor = Color.Red;
}
}
private bool PGetIntValue(int lptxt_SourceOfIntValue, out int iGottenIntValue)
{
iGottenIntValue = 0;
//Get the value as 32bit integer from a TextBox
try
{
iGottenIntValue = Convert.ToInt32(lptxt_SourceOfIntValue);
}
//When the value is nothing or out of the range, the exception is processed.
catch (Exception exExcepion)
{
MessageBox.Show(exExcepion.Message,
Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
//Normal End
return true;
}
I new to here and new to PLC. Basically i am an software engineer.In my project i am using Mitsubishi PLC(CPUModel Q03UDV) is to exchange the data. I am connect with mxComponents software.Below is my code to connect.I am able to connect and exchanging the data successfully,But after 30 mins its automatically disconnecting.
Communication type is Ethernet.
Can anyone please help on this,I am badly stuck here.
private void PLCconnect()
{
int iReturnCode;
int iLogicalStationNumber;
if (PGetIntValue(1, out iLogicalStationNumber) != true)
{
return;
}
axActUtlType1.ActLogicalStationNumber = iLogicalStationNumber;
// axActUtlType1.ActPassword = txt_Password.Text
iReturnCode = axActUtlType1.Open();
if (iReturnCode == 0)
{
//Connected
lblStatus.Text = "Connected";
lblStatus.ForeColor = Color.Green;
// tmrPLC.Start();
}
else
{
//Not Connected
lblStatus.Text = "Not Connected";
lblStatus.ForeColor = Color.Red;
}
}
private bool PGetIntValue(int lptxt_SourceOfIntValue, out int iGottenIntValue)
{
iGottenIntValue = 0;
//Get the value as 32bit integer from a TextBox
try
{
iGottenIntValue = Convert.ToInt32(lptxt_SourceOfIntValue);
}
//When the value is nothing or out of the range, the exception is processed.
catch (Exception exExcepion)
{
MessageBox.Show(exExcepion.Message,
Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
//Normal End
return true;
}