| | |
| | | #include <SetupAPI.h>
|
| | | #include "../MyLib/Functions.hpp"
|
| | | #include "../MyLib/UI_Func/UI_Func.hpp"
|
| | | #include "CAnsiParser.h"
|
| | | #include "CDataParser1.h"
|
| | | #include "AnsiParser.h"
|
| | | #include "DataParser1.h"
|
| | | #include "KLink.h"
|
| | | //#include "../MyLib/SerialCom/SerialCom.hpp"
|
| | | #include <Dbt.h>
|
| | | #include "CDialogCommSet1.h"
|
| | | #include "CDialogSysRegSet.h"
|
| | | #include "CDialogStatusShow.h"
|
| | | #include "CDialogInfoDisplay.h"
|
| | | #include "DialogCommSet1.h"
|
| | | #include "DialogSysRegSet.h"
|
| | | #include "DialogStatusShow.h"
|
| | | #include "DialogInfoDisplay.h"
|
| | |
|
| | | #include "CDialogCoilMon.h"
|
| | | #include "CDialogDataMon.h"
|
| | | #include "DialogCoilMon.h"
|
| | | #include "DialogDataMon.h"
|
| | |
|
| | | #include "CDialogProgress.h"
|
| | | #include "CDialogEventLog.h"
|
| | | #include "CDialogDateTime.h"
|
| | | #include "CDialogForceIO.h"
|
| | | #include "DialogProgress.h"
|
| | | #include "DialogEventLog.h"
|
| | | #include "DialogDateTime.h"
|
| | | #include "DialogForceIO.h"
|
| | | #include "HvSerialPort.h"
|
| | |
|
| | | #ifdef _DEBUG
|
| | |
| | | // ON_BN_CLICKED(IDC_BUTTON11, &CMTerm2CommDevView::OnBnClickedButton11)
|
| | | ON_BN_CLICKED(IDC_BUTTON12, &CMTerm2CommDevView::OnBnClickedButton12)
|
| | | ON_BN_CLICKED(IDC_BUTTON13, &CMTerm2CommDevView::OnBnClickedButton13)
|
| | | ON_BN_CLICKED(IDC_BUTTON31, &CMTerm2CommDevView::OnBnClickedButton31)
|
| | | ON_BN_CLICKED(IDC_BUTTON2, &CMTerm2CommDevView::OnBnClickedButton2)
|
| | | ON_BN_CLICKED(IDC_BUTTON3, &CMTerm2CommDevView::OnBnClickedButton3)
|
| | | END_MESSAGE_MAP()
|
| | |
|
| | |
|
| | |
| | | // s1.AppendFormat(_T("Total S %8d \r\nTotal R %8d \r\n"), MySerialCom1.TotalSendBytes, MySerialCom1.TotalRecvBytes);
|
| | | s1 += intToString(pDoc->myHvSerialPort1.TotalRecvBytes) + _T("\r\n");
|
| | | // stepCount++;
|
| | | static double LastCalTime = GetTimemS();
|
| | |
|
| | | static double LastCalTime = 0;
|
| | | double thisTime = GetTimemS();
|
| | | if (thisTime - LastCalTime > 500)
|
| | | {
|
| | |
| | | }
|
| | | s2.Append(_T("\r\n"));
|
| | | }
|
| | | s2.Append(_T("\r\n"));
|
| | |
|
| | | for (int i = 8; i < (nCount + 15) / 16; i++)
|
| | | {
|
| | | s2.AppendFormat(_T("%3X: "), i * 16);
|
| | | for (int j = 0; j < 16; j++)
|
| | | {
|
| | | s2.AppendFormat(_T("%02X"), pDoc->MyKLink1.MEM.SDB[i * 16 + j]);
|
| | | if (j == 7) { s2.Append(_T(" ")); }
|
| | | else { s2.Append(_T(" ")); }
|
| | | }
|
| | | s2.Append(_T("\r\n"));
|
| | | }
|
| | |
|
| | | // s2.AppendFormat(_T("%d\r\n"), pDoc->MyKLink1.MEM.SDD[5]);
|
| | |
|
| | | nCount = 32;
|
| | |
| | | //DrawPic1();
|
| | | // MyLogger1.UpdateLogDisplay(0);
|
| | | UpdateDataDisplay();
|
| | | UpdateLEDDisplay();
|
| | | }
|
| | | else if (nIDEvent == 3)
|
| | | {
|
| | |
| | | {
|
| | | DataType = pDoc->MyKLink1.KLDataTypeWX;
|
| | | DCount = 16;
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.WXB[DAddr]);
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.WXB[DAddr]);
|
| | | nCount = DCount;
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | {
|
| | |
| | | {
|
| | | DataType = pDoc->MyKLink1.KLDataTypeWY;
|
| | | DCount = 16;
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.WYB[DAddr]);
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.WYB[DAddr]);
|
| | | nCount = DCount;
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | {
|
| | |
| | | {
|
| | | DataType = pDoc->MyKLink1.KLDataTypeWR;
|
| | | DCount = 32;
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.WRB[DAddr]);
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.WRB[DAddr]);
|
| | | nCount = DCount;
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | {
|
| | |
| | | {
|
| | | DataType = pDoc->MyKLink1.KLDataTypeDT;
|
| | | DCount = 96;
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.DTB[DAddr]);
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.DTB[DAddr]);
|
| | | nCount = DCount;
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | {
|
| | |
| | | DataType = pDoc->MyKLink1.KLDataTypeSDT;
|
| | | ByteAddr = nBlock * 128;
|
| | | DCount = 128;
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, ByteAddr, &pDoc->MyKLink1.MEM.SDB[ByteAddr]);
|
| | | res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, ByteAddr, DCount, &pDoc->MyKLink1.MEM.SDB[ByteAddr]);
|
| | | nCount = DCount;
|
| | | if (res == pDoc->MyKLink1.KL_OK)
|
| | | {
|
| | |
| | | nStep++;
|
| | | // if (nStep == 2) { nStep = 3; }
|
| | | if (nStep > 4) { nStep = 0; }
|
| | | MonitorSuccessCount += nThisSuccessCount;
|
| | | MonitorFailCount += nThisFailCount;
|
| | | if (nThisFailCount == 0)
|
| | | {
|
| | | MonitorSuccessCount++;
|
| | |
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | MonitorFailCount++;
|
| | |
|
| | | }
|
| | | }
|
| | | return 0;
|
| | |
| | | // s3.Format("%d %d ",recv2length,wCount2);AppendText(s3);
|
| | |
|
| | | s1.Format(_T("R %d(Try %d %d)=%d->"), dNumtoRead, nTryCount, nTryCount2, wCount2);
|
| | | for (DWORD i = 0; i < 8 && i < wCount2; i++)
|
| | | for (DWORD i = 0; i < 16 && i < wCount2; i++)
|
| | | {
|
| | | s1.AppendFormat(_T("%02X "), recv1[i]);
|
| | | }
|
| | |
| | |
|
| | |
|
| | | }
|
| | | enum enStat
|
| | | {
|
| | | normal=0,
|
| | | setchn=1,
|
| | | setvalue=2,
|
| | | setonoff=3,
|
| | |
|
| | | };
|
| | | int nStat = 0;
|
| | | int ntimecount = 0;
|
| | | #define MaxTimeOut 50
|
| | |
|
| | | int nCurChn = 0;
|
| | | int nValue[4] = { 100,200,300,400 };
|
| | | int LedOn[4] = { 0 };
|
| | | int flickTimer = 0;
|
| | | int CMTerm2CommDevView::UpdateLEDDisplay()
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | flickTimer++;
|
| | | int bHide = 0;
|
| | | if ((flickTimer & 0x7) > 3) { bHide = 1; }
|
| | |
|
| | | CString s1;
|
| | | s1 = _T("0000");
|
| | |
|
| | | s1.Format(_T("%d%03d"), nCurChn, nValue[nCurChn]);
|
| | | if (nStat == setchn && bHide)
|
| | | {
|
| | | s1.Format(_T(" %03d"), nValue[nCurChn]);
|
| | | }
|
| | | if (nStat == setvalue && bHide)
|
| | | {
|
| | | s1.Format(_T("%d "),nCurChn);
|
| | | }
|
| | | if (nStat == setonoff && bHide)
|
| | | {
|
| | | s1.Format(_T(" "), nCurChn);
|
| | | }
|
| | |
|
| | | SetDlgItemText(IDC_EDIT31, s1);
|
| | |
|
| | | s1.Format(_T("%d %d %d %d"), LedOn[0], LedOn[1], LedOn[2], LedOn[3]);
|
| | | SetDlgItemText(IDC_EDIT32, s1);
|
| | |
|
| | | ntimecount++;
|
| | | if (ntimecount >= MaxTimeOut) { nStat = normal; }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | void CMTerm2CommDevView::OnBnClickedButton31()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | ntimecount = 0;
|
| | | if (nStat == setchn)
|
| | | {
|
| | | nCurChn++;
|
| | | if (nCurChn >= 4) { nCurChn = 0; }
|
| | | }
|
| | | if (nStat == setvalue)
|
| | | {
|
| | | nValue[nCurChn] ++;
|
| | | if (nValue[nCurChn] > 999) { nValue[nCurChn] = 999; }
|
| | | }
|
| | | if (nStat == setonoff)
|
| | | {
|
| | | LedOn[nCurChn] =1;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | void CMTerm2CommDevView::OnBnClickedButton2()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | ntimecount = 0;
|
| | | if (nStat == setchn)
|
| | | {
|
| | | nCurChn--;
|
| | | if (nCurChn <0) { nCurChn = 3; }
|
| | | }
|
| | | if (nStat == setvalue)
|
| | | {
|
| | | nValue[nCurChn] --;
|
| | | if (nValue[nCurChn] <= 0) { nValue[nCurChn] = 0; }
|
| | | }
|
| | | if (nStat == setonoff)
|
| | | {
|
| | | LedOn[nCurChn] = 0;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | void CMTerm2CommDevView::OnBnClickedButton3()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | ntimecount = 0;
|
| | | if (nStat == normal)
|
| | | {
|
| | | nStat = setchn;
|
| | | } else if (nStat == setchn)
|
| | | {
|
| | | nStat = setvalue;
|
| | | } else if (nStat == setvalue)
|
| | | {
|
| | | nStat = setonoff;
|
| | | }
|
| | | else if (nStat == setonoff)
|
| | | {
|
| | | nStat = setchn;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|