模拟PLC数据存储区。

This commit is contained in:
TAO Cheng
2014-11-20 21:37:06 +08:00
parent ed3d4180ea
commit e0883dae59
2 changed files with 21 additions and 3 deletions
@@ -230,7 +230,10 @@ void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedButtonPlcTcpipServerUpdatestate()
void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedButtonPlcTcpipServerUpdatedata()
{
m_UpdateListControl(E_LISTCTRL_CONTROL2DATA);
m_UpdateControls(FALSE);
if (m_DMAddrList==DM_ADDR_DM5000)
{
m_UpdateControls(FALSE);
}
}
//=====================================================================
void CSo7_Util_PLC_TCPIP_SERVER::m_UpdateControls(int _type)
@@ -243,8 +246,8 @@ void CSo7_Util_PLC_TCPIP_SERVER::m_UpdateControls(int _type)
g_pSo7_TCPIP_Server->m_TCPIPServerState._PLCRunningState=static_cast<int>(g_pSo7_TCPIP_Server->DM5000[0]);
for (int i=1;i<=8;i++)
{
DM_Data[0]=(g_pSo7_TCPIP_Server->DM5000[i]>>8) && 0x0ff;
DM_Data[1]=(g_pSo7_TCPIP_Server->DM5000[i]) && 0x0ff;
DM_Data[0]=(g_pSo7_TCPIP_Server->DM5000[i]>>8) & 0x0ff;
DM_Data[1]=(g_pSo7_TCPIP_Server->DM5000[i]) & 0x0ff;
g_pSo7_TCPIP_Server->m_TCPIPServerState._PLCSensorState[(i-1)*2+1]=DM_Data[0];
g_pSo7_TCPIP_Server->m_TCPIPServerState._PLCSensorState[(i-1)*2]=DM_Data[1];
}
@@ -301,6 +304,11 @@ void CSo7_Util_PLC_TCPIP_SERVER::m_UpdateControls(int _type)
//=====================================================================
void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedRadioPlcTcpipServerAddrCcdDm()
{
m_UpdateListControl(E_LISTCTRL_CONTROL2DATA);
if (m_DMAddrList==DM_ADDR_DM5000)
{
m_UpdateControls(FALSE);
}
m_DMAddrList=DM_ADDR_CCD;
m_UpdateListControl(E_LISTCTRL_TITLE);
m_UpdateListControl(E_LISTCTRL_DATA2CONTROL);
@@ -309,6 +317,11 @@ void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedRadioPlcTcpipServerAddrCcdDm()
//=====================================================================
void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedRadioPlcTcpipServerAddrDm5000()
{
m_UpdateListControl(E_LISTCTRL_CONTROL2DATA);
if (m_DMAddrList==DM_ADDR_DM5000)
{
m_UpdateControls(FALSE);
}
m_DMAddrList=DM_ADDR_DM5000;
m_UpdateListControl(E_LISTCTRL_TITLE);
m_UpdateListControl(E_LISTCTRL_DATA2CONTROL);
@@ -317,6 +330,11 @@ void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedRadioPlcTcpipServerAddrDm5000()
//=====================================================================
void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedRadioPlcTcpipServerAddrDm8000()
{
m_UpdateListControl(E_LISTCTRL_CONTROL2DATA);
if (m_DMAddrList==DM_ADDR_DM5000)
{
m_UpdateControls(FALSE);
}
m_DMAddrList=DM_ADDR_DM8000;
m_UpdateListControl(E_LISTCTRL_TITLE);
m_UpdateListControl(E_LISTCTRL_DATA2CONTROL);