< source code >
This code is also made by VS 2008.
This source code included 'interface_881A' class.
You can get the data easily using the class.
//port open CString strPort = "COM5"; int baudrate = 115200; int data = 8; int parity = 0; int stop = 0;//1; C881A.OpenPort2(strPort,baudrate,data,parity,stop); //request data C881A.SendData(); //data acquisition part //The data is saved in the Command_881A_GetData struct CString str; str.Format("%s", C881A.ReceiveData.DataHeader.c_str()); m_List.AddString(str); str.Format("Head ID : %d", C881A.ReceiveData.HeadID); m_List.AddString(str); str.Format("Head Position : %lf", C881A.ReceiveData.HeadPosition); m_List.AddString(str); str.Format("Head direction : %d", C881A.ReceiveData.Direction); m_List.AddString(str); str.Format("Range : %d", C881A.ReceiveData.Range); m_List.AddString(str); str.Format("Profile Range : %d", C881A.ReceiveData.ProfileRange); m_List.AddString(str); str.Format("Data Byte : %d", C881A.ReceiveData.DataBytes); m_List.AddString(str); m_List10.ResetContent(); for(int i=0; i< 500; ++i) { str.Format("[%d] = %d", i, C881A.ReceiveData.Data[i]); m_List10.AddString(str); } /////////////////////////// //close port C881A.ClosePort();
Thank you.
No comments:
Post a Comment