简体   繁体   English

遥控gareco x系列

[英]Remote control gareco x series

I am trying to develop an app for a Mettler-Toledo Garvens GmbH "X Series" checkweigher with GARECO installed. 我正在尝试为安装了GARECO的Mettler-Toledo Garvens GmbH“X系列”自动检重秤开发应用程序。

What is a checkweigher? 什么是检重秤? The weigher is the last part of a production line and measures the product weight, if it has a weight within the normal parameters of the product specifics. 称重器是生产线的最后一部分,如果产品重量在产品细节的正常参数范围内,则测量产品重量。 The device has an internal memory, and you can load your product specification per product to the system and easily change the product from the device screen. 该设备具有内部存储器,您可以将每个产品的产品规格加载到系统中,并轻松地从设备屏幕更改产品。

What is GARECO? 什么是GARECO? The remote control of GARVENS checkweighers was given the name "GARECO" which is the abbreviation of Garvens Remote Control. GARVENS自动检重秤的遥控器名为“GARECO”,是Garvens Remote Control的缩写。

Remote control instructions can be transmitted by an external PC via the serial interface to the weighing terminal, with all remote-control actions being effected by the PC. 远程控制指令可以由外部PC通过串行接口传输到称重终端,所有远程控制操作都由PC实现。 The checkweigher reacts to instructions which it has recognized and releases the corresponding action. 检重秤对其已识别的指令作出反应并释放相应的动作。 The instructions consist of ASCII strings, each of which ends with the characters CR and LF. 指令由ASCII字符串组成,每个字符串以字符CR和LF结尾。

What is the goal of our app? 我们的应用程序的目标是什么? When the production line change the product we like change the checkweigher product for the measurement. 当生产线改变我们喜欢的产品时,改变检重秤产品进行测量。

Further info can be found in the following link, if you like 😊 如果您喜欢😊,可在以下链接中找到更多信息

https://www.prosoft-technology.com/content/download/2886/22284/version/1/file/gareco_engl_Version+108.pdf https://www.prosoft-technology.com/content/download/2886/22284/version/1/file/gareco_engl_Version+108.pdf

What are we using? 我们在用什么?

• .NET 4.5, •.NET 4.5,

• Windows 10, •Windows 10,

• TCP/IP (connected directly through the ethernet cable) •TCP / IP(通过以太网电缆直接连接)

Test: 测试:

As instructed above, the device should accept instruction from PC. 如上所述,设备应接受来自PC的指令。 We managed to establish a connection with the device via ethernet but as we send instructions there is no response from the device. 我们设法通过以太网与设备建立连接,但是当我们发送指令时,设备没有响应。 Below, you can see the code we used. 下面,您可以看到我们使用的代码。

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }


    TcpClient client = new TcpClient();

    private void button2_Click(object sender, EventArgs e)
    {

        client.Connect("192.168.0.1", 23);
    }

    string _infoFB = "FB_INFO(CR)(LF)";

    byte[] p;

    private void button1_Click(object sender, EventArgs e)
    {
        client.Close();
    }



    private void button3_Click(object sender, EventArgs e)
    {

        p = Encoding.ASCII.GetBytes(_infoFB);
        NetworkStream ntstream = client.GetStream();

        if (ntstream.CanWrite)
        {
            ntstream.Write(p, 0, p.Length);

                byte[] myReadBuffer = new byte[1024];
                StringBuilder myCompleteMessage = new StringBuilder();
                int numberOfBytesRead = 0;
                do
                {
                    numberOfBytesRead = ntstream.Read(myReadBuffer, 0, myReadBuffer.Length);
                    myCompleteMessage.AppendFormat("{0}", Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
                }
                while (ntstream.DataAvailable);

                foreach (var item in myCompleteMessage.ToString())
                {
                    listBox1.Items.Add(item);
                }
        }

        if (ntstream.CanRead)
        {
            if (ntstream.DataAvailable)
            {
                byte[] myReadBuffer = new byte[1024];
                StringBuilder myCompleteMessage = new StringBuilder();
                int numberOfBytesRead = 0;
                do
                {
                    numberOfBytesRead = ntstream.Read(myReadBuffer, 0, myReadBuffer.Length);
                    myCompleteMessage.AppendFormat("{0}", Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
                }
                while (ntstream.DataAvailable);



                foreach (var item in myCompleteMessage.ToString())
                {
                    listBox1.Items.Add(item);
                }
            }
            else
            {
                MessageBox.Show("Sorry. \n You cannot read from this NetworkStream.");
            }

        }

    }
    string recivedPulse;
    private void button4_Click(object sender, EventArgs e)
    {
        p = Encoding.ASCII.GetBytes(_infoFB);
        recivedPulse = Encoding.ASCII.GetString(p, 0, p.Length);
        listBox1.Items.Add(recivedPulse);
    }
}

} }

The message should actually be "FB_INFO\\r\\n" , not "FB_INFO(CR)(LF)" . 该消息实际上应为"FB_INFO\\r\\n" ,而不是"FB_INFO(CR)(LF)" CR and LF are abbreviations for "carriage-return" and "line-feed" which are 2 special control bytes. CRLF是“回车”和“换行”的缩写,它们是2个特殊控制字节。

The response of the device should look like FB_INF 1 SR or similar. 设备的响应应该类似于FB_INF 1 SR或类似物。 The characters S, R and possible others (eg G and M) refer to the available licenses of the device. 字符S,R和可能的其他字符(例如G和M)指的是设备的可用许可证。

For more information you can also contact the company Objective , which offers an excellent device driver for Mettler/Garvens and other devices (written in Java). 有关更多信息,您还可以联系公司Objective ,它为Mettler / Garvens和其他设备(用Java编写)提供了出色的设备驱动程序。

Also please note that there is a more recent version of the protocol description: 1.10 另请注意,有一个更新版本的协议说明:1.10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM