Writing to the uber-cool 634XE USB series from C#, .Net

slickityslack

New member
Hi,

Love the external usb products; they look great. How do I create a C# app to control output to the screen over the USB interface? Can you give me the "3 steps" to controlling the LCD from C# over USB?

Do you have a DLL or control to connect to the LCD over a USB connection?? I'm looking for samples prior to making a purchase.

Thanks very much. I have reviewed the forums, but find that much of the content is convoluted. Have you considered writing some tech docs/samples that demo usage of the products in popular languages/environments and putting them all in one place?

Thanks very much.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Tech

Administrator
We have examples in ALL the popular languages. Both C and C++


Seriously though, I have never looked at C#. If you can find an example that will write data to a COM port, it should be cake to get it to talk to a CFA-634.

Is there some kind of example in C# that will open a COM port?
 

slickityslack

New member
Definitely. I can get a sample to open a COM port in C#

I guess in general, I'm just looking for any documentation you've got in general for working with the 634XE (from any language) and then any half examples of somebody using it from a .Net language (VB.NET or C#).

Do you suggest making direct COM port access to the LCD? or do you have any interim DLLs to simplify things?
 

gschizas

New member
Once upon a time Microsoft had released VB.NET Resource Kit, which included "Sax.net Communications Community Edition", which is a .NET component used to communicate with the COM ports. I think that if I dig deep enough in my projects I can find a sample project. In the meantime, check out this page which features a CF-633, along with a good starting sample. Ok, so it's VB and not C#, but that shouln't stop you :)
 

Hong

New member
Thanks for this thread that tells me all I need to know. I did not know that programming the LCD is simply writing commands or text to a serial port which I program frequently.

Hanselman always writes good code. I think the following function and enum definition should be reused by everyone programming the LCD in C#:
Code:
        public void Write(byte[] bytes)
        {
            if (bytes == null) throw new ArgumentNullException("bytes");
            port.Write(bytes, 0, bytes.Length);
        }


    public enum Command : byte
    {
        CursorHome = 1,
        HideDisplay = 2,
        RestoreDisplay = 3,
        HideCursor = 4,
        ShowUnderlineCursor = 5,
        ShowBlockCursor = 6,
        ShowInvertingBlockCursor = 7,
        Backspace = 8,
        LineFeed = 10,
        DeleteInPlace = 11,
        ClearDisplay = 12,
        CarriageReturn = 13, 
        BacklightControl = 14, //+byte(0-100)
        ContrastControl = 15, //+byte(0-100)
        SetCursorPosition = 17, //+byte(column)+byte(row)
        HorizontalBarGraph = 18, //+graphindex,style,startcol,endcol,length,row
        ScrollOn = 19,
        ScrollOff = 20,
        SetScrollingMarqueeCharacters = 21,
        EnableScrollingMarquee = 22,
        WrapOn = 23,
        WrapOff = 24,
        Reboot = 26,
        ShowInformationScreen = 31,
    }
 
Top