什么是上位機_上位機軟件介紹
{
byte[] frame = new byte[5];
frame[0] = 0x05;
Array.Copy(Zuohao, 0, frame, 1, 2);
frame[3] = mingling;
byte temp = 0;
foreach (byte item in frame)
temp += item;
frame[4] = (byte)(0 - temp);
byte[] frametosend = PPP.Encode(frame);
Console.WriteLine(BitConverter.ToString(frametosend));
try { stream.Write(frametosend, 0, frametosend.Length); }
catch (Exception ex) { }
}
}
/// summary>
/// 向ARM發送
/// /summary>
/// param name=Zuohao>座號 2字節/param>
/// param name=mingling>命令字加ASC碼 n字節/param>
public void WriteToArm(byte[] Zuohao, byte[] minglingandASC)
{
if (connection == Indicator.Connected)//在與ARM保持連接的情況下可寫
{
byte[] frame = new byte[4+minglingandASC.Length];
frame[0] = (byte)frame.Length;
Array.Copy(Zuohao, 0, frame, 1, 2);
Array.Copy(minglingandASC,0,frame,3,minglingandASC.Length);
byte temp = 0;
foreach (byte item in frame)
temp += item;
frame[frame.Length-1] = (byte)(0 - temp);
byte[] frametosend = PPP.Encode(frame);
Console.WriteLine(BitConverter.ToString(frametosend));
try { stream.Write(frametosend, 0, frametosend.Length); }
catch (Exception ex) { }
}
}本文引用地址:http://www.104case.com/article/185790.htm
另外數據收發還需要協議,和嵌入式網關通信的指令和協議定制如下:
因此數據量較少,協議也就比較簡單,此協議在發送接收時用PPP封裝。顯示部分使用C#編寫的運行于Windows .Net Framework 上的窗體應用程序,根據實際需求,對每個實驗臺狀態的顯示使用ListView控件實現,當出現異常情況,或實驗臺出現警告、求助信號時,ListView的相應字段文字會通過改變顏色來提醒監視人員,監視人員還可以通過一個文字發送窗體來向LED屏發送要顯示的文字。總之界面清晰直觀,簡便易用。
評論