附加极点显示以在.net窗口中显示 [英] Attaching Pole Display for display in .net window applicatin

查看:60
本文介绍了附加极点显示以在.net窗口中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在使用.NET中的窗口应用程序.
我想附加极点显示"以显示数据.我想知道应该在哪里编写以下代码以在Pole Display上显示消息.

Hello everybody

I am working with a window application in .NET.
I would like to attach Pole Display to display data. I would like to know where should write following code to display message at Pole Display.

class PoleDisplay : SerialPort
{
    private SerialPort srPort = null;

    public PoleDisplay()
    {
        try
        {
            srPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
            if (!srPort.IsOpen) srPort.Open();
        }
        catch { }
    }

    ~PoleDisplay()
    {
        srPort.Close();
    }

    //To clear Display.....
    public void ClearDisplay()
    {
        srPort.Write("                    ");
        srPort.WriteLine("                    ");

    }

    //Display Function 
    //'line' 1 for First line and 0 For second line
    public void Display(string textToDisplay, int line)
    {
        if (line == 0)
            srPort.Write(textToDisplay);
        else
            srPort.WriteLine(textToDisplay);
    }

}

推荐答案

Dev Kashyap每个极点显示或简单模式公平显示都有其独特的命令集,我不确定上述显示方法是否适用于您的极点是否显示.如果它正常工作,则只需编写此代码以在极点显示器上显示消息

Dev Kashyap every Pole Display or simple pattern fair display has its unique command set i am not sure that above display method is working for your Pole Display or not. If it is working properly then simply write this code to display message on Pole Display

//This code will display hello world on your pole display
//Hello on first line and World on second line
PoleDisplay objPoleDisplay=new PoleDisplay(); 
objPoleDisplay.ClearDisplay();
objPoleDisplay.Display("Hello",0);
objPoleDisplay.Display("World",1);


这篇关于附加极点显示以在.net窗口中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆