On Mon, Apr 14, 2003 at 11:27:16AM +0200, Werner Soekoe wrote: > Quick Question: > > If I use the USART of the PIC16F627 (or any other PIC with an USART) in > async mode to communicate with a PC via a RS232 serial port, do I need to a > transceiver chip such as the MAX232, or will it work without the transceiver? You need some sort of interface. It that vague enough? Let me explain. PIC USART '1' bit: 5V PIC USART '0' bit: 0V EIA-232 '1' bit : -12V EIA-232 '0' bit : 12V So it's quite clear that you need something. Now EIA-232 is less persnickity about what is received (3V for '0', -3V for '1') and PC serial ports are often even less picky (often 0V for a '1' and 3V for a '0'). But once you get outside of spec there's always a chance that it won't work. The best thing about MAX232 parts is that it gives nearly spec voltages on both the interfaces. So it works almost every time. But especially if it's a hobby project, you can skimp often with good results. There a two required items: an inverter and some form of voltage limiting. Many will note that the PIC has voltage limiting diodes. However there is a very small current that those diode are limited to. A long time ago I took Wouter's advise and always used external voltage limiting with PIC I/O. I haven't blown a port pin yet. So let's talk about the USART output first as its the easiest: simply invert it. In my last project I used a 74HCT04. Works like a champ to all of my desktop and laptop PCs. The input needs voltage limiting. I use a current limiting resistor and a zener diode. The diode limits voltage in both directions: positively at its rated voltage (I usually use a 4.7V one for this application) and -0.6V in the negative direction. Wouter has an example circuit of both the MAX232 and the zener limiter on his Wloader page: (http://www.voti.nl/wloader). In the el-cheapo schematic you can see the resistor/zener combo in parts R2 and D1. R7 isn't necessary for your circuit because Wouter actually ties both the input and output for his software UART to the same pin. Note that he also has a MAX232 circuit. > The datasheet I have on the PIC16F627 seems unclear about his, as do the > application notes on the Microchip website. I think that it's unclear because it's well known that USART outputs from microcontrollers and UART chips are TTL/CMOS outputs and not EIA-232 (BTW just being picky on the name. RS-232 is a Recommended Standard, while EIA is an actual standard) conforming. > > Thanks No problem. BAJ -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.