Connect with us

How to use TX/RX on a PIC

Discussion in 'Electronic Basics' started by hybrid_snyper, Nov 13, 2006.

Scroll to continue with content
  1. Hi,

    I'm looking for some advice, i am trying to control an Ericsson T28
    mobile phone by using a PIC16F87X. I understand the how to talk to a
    mobile phone by using my COM port on my PC. Is it as simple as
    connecting the relevant TX/RX pins to the correct pins on the mobile
    phone? Do i need any circuitry between. Ive seen something about MAX232
    when using serial communications any tips would be appreciated.

    yours

    Wayne
     
  2. Wayne,

    The MAX232 is necessary. It inverts the signals from the PIC and converts
    them to the voltages an RS232 needs. You need to do the same when you want
    to talk with a PIC to a COM port of a PC.

    petrus bitbyter
     
  3. The proper way is to use the MAX232. Another nice IC for this is the
    SN75155 (8-pin DIL). Depending on the voltage levels recognised by the
    T28, you may be able to do it using simple transistors for the signal
    inversion.

    --
    Regards,
    Costas
    _________________________________________________
    Costas Vlachos Email:
    SPAM-TRAPPED: Please remove "-X-" before replying
     
  4. Tim Auton

    Tim Auton Guest

    Have I read a different post to everyone else?

    The guy asks how to connect a PIC to a mobile phone. Neither uses RS232
    levels.

    PIC <> PC RS232 = MAX232
    T28 <> PC RS232 = MAX232
    T28 <> PIC = NO MAX232

    Find out what voltage levels the pins on the T28 are at. I suspect it'll
    be 3.3V logic, but it might be 5V. The easiest thing to do is run the PIC
    at the same voltage as the port on the T28, then you don't need a level
    shifter and can connect them directly. Series resistors of a few hundred
    ohms on the TX and RX lines won't affect the functioning but might save
    your PIC or phone if you hook it up wrong.


    Tim
     
  5. Thank you very much for that, I will plod on with that and see what i
    can come up with. If i have any problems i will let you know.
     
  6. I think the signals may need to be inverted, in which case the above
    won't work. For a PC <--> PIC connection you don't really need level
    shifting but you must invert the signals. I don't know how the T28
    serial works. If it's non-standard, the above might work, but I suspect
    inversion will be necessary. Two transistors should do the trick.

    --
    Regards,
    Costas
    _________________________________________________
    Costas Vlachos Email:
    SPAM-TRAPPED: Please remove "-X-" before replying
     

  7. Hmmm. I carefully reread the original question. The OP tells he knows how to
    connect the COM port of its PC to the phone. If he did so and the phone has
    3.3V or 5V logic inputs, it's blown by now. So I concluded the phone to have
    an RS232 interface. I agree, it's not very likely the phone to have this
    build in, but you can buy interface cables. The ones I'm aware of have a
    MAX3232 or similar in their connector. So you are right, it will end up
    converting two times. 5V <--> RS232 <--> 3V3. Which will be the most safe
    way for someone asking questions like this.

    petrus bitbyter
     
  8. Tim Auton

    Tim Auton Guest

    Thinking about this more I think we might be talking about different
    things. I would be very surprised if the T28 had on-board circuitry to
    generate RS232 levels - ie something like a MAX232 on board. Mobile
    phones are too cost, size and power sensetive for that. So I expect on
    the connector on the bottom of the phone there is a standard
    (non-inverted) logic-level UART connection, which you could connect to a
    PIC directly. However, if there is a cable with a DB9 plug on the end to
    connect to a PC serial port (ie RS232) I would expect that to provide
    RS232 levels, with the conversion provided by something like a MAX232 or
    DS276 (like a MAX232 but steals power from the signal lines) inside the
    cable. I was talking about the phone end of that cable, you seem to be
    talking about the PC end.

    So, if the OP has a cable with a DB9 plug designed to plug into a PC and
    wants to connect it to their PIC they would need a MAX232. I was
    assuming they just had a connector, so wouldn't need one (or an inverter).


    Tim
     
  9. I see what you mean. If the inversion/level-shifting is done in the
    phone cable, then he should be able to do it like you said in your first
    post (direct connection, resistors for protection). It makes sense for
    the phone manufacturer to move the MAX232 or similar IC outside of the
    phone for size/cost issues. The OP can connect directly like you said
    and see what happens. If it doesn't work, invert the signals and try
    again. I don't think level shifting will be necessary for such a small
    device anyway (it definitely isn't for modern PCs). I was just assuming
    that the Tx/Rx signals from the phone would match the standard polarity
    of the RS-232 in which case inversion would be necessary. I suppose he
    could measure the phone's Tx line when idle to determine whether
    inversion is needed.

    --
    Regards,
    Costas
    _________________________________________________
    Costas Vlachos Email:
    SPAM-TRAPPED: Please remove "-X-" before replying
     

  10. So direct connection is the way to go. I found these two links a while
    back. The first is what I believe to be the circuitry within the
    datacable and to which would allow me to eliminate the cable.

    http://pinouts.ru/CellularPhonesCables/ericsson_cable_pinout.shtml

    this next link shows a guy which has a Tiny12 connected directly via a
    datacable to his MCU. I take it would be a similar setup to this. He
    has the data entering the MCU fed direct with a 4700 resistor in
    between. However he has added circuitry to create a true bi-polar
    signal. Im not sure what this means.

    http://www.riccibitti.com/tinyplanet/tiny_article.htm
     
  11. OK, these are nice links relating to what you want to do. From the first
    link it's clear that there's no need to invert the signals when you
    connect the phone *directly* to the PIC (i.e., *without* using the
    special Ericsson cable which has circuitry inside). If you do it like
    this you should be fine using only resistors for protection (as Tim
    Auton suggested earlier):

    Phone Tx -----\/\/\----- PIC Rx
    Phone Rx -----\/\/\----- PIC Tx
    Phone GND --------------- PIC GND

    I don't know about the voltage levels of the T28. Are they 5V or 3.3V?
    Probably the latter. As Tim said, run the PIC at the same voltage. I
    don't think you need to worry about true bipolar signals, the other guy
    in the second link probably uses the proper Ericsson cable (with the
    circuit inside) and so has to deal with negative voltages (hence the
    Zener), and uses the transistor to "steal" negative voltage from the
    incoming signal to generate his own bipolar Tx signal. The transistor
    also inverts the MCU's Tx signal. He probably does the inversion of the
    Rx signal in s/w (inside the MCU - no h/w UART used).

    So, to recap, if you're somehow connecting the phone directly to the PIC
    (no cable) or you're using just a passive connector or a dummy cable (no
    circuitry involved) then use the above wiring (PIC's voltage same as
    phone's logic levels, 5V or 3.3V). If you *are* using the proper
    Ericsson cable (with the level shifter/inverter inside), then you need
    to invert the signals again so that the PIC & phone can talk to each
    other. Hope this is now clearer.

    --
    Regards,
    Costas
    _________________________________________________
    Costas Vlachos Email:
    SPAM-TRAPPED: Please remove "-X-" before replying
     
  12. If you *are* using the proper
    So to use the proper connector is going to require the max232 anyway,
    so im going to be better off using some copper wire some resistors and
    try and wire the phone pins to the PIC pins directly. I bought the data
    cable on the assumption it would be the simpler option, connect the
    data cable to a RS232 port wired to the PIC. But in this case it is
    not, its def not the simpler way,

    Thanks for that guys I appreciate it, i will be in touch with the
    outcome
     
  13. The simplest method is the direct connection (no cable). But since you
    already have the proper cable, you could implement the circuit of the
    Tiny MCU project (second link you posted earlier). You just need a
    second transistor (NPN this time) between the Zener & the PIC, like this:

    .. +5V
    .. |
    .. |
    .. 10k
    .. |
    .. +----------> To PIC Rx
    .. |
    .. C
    .. From Zener/4.7k ----------> B BC547
    .. E
    .. |
    .. |
    .. GND

    No real need for the MAX232, and in this way your PIC circuit alone (and
    phone alone) will be able to talk to other devices too, like a PC. Plus
    your PIC can operate at standard +5V (no need to match the phone's logic
    levels). If I was you I'd do it like this. I've used the transistor
    approach to connect a PIC to a PC with no problems. Your phone+cable is
    like a PC as far as RS-232 signals are concerned, so I don't see why it
    wouldn't work.

    --
    Regards,
    Costas
    _________________________________________________
    Costas Vlachos Email:
    SPAM-TRAPPED: Please remove "-X-" before replying
     

  14. i think i will go with direct connection, just because i want to move
    from a mobile phone to a standalone GSM modem make it my device into a
    tidy unit, with modem mounted to the circuit board.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-