什么是上位機_上位機軟件介紹
{
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發(fā)送
/// /summary>
/// param name=Zuohao>座號 2字節/param>
/// param name=mingling>命令字加ASC碼 n字節/param>
public void WriteToArm(byte[] Zuohao, byte[] minglingandASC)
{
if (connection == Indicator.Connected)//在與ARM保持連接的情況下可寫(xiě)
{
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://dyxdggzs.com/article/185790.htm
另外數據收發(fā)還需要協(xié)議,和嵌入式網(wǎng)關(guān)通信的指令和協(xié)議定制如下:
因此數據量較少,協(xié)議也就比較簡(jiǎn)單,此協(xié)議在發(fā)送接收時(shí)用PPP封裝。顯示部分使用C#編寫(xiě)的運行于Windows .Net Framework 上的窗體應用程序,根據實(shí)際需求,對每個(gè)實(shí)驗臺狀態(tài)的顯示使用ListView控件實(shí)現,當出現異常情況,或實(shí)驗臺出現警告、求助信號時(shí),ListView的相應字段文字會(huì )通過(guò)改變顏色來(lái)提醒監視人員,監視人員還可以通過(guò)一個(gè)文字發(fā)送窗體來(lái)向LED屏發(fā)送要顯示的文字??傊缑媲逦庇^(guān),簡(jiǎn)便易用。
評論