Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Transmit data from PIC to RS232 without MAX232

Status
Not open for further replies.

GatorGuy

New Member
What is the easiest way of connecting a PIC to the RS232 without a max232? EG. I can send data to a pic by just connecting PIN 3 and GND to the PIC. I only want to send data to the serial port.
 
One method using the least number of components simply involves connecting a 1K0 resistor between the PIC TX pin and the RX pin on the PC serial port however the signal is not inverted with this method and you'll need to bit bang your serial TX data in the PIC...

Another method simply involves using an open-drain MOSFET (2N7000 or BS170) and a pull-up resistor connected to one of the RS-232 "high" level pins as shown in the drawing below... This method inverts the signals and allows use of the PIC built-in UART peripheral directly...

Regards, Mike

<added>

If you don't have a MOSFET, there are plenty of bipolar transistor circuits around (try PICList)...
 

Attachments

  • rs-232_16f627a.jpg
    rs-232_16f627a.jpg
    45.6 KB · Views: 2,106
Mike said:
One method using the least number of components simply involves connecting a 1K0 resistor between the PIC TX pin and the RX pin on the PC serial port however the signal is not inverted with this method and you'll need to bit bang your serial TX data in the PIC...

Another method simply involves using an open-drain MOSFET (2N7000 or BS170) and a pull-up resistor connected to one of the RS-232 "high" level pins as shown in the drawing below... This method inverts the signals and allows use of the PIC built-in UART peripheral directly...

Regards, Mike

<added>

If you don't have a MOSFET, there are plenty of bipolar transistor circuits around (try PICList)...


What do you mean by bit bang?
 
You can conect the RX trugh an 10K resistor and the PICs internal protection diodes will clamp it to 0-6V (this is not recomended)

Some COM ports consider over 2V as high so an PIC pin can drive it.
 
"Bit bang" means to do the serial through software instead of using the hardware UART. When you do software serial you can control the polarity.

I've used Mike's MOSFET solution and it works great. I don't even have the TX MOSFET drain tied to the serial port; I think I have mine tied to Vdd.

[another] Mike
 
Thats becose of you have an newer COM port. Old ones need 10V to get high but newer ones only 2V(5V is way above that)
 
Bit-banged serial code controls the TX and/or RX pin directly using software and precise bit time delays... This provides "active high" or "active low" capabilties when required but at the cost of considerable software / timing overhead...

If your PIC has a built-in UART peripheral, don't bother with the resistor interface... Use the transistor interface instead... The transistors cost very little (10 cents each) and require very little PCB space... In fact, I often build that two transistor circuit inside a DB9F shell and connect it to PIC boards using a 3.5mm 'stereo' connector installed on the PIC board... The 3.5mm connector uses much less PCB space than a PCB mounted DB9F connector...

Good luck... Regards, Mike
 

Attachments

  • ttl-232_convertor_174.jpg
    ttl-232_convertor_174.jpg
    30.6 KB · Views: 2,294
  • 2n7000_rs232_interface_1_182.jpg
    2n7000_rs232_interface_1_182.jpg
    27.4 KB · Views: 1,794
I have been going over the examples that Nigel gave on sending letters over the RS232. Could I use those examples or do I need to send them another way if I am only using the RX pin on the RS232?
 
Lack of available hardware right now. Just wanting to do some testing until I make another trip to the shop.
 
Someone Electro said:
Thats becose of you have an newer COM port. Old ones need 10V to get high but newer ones only 2V(5V is way above that)

I've never heard of old ports requiring 10V?, and I've never heard of a 0-5V signal not working fine feeding a PC serial port - certainly it's been used commercially for MANY years, one example the BASIC Stamp!.
 
Right. The COM port on an old computer may generate +/- 10V levels, but the level at which a positive voltage is considered a "space" (zero) is 3V.

A "mark" (one) is supposed to be anything below -3V, but accepting 0V was probably a pretty common concession.

Mike
 
Status
Not open for further replies.

Latest threads

Back
Top