Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9161725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:02:11+00:00 2026-06-17T14:02:11+00:00

I don’t know much about this, so this is going to be a pretty

  • 0

I don’t know much about this, so this is going to be a pretty basic question.

I have a nifty little USB thing which emulates a COM port. It’s a simply switch, to which I can send three different signals: ON, OFF and GET STATUS

I’ve tested it using a terminal program called RealTerm. In this, I can open the port at the set baud rate and other options, and then send bin files to the port. When I got the thing, I also downloaded three different .bin files – one for ON, one for BREAK and one for GET STATUS. This works like a charm, and the port returns the corresponding codes etc.

Now, I’d like to try this in Java (first, then possibly C/C++). So I got a library called JSSC (v0.9), which makes this pretty easy. This is what I do:

public static void main(String[] args) {
    String[] portNames = SerialPortList.getPortNames();

    for(int i = 0; i < portNames.length; i++){
        System.out.println(portNames[i]);
    }

    SerialPort serialPort = new SerialPort("COM10");

    try {
        serialPort.openPort();//Open serial port
        serialPort.setParams(SerialPort.BAUDRATE_9600, 
                             SerialPort.DATABITS_8,
                             SerialPort.STOPBITS_1,
                             SerialPort.PARITY_NONE);

        serialPort.writeBytes("0x55 01 01 02 00 00 00 59".getBytes());
        serialPort.closePort();
    }
    catch (SerialPortException ex) {
        System.out.println(ex);
    }
}

The baud rate, data and stop bits are the correct ones. When I plug in the device, the system.out.prinln lists the port, so it looks like the device is detected.

Now, the device has the following code words:

Make:         0x55 01 01 02 00 00 00 59
Break:        0x55 01 01 01 00 00 00 58
Check status: 0x55 01 01 00 00 00 00 57

Should I then just be able to pass those hex strings to the device in the java program, and get/observe the result(s)? If so, how do I do it? Just writeBytes() or writeString() like above doesn’t do anything. (I hear a click from the device when the MAKE or BREAK signal works).

Or is there a way to pass these .bin files to the port, like I do in RealTerm?

Also, does anyone know exactly what kind of files these .bin files might be? The guy I bought it from (cheaply) is not very informative, and doesn’t want to help with things or answer questions not direcly related to the device (which is understandable, of course).

I don’t need to delve into microprocessor programming or similar topics here, since I’m really just trying to accomplish some basic operations. But some insight or overview is of course necessary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:02:12+00:00Added an answer on June 17, 2026 at 2:02 pm

    It seems to me, that those codes:

    Make:         0x55 01 01 02 00 00 00 59
    Break:        0x55 01 01 01 00 00 00 58
    Check status: 0x55 01 01 00 00 00 00 57
    

    you have to send like byte-arrays. They look like hex numbers, so try to do this:

    byte[] mike = new byte[]{0x55, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x59};
    serialPort.writeBytes(mike);
    serialPort.flush(); // is this method available? I think you should invoke it, if it is present
    serialPort.closePort();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't have much knowledge about the IPv6 protocol, so sorry if the question
Don't know if this is possible, but I have some code like this: val
Don't know if this has been answered before. Have custom routes to users. If
Don't know much about encryption... Say I'm preparing a SAML request to submit to
Don't know why but I can't find a solution to this. I have 3
don't know better title for this, but here's my code. I have class user
Don't know much about running a function on every item in an array, still
Don't know if it's stupid or reasonable question. I have methods which returns float/int
Don't know if you got my question, so here is an example. I have
Don't know if this has been asked before, so point me to another question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.