Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: how to send a hex file to a serial port in java

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how to send a hex file to a serial port in java

    i want to send a hex file to a serial port in java..so i need code for it.as a example.i am a student so m new in dis field.plz help me asap.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,337
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: how to send a hex file to a serial port in java

    Do you have the code to send any file to a serial port?

    What is a hex file? Does mean a non-text file that has bytes that can contain any of 256 values: 0x00 to 0xFF
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to send a hex file to a serial port in java

    no i dnt hav the code 2 send file..bt til now wat i kno is i cn send a file to serial port as a data or collection of bytes..bt nt as a whole file..so plz explain the way 2 do it!!

  4. #4
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to send a hex file to a serial port in java

    and 1 more thing , while sending a hex file i want 2 completely ignore the line feed..

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,337
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: how to send a hex file to a serial port in java

    What class and what method are you using to send what you are sending?

    What is a hex file? Does mean a non-text file that has bytes that can contain any of 256 values: 0x00 to 0xFF
    If the file contains binary data, it can have a byte with any value including a line feed character.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to send a hex file to a serial port in java

    after finding serial ports and connecting to it, m making a file output stream for serial port.n passing ma hex file name to outputstream.

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,337
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: how to send a hex file to a serial port in java

    What is the name of the class you are using to write to the serial port with?
    Does it have methods for writing bytes?
    If you don't understand my answer, don't ignore it, ask a question.

  8. #8
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to send a hex file to a serial port in java

    name of the class is outputstream and it has a write method which take argument of byte 2 b written on serial port

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,337
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: how to send a hex file to a serial port in java

    What is 2 b?
    Please use English.

    There is no Java SE class: outputstream. Java is case sensitive and all classes start with a uppercase letter.
    If you don't understand my answer, don't ignore it, ask a question.

  10. #10
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to send a hex file to a serial port in java

    yes..OutputStream is the class name..and sorry for using shortcut language. hey Norm can you give me a simple code to send bytes from a file to serial port?
    Last edited by Himali; April 1st, 2012 at 03:08 PM.

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,337
    Thanks
    49
    Thanked 2,194 Times in 2,167 Posts

    Default Re: how to send a hex file to a serial port in java

    Can you explain what the problem is when you write the contents of a file? Your descriptions have been vague.
    Post the code you are using to write the file and the code you are using to read the file.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Serial Port Stream - AT modem commands
    By praveen.singh18 in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: November 8th, 2011, 12:33 PM
  2. Reading wrong value from serial port
    By howardchan in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 29th, 2011, 06:03 PM
  3. Serial Port Programming(detecting 5V signal from USB)
    By abhishekshishodia in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: June 24th, 2011, 11:53 AM
  4. reading stream of bytes from serial port
    By KrisTheSavage in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: January 3rd, 2011, 10:02 AM
  5. theory about serial / parallel port & java
    By wolfgar in forum Java Theory & Questions
    Replies: 5
    Last Post: January 4th, 2010, 09:08 PM