Search the Legacy Support Archive (up to v2020)
  1. Read-only archive (2005–2024). Posting is closed. Need help with MediaLab or DirectRT 2027? Email service@empirisoft.com.

    All words · “exact phrase” · -leave out

    Advanced search

Comport File Question: Serial port, Input code (1-255) Meaning

  1. #1

    Comport File Question: Serial port, Input code (1-255) Meaning

    Hello, I have a question about the comport file.

    We want MediaLab to look for a response via the serial port. Our other computer in the past sent an ASCII 49 to the serial port, which MediaLab interpreted as a 1 and responded with a 1 response. Now, we want the input value to be an 18, and when MediaLab receives the code for 18, proceeds with a response of 1. The parameter in the questionnaire is set to (p1).

    In a paragraph for Serial Port Input from section 5.10 of the
    MediaLab manual file you state that "on each line you can
    list a pair where the first value is the signal sent to the serial
    port (i.e., 1-255)"...... This statement seems to explicitly state
    that one could send any numeric integer value into the serial port,
    and MediaLab ought to be able to read that value (including decimal
    18, as we need). So, my question is -- can Medialab
    really do this, and if so, how. And what does "input code (1-255) mean?
    ?

    It is confusing that from our work trying to figure this out earlier, it is when MediaLab detects the ASCII *code* for a 1 coming over the serial port that it will react -- so, it's detecting the *number* 49.


    Thank you! M

  2. #2
    Thanks for writing.

    If you look here, you'll see that the keyboard character '1' has a decimal ASCII value of 49:

    http://web.cs.mun.ca/~michael/c/ascii-table.html

    The 'input code' field refers to the ASCII character you're trying to transmit.

    Make sense?

  3. #3
    jarvis24 Blair Jarvis, Administrator
    Also, for quick reference:

    Key = Ascii

    0 = 48
    1 = 49
    2 = 50
    3 = 51
    4 = 52
    5 = 53
    6 = 54
    7 = 55
    8 = 56
    9 = 57

    Note: These are not to be mistaken for the standard DirectRT / DirectX keycodes which can be found in the user's guide, or online here:
    http://www.empirisoft.com/directrt/help/directrt_key_codes.htm

  4. #4
    Hello,

    I understand that decimal 49 maps to an ASCII "1"; but that the manual implies that we should be able to send any integer value 1-255 through the serial port. And is that true, because we need to send a decimal 18. (Decimal 18 is binary 10010) And if MediaLab should be able to accept a Decimal 18, how do we designate that in the file as 18 is the code for a non-printing character.

    We need MediaLab to respond to a middle mouse click, which is a non printing or a control character. In the ASCII conversion chart you sent, a decimal 18 is the middle mouse click (the scroll thing), characterized by "dc2." We CAN send a decimal 18 to MediaLab via serial port, what we are not able to do thus far is have MediaLab subsequently respond. In the MediaLab comport file, the following parameters are necessary:

    input code (1-255), response value (1-12)

    So, what would be the input code for decimal/ASCII 18? I understand the response value can be any number 1-12.

    Thanks!

    M

  5. #5
    Hello,

    I understand that decimal 49 maps to an ASCII "1"; but that the manual implies that we should be able to send any integer value 1-255 through the serial port. And is that true, because we need to send a decimal 18. (Decimal 18 is binary 10010) And if MediaLab should be able to accept a Decimal 18, how do we designate that in the file as 18 is the code for a non-printing character.

    We need MediaLab to respond to a middle mouse click, which is a non printing or a control character. In the ASCII conversion chart you sent, a decimal 18 is the middle mouse click (the scroll thing), characterized by "dc2." We CAN send a decimal 18 to MediaLab via serial port, what we are not able to do thus far is have MediaLab subsequently respond. In the MediaLab comport file, the following parameters are necessary:

    input code (1-255), response value (1-12)

    So, what would be the input code for decimal/ASCII 18? I understand the response value can be any number 1-12.

    Thanks!

    M


    You should be able to put the ASCII 18 as the input code and your response value (anything from 1-12) in the file and continue without any issue.

    Thus 18 would be mapped to 1, 2, 3, etc.

    -----------------

    It occurs to me, though, that this may not work as intended. If the serial mouse is connected and is registered by Windows as an actual mouse, you won't be able to simultaneously access the serial data. Windows will grab the mouse clicks before you can do anything with them.

    The workaround would be to 'uninstall' the serial mouse in the windows control panel, but leave it connected to your computer.

    The serial data can then be received and manipulated - I think - by MediaLab.

    You can test this with a terminal program such as RealTerm or Hyperterm.