Electronics Interfacing a PIC with RS232

Discussion in 'Modding' started by JazzXP, 8 Jan 2003.

  1. JazzXP

    JazzXP Eh! Steve

    Joined:
    30 Apr 2002
    Location:
    Melbourne - Australia
    Posts:
    1,669
    Likes Received:
    13
    I'm planning on making a circuit with a PIC (16F84A) and I was wondering how to interface with the serial port on the PC (only needs to transmit to the PC), my main problem is that the 16F84A uses TTL voltage levels, whereas serial isn't (ie. RS232)... any ideas? I was thinking of using This but I have no idea if it would suit my needs or not... my other option would be to use a MAX232, but I kinda want to do it right away and not have to wait for delivery.
     
  2. ravton

    ravton What's a Dremel?

    Joined:
    9 Aug 2002
    Posts:
    13
    Likes Received:
    0
    If you're actually impatient you should use google: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=MC1488+rs232&sa=N&tab=wg

    It's a driver only. Find a max232 or clone.
     
  3. relix

    relix Minimodder

    Joined:
    14 Nov 2001
    Location:
    51° 20' 2", 3° 17' 35"
    Posts:
    5,948
    Likes Received:
    41
  4. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Location:
    Cambridge, UK
    Posts:
    3,049
    Likes Received:
    8
    I don't get it. The serial ports on a PC are TTL (5V). What's the problem??
     
  5. linear

    linear Minimodder

    Joined:
    5 Oct 2001
    Location:
    U S A
    Posts:
    4,393
    Likes Received:
    1
    Uh, the problem is that they aren't. :D
     
  6. relix

    relix Minimodder

    Joined:
    14 Nov 2001
    Location:
    51° 20' 2", 3° 17' 35"
    Posts:
    5,948
    Likes Received:
    41
    I've done a bit of reading regarding RS232 (as I also thought it'd be as easy as just connecting a pin from the PIC to the line on the COM-port and sending serial data to that pin) and it seems that RS232 uses a voltagevalue between 3V (or nowadays 0.3V) and 12V for high, and -12V and -3V (or -0.3V) for low, tho modern systems accept "0" as a low too.
     
  7. ravton

    ravton What's a Dremel?

    Joined:
    9 Aug 2002
    Posts:
    13
    Likes Received:
    0
    PIC (or Avr!) to your PC is super easy. All you need is the max232 (or clone). Yes, there's lots of details you _could_ know, but the fact of the matter is that all you need to know is that you need a max232.

    There are ways to do it without a max232, but they'll all cost you alot more in time then the $2 (is that 1.5 pounds?) max232 will cost.
     
  8. relix

    relix Minimodder

    Joined:
    14 Nov 2001
    Location:
    51° 20' 2", 3° 17' 35"
    Posts:
    5,948
    Likes Received:
    41
    Will a "driver" based on the EIA-232D standard also work? I've searched a bit in a shop and that was the cheapest I could find (0.70), the others were more expensive (7.43+)
     
  9. ravton

    ravton What's a Dremel?

    Joined:
    9 Aug 2002
    Posts:
    13
    Likes Received:
    0
    A driver is just that, a driver. Meaning that you can use it (assuming that it's got the correct specs) to _send_ but not receive.

    RS232 is also inverted. This means unless the driver does it (most won't) you need to invert the signal before the driver processes it.

    There's a reason all the circuits you find on the web use a Max232. Max232 really shouldn't be all that expensive. :)

    If you REALLY want to keep trying this way, do a search on google. There's lots of excellent circuits for doing this. They'll need about 20 discrete components but they work.
     
  10. JazzXP

    JazzXP Eh! Steve

    Joined:
    30 Apr 2002
    Location:
    Melbourne - Australia
    Posts:
    1,669
    Likes Received:
    13
    Thanks for the help guys... that should set me on my way.
     
  11. AmPz

    AmPz What's a Dremel?

    Joined:
    27 Jun 2002
    Posts:
    81
    Likes Received:
    0
    A max232 is the best and easiest solution.
    But there are other, much cheaper, but a bit more complicated solutions as well.
     
  12. Guest-2808

    Guest-2808 Guest

    Check out this web site:

    http://www.mygizmos.net/frames/hardware/irreciever.html

    Yes, it`s the well known UIR controller, a very useful bit of kit. Anyway, look at the schematic. You can interface to RS232 over a short distance without any kind of level converter or inverter. It not brilliant but it works.

    A 16F84 with something like that might make a good serial "backpack" for an LCD.

    For more advanced stuff, check out the 16C87X series of PICs. They have a UART built in, and are very easy to use. You do need a MAX232 or similar though. You can download a free bootloader for them too:

    http://www.microchipc.com/PIC16bootload/

    Makes development a hell of a lot easier.

    MoJo
     
  13. oktane

    oktane What's a Dremel?

    Joined:
    10 Jan 2003
    Posts:
    5
    Likes Received:
    0
    Skip the MAX232, you can get away without using it for a while until your chip comes in. The F84 is a cheap uC anyway. Tell me again why you are using the F84 over the 16F628 which is MUCH cheaper, has the same pinout, and provides an onboard clock and more I/O's? :)

    But seriously, don't blame me if you fry your serial port, but you can have any terminal program use either T2400 (true) or N2400 (inverted) TTL logic.

    -oktane
     
    Last edited: 20 Jan 2003
  14. oktane

    oktane What's a Dremel?

    Joined:
    10 Jan 2003
    Posts:
    5
    Likes Received:
    0
  15. relix

    relix Minimodder

    Joined:
    14 Nov 2001
    Location:
    51° 20' 2", 3° 17' 35"
    Posts:
    5,948
    Likes Received:
    41
  16. eaterofpies

    eaterofpies What's a Dremel?

    Joined:
    12 Feb 2002
    Posts:
    1,745
    Likes Received:
    0
    cos my programmer only says it will work with 16f83 16f84 otherwise i would use the 16f628

    but onboard clock sounds like a gr8 plan :D

    ive been thinking bout doing a serial >parallel lcd jobbie for ages but i killed my last pic and aint got arround to getting bits again
     

Share This Page