use com port as parallel port

Discussion in 'Java' started by b3ny, Nov 16, 2004.

  1. b3ny

    b3ny Guest

    hello everybody, short question
    is it possible to use the serial com port with the comm api as
    parallel port
    and check every single input channel (if it is high)??

    i'am trying to create a extern media controller, that has buttons for
    play, stop, next,volume up... and i want to keep everything
    simple(without parallel/seriell converter)...

    thanx 4 help beny
    b3ny, Nov 16, 2004
    #1
    1. Advertising

  2. b3ny

    Graeme Hill Guest

    I think you have the wrong end of the stick here.

    Com ports are serial devices i.e. one bit at a time, one after the other.
    You would needs some extra electronics to interface what you describe to a
    serial port - parallel and serial ports are electronically and
    theoretically different in design and practice.

    If you did want to interface such a controller to a serial port, you would
    need to conver the switch activations to a serial byte of information
    that could pass back to the serial port.

    On 15 Nov 2004, b3ny wrote:

    > hello everybody, short question
    > is it possible to use the serial com port with the comm api as
    > parallel port
    > and check every single input channel (if it is high)??
    >
    > i'am trying to create a extern media controller, that has buttons for
    > play, stop, next,volume up... and i want to keep everything
    > simple(without parallel/seriell converter)...
    >
    > thanx 4 help beny
    >
    Graeme Hill, Nov 16, 2004
    #2
    1. Advertising

  3. b3ny

    b3ny Guest

    > I think you have the wrong end of the stick here.

    i knew thus... but the serial port has more than one in/output channels...
    RxD and TxD are the two data channels, but whats up with the status bits??
    DCD DSR RTS CTS and DTR can't i use them as normal in/outputs???

    beny
    b3ny, Nov 16, 2004
    #3
  4. b3ny

    Oscar kind Guest

    b3ny <> wrote:
    >> I think you have the wrong end of the stick here.

    >
    > i knew thus... but the serial port has more than one in/output channels...
    > RxD and TxD are the two data channels, but whats up with the status bits??
    > DCD DSR RTS CTS and DTR can't i use them as normal in/outputs???


    No. These bits are used by the serial port controller (i.e. the hardware)
    to control when to send bits over the communication wires. After all, the
    buffers on both sides must not overflow.

    Even though the software can tell the controller which handshaking
    protocol to use (i.e. the pins or using special bit patterns on the
    communication line), the controller is in charge. Not the software.


    --
    Oscar Kind http://home.hccnet.nl/okind/
    Software Developer for contact information, see website

    PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
    Oscar kind, Nov 16, 2004
    #4
  5. b3ny wrote:
    >>I think you have the wrong end of the stick here.

    >
    >
    > i knew thus... but the serial port has more than one in/output channels...
    > RxD and TxD are the two data channels, but whats up with the status bits??
    > DCD DSR RTS CTS and DTR can't i use them as normal in/outputs???
    >
    > beny


    yes you can!

    --

    Knute Johnson
    email s/nospam/knute/
    Knute Johnson, Nov 16, 2004
    #5
  6. Oscar kind wrote:
    > b3ny <> wrote:
    >
    >>>I think you have the wrong end of the stick here.

    >>
    >>i knew thus... but the serial port has more than one in/output channels...
    >>RxD and TxD are the two data channels, but whats up with the status bits??
    >>DCD DSR RTS CTS and DTR can't i use them as normal in/outputs???

    >
    >
    > No. These bits are used by the serial port controller (i.e. the hardware)
    > to control when to send bits over the communication wires. After all, the
    > buffers on both sides must not overflow.
    >
    > Even though the software can tell the controller which handshaking
    > protocol to use (i.e. the pins or using special bit patterns on the
    > communication line), the controller is in charge. Not the software.
    >


    That isn't quite right - at least for the 16450/16550 compatible serial
    ports that are used in the IBM PC architecture. Flow control must always
    be performed by software - (The nomenclature "Hardware" vs. "Software"
    flow control only differentiates between whether the signalling of these
    states is done through the hardware pins RTS/CTS or as part of the data
    stream - XON/XOFF)

    So while you cannot control the state of the TxD pin (or read that of
    the RxD pin) programmatically, all the remaining pins (DTR and RTS as
    outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read
    asynchronously from the PC.
    Babu Kalakrishnan, Nov 17, 2004
    #6
  7. b3ny

    b3ny Guest

    > So while you cannot control the state of the TxD pin (or read that of
    > the RxD pin) programmatically, all the remaining pins (DTR and RTS as
    > outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read
    > asynchronously from the PC.


    tell me how it works???
    how di i have to config the comm api?
    maybe a little source code example?

    thanx beny
    b3ny, Nov 19, 2004
    #7
  8. b3ny wrote:
    >>So while you cannot control the state of the TxD pin (or read that of
    >>the RxD pin) programmatically, all the remaining pins (DTR and RTS as
    >>outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read
    >>asynchronously from the PC.

    >
    >
    > tell me how it works???
    > how di i have to config the comm api?
    > maybe a little source code example?
    >


    Check out the API for the javax.comm.SerialPort class. You have the
    setDTR(), setRTS() methods to set the output bits and the
    isDSR(),isCTS(), isCD(), isRI() methods for reading the bits.

    BK
    Babu Kalakrishnan, Nov 19, 2004
    #8
  9. b3ny

    Graeme Hill Guest

    Please remember that according to the RS232 specification, a 1 (high bit)
    is a NEGATIVE voltage with respect to ground - between perhaps -5 and -15
    volts. A 0 (low bit) is POSITIVE with respect to ground, again e.g. +5 to
    +15 volts.

    Paralell ports, on the other end, will typically operate at TTL voltages
    e.g. 0 V is 0(low) bit, +5V is 1(high) bit.

    If you don't know what you doing, you will almost certainly fry your RS232
    port.


    More info e.g. http://www.sangoma.com/signal.htm

    On Fri, 19 Nov 2004, Babu Kalakrishnan wrote:

    > b3ny wrote:
    > >>So while you cannot control the state of the TxD pin (or read that of
    > >>the RxD pin) programmatically, all the remaining pins (DTR and RTS as
    > >>outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read
    > >>asynchronously from the PC.

    > >
    > >
    > > tell me how it works???
    > > how di i have to config the comm api?
    > > maybe a little source code example?
    > >

    >
    > Check out the API for the javax.comm.SerialPort class. You have the
    > setDTR(), setRTS() methods to set the output bits and the
    > isDSR(),isCTS(), isCD(), isRI() methods for reading the bits.
    >
    > BK
    >
    Graeme Hill, Nov 19, 2004
    #9
  10. b3ny

    steve Guest

    On Sat, 20 Nov 2004 01:48:05 +0800, Graeme Hill wrote
    (in article
    <>):

    > Please remember that according to the RS232 specification, a 1 (high bit)
    > is a NEGATIVE voltage with respect to ground - between perhaps -5 and -15
    > volts. A 0 (low bit) is POSITIVE with respect to ground, again e.g. +5 to
    > +15 volts.
    >
    > Paralell ports, on the other end, will typically operate at TTL voltages
    > e.g. 0 V is 0(low) bit, +5V is 1(high) bit.
    >
    > If you don't know what you doing, you will almost certainly fry your RS232
    > port.
    >
    >
    > More info e.g. http://www.sangoma.com/signal.htm
    >
    > On Fri, 19 Nov 2004, Babu Kalakrishnan wrote:
    >
    >> b3ny wrote:
    >>>> So while you cannot control the state of the TxD pin (or read that of
    >>>> the RxD pin) programmatically, all the remaining pins (DTR and RTS as
    >>>> outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read
    >>>> asynchronously from the PC.
    >>>
    >>>
    >>> tell me how it works???
    >>> how di i have to config the comm api?
    >>> maybe a little source code example?
    >>>

    >>
    >> Check out the API for the javax.comm.SerialPort class. You have the
    >> setDTR(), setRTS() methods to set the output bits and the
    >> isDSR(),isCTS(), isCD(), isRI() methods for reading the bits.
    >>
    >> BK
    >>

    >


    there is not enough wires, to cover all his options , unless he implements
    some external logic.

    he has a number of options.

    1. give up
    2. use the parallel port.
    3. use the usb port with a couple of extra chips.
    4. if he insists on using the serial port, he just needs a parallel to serial
    convertor chip.
    then feed his signals into the parallel side.
    he can use the chip to handle the RS232 interface

    Then use 2 other control lines 1 to reset the chip & 1 to act as a clock. (
    unless the chip implements it own internal clock)

    first step , each time he wants to read.
    1. issue a reset signal to the external chip ( puts the parallel chip in
    exactly a known state)
    2. issue a clock signal to clock the data out, until 1 byte received.
    allow the api to assemble the byte.
    3. read byte , decode bits.
    go to 1.

    he does not even need a voltage convertor. to get his +- supply. if he is
    smart he can leach off the RS232 port. ( set 1 line high , & 1 line low then
    use that to power the chip & circuit ( cmos))
    steve, Nov 20, 2004
    #10
  11. b3ny

    Ann Guest

    "steve" <> wrote in message
    news:...
    > On Sat, 20 Nov 2004 01:48:05 +0800, Graeme Hill wrote
    > (in article
    > <>):
    >
    > > Please remember that according to the RS232 specification, a 1 (high

    bit)
    > > is a NEGATIVE voltage with respect to ground - between perhaps -5

    and -15
    > > volts. A 0 (low bit) is POSITIVE with respect to ground, again e.g. +5

    to
    > > +15 volts.
    > >
    > > Paralell ports, on the other end, will typically operate at TTL voltages
    > > e.g. 0 V is 0(low) bit, +5V is 1(high) bit.
    > >
    > > If you don't know what you doing, you will almost certainly fry your

    RS232
    > > port.
    > >
    > >
    > > More info e.g. http://www.sangoma.com/signal.htm
    > >
    > > On Fri, 19 Nov 2004, Babu Kalakrishnan wrote:
    > >
    > >> b3ny wrote:
    > >>>> So while you cannot control the state of the TxD pin (or read that of
    > >>>> the RxD pin) programmatically, all the remaining pins (DTR and RTS as
    > >>>> outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read
    > >>>> asynchronously from the PC.
    > >>>
    > >>>
    > >>> tell me how it works???
    > >>> how di i have to config the comm api?
    > >>> maybe a little source code example?
    > >>>
    > >>
    > >> Check out the API for the javax.comm.SerialPort class. You have the
    > >> setDTR(), setRTS() methods to set the output bits and the
    > >> isDSR(),isCTS(), isCD(), isRI() methods for reading the bits.
    > >>
    > >> BK
    > >>

    > >

    >
    > there is not enough wires, to cover all his options , unless he implements
    > some external logic.
    >
    > he has a number of options.
    >
    > 1. give up
    > 2. use the parallel port.
    > 3. use the usb port with a couple of extra chips.
    > 4. if he insists on using the serial port, he just needs a parallel to

    serial
    > convertor chip.
    > then feed his signals into the parallel side.
    > he can use the chip to handle the RS232 interface
    >
    > Then use 2 other control lines 1 to reset the chip & 1 to act as a clock.

    (
    > unless the chip implements it own internal clock)
    >
    > first step , each time he wants to read.
    > 1. issue a reset signal to the external chip ( puts the parallel chip in
    > exactly a known state)
    > 2. issue a clock signal to clock the data out, until 1 byte received.
    > allow the api to assemble the byte.
    > 3. read byte , decode bits.
    > go to 1.
    >
    > he does not even need a voltage convertor. to get his +- supply. if he

    is
    > smart he can leach off the RS232 port. ( set 1 line high , & 1 line low

    then
    > use that to power the chip & circuit ( cmos))
    >


    You can also get a USB to Centronix 36pin printer cable
    that will convert USB to parallel. I saw one at a store for $20.
    I bought a serial to parallel converter a few years back, maybe $35
    but prices have probably dropped.
    Ann, Nov 20, 2004
    #11
  12. Graeme Hill wrote:

    Please do not top post.

    > Please remember that according to the RS232 specification, a 1 (high bit)
    > is a NEGATIVE voltage with respect to ground - between perhaps -5 and -15
    > volts. A 0 (low bit) is POSITIVE with respect to ground, again e.g. +5 to
    > +15 volts.
    >
    > Paralell ports, on the other end, will typically operate at TTL voltages
    > e.g. 0 V is 0(low) bit, +5V is 1(high) bit.
    >


    I was assuming that the OP knows what he's doing wrt signal levels and
    polarities since he mentioned he was building the hardware.


    > If you don't know what you doing, you will almost certainly fry your RS232
    > port.
    >


    If you try connecting an RS-232 signal directly to a TTL device, the
    more likely candidate to get fried is the TTL side - not the RS-232 port
    A TTL input signal level is well within RS-232's defined input range (If
    the RS232C side is the input), and its output drivers are expected
    to be current limited / short circuit protected.

    BK
    Babu Kalakrishnan, Nov 20, 2004
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. karthik
    Replies:
    5
    Views:
    10,972
    Dale King
    Jul 25, 2003
  2. Anwar Moukaddem

    Parallel Port

    Anwar Moukaddem, Aug 5, 2003, in forum: Java
    Replies:
    0
    Views:
    387
    Anwar Moukaddem
    Aug 5, 2003
  3. Soren
    Replies:
    4
    Views:
    1,233
    c d saunter
    Feb 14, 2008
  4. Vivek Menon
    Replies:
    5
    Views:
    3,310
    Paul Uiterlinden
    Jun 8, 2011
  5. Vivek Menon
    Replies:
    0
    Views:
    1,748
    Vivek Menon
    Jun 10, 2011
Loading...

Share This Page