Results 1 to 4 of 4

Thread: MO Command Prefix in C#

  1. #1
    FLAC PatO's Avatar
    Join Date
    Dec 2000
    Location
    Afton MN
    Posts
    1,120

    MO Command Prefix in C#

    I have a Matrix Orbital display that I've used with my VB6.0 app for several years now. Recently, I've begun upgrading my software to C#...

    Anyway, in VB, I could use the following to send, say, a clear screen command to the display (control char + command).
    Code:
    CP = Chr$(&HFE) 
    MSComm.Output = CP & "X"
    How would I create the 0xFE in C#? I'm using the same MSCOMM control in both systems. Obviously, this syntax won't work in C#.
    I've tried things like sending FE as a string, and even converting it to various types of int and char - Int32.Parse("FE", NumberStyles.HexNumber);...
    Any tips?
    http://www.jeepmp3.com/
    CarPC Stolen. Starting over.
    Ne1 recognize the avatar?

  2. #2
    I'm sorry, and you are....? frodobaggins's Avatar
    Join Date
    Jan 2003
    Location
    Ruston, LA
    Posts
    8,846
    I believe in c# you can just send 0xFE

    i also think there are built in functions like HexToInt and IntToHex
    [H]4 Life
    My next generation Front End is right on schedule.
    It will be done sometime in the next generation.
    I'm a lesbian too.
    I am for hire!

  3. #3
    FLAC PatO's Avatar
    Join Date
    Dec 2000
    Location
    Afton MN
    Posts
    1,120
    Found It!
    Code:
    int d = 0xFE;
    char d1 = Convert.ToChar(d);
    this.axMSComm1.Output = d1 + "X";
    Where:
    0xFE is the MO Command Prefix
    X is the MO command for CLEAR SCREEN
    Eventually someone else will ask about this, so I wanted to get it in stone. Plus, it's highly likely that aliens will come down and crash my computer, now that I've jumped a hurdle.
    http://www.jeepmp3.com/
    CarPC Stolen. Starting over.
    Ne1 recognize the avatar?

  4. #4
    Low Bitrate spectrumzz's Avatar
    Join Date
    Sep 2003
    Posts
    88
    Quote Originally Posted by PatO
    Found It!
    Code:
    int d = 0xFE;
    char d1 = Convert.ToChar(d);
    this.axMSComm1.Output = d1 + "X";
    Where:
    0xFE is the MO Command Prefix
    X is the MO command for CLEAR SCREEN
    Eventually someone else will ask about this, so I wanted to get it in stone. Plus, it's highly likely that aliens will come down and crash my computer, now that I've jumped a hurdle.
    or, more objectively, axMSComm1.Output = (char)0xFE + "X";

    The conversion is explicit in the cast.

Similar Threads

  1. Replies: 11
    Last Post: 01-20-2004, 12:41 PM
  2. Autoplay going in slo mo!
    By jakeep in forum Auto-Play
    Replies: 1
    Last Post: 04-11-2003, 06:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •