At 11:08 PM 5/5/97 +0000, you wrote: >I used to do all my serial work with code on 16C57, but now I'm heading >towards 16C63, and like the sound of the built-in serial support: the data >rate is easily changed just by loading a register, the built in support >generates all the timing for the selected speed. > >I did some experiments with PICMaster 16C65 pod J and noticed something >strange. When working with a PC, the signals going in both directions >needs to be inverted. For example, the 'rest' state of the PIC RX/TX data >lines is high, start bits are low, stop bits high. Whereas the PC uses a >rest state of low, high start bit and low stop bit. The PC has all data >bits inverted though. > >I did an experiment with a bit of software to copy and invert the TX data >port to another port (which is wired to DB9) and to monitor RX data (from >the DB9 and few into an 'ordinary' port), toggled and output to another >'ordinary' port connected by a wire to the RX data port (does this all make >sense?), and it worked fine. I just reconfigured to a 16C63, but I haven't >got that working yet, I had to move a few ports around, I'll debug that in >the morning. > >So, my question is: has anyone else noticed this data inversion? Is there >a solution in a bit configuration on the PIC, some simple wiring change I >need to make, or do I need something simple like an open collector and pull >up to invert the data? > >It seems strange that PIC should be inverted from PC without some simple >workaround. This data "inversion" is normal. RS232 defines a "mark" or "1" as a voltage more negative than -3V, often about -10V on a PC. A "space" or "0" is defined as a positive voltage greater than 3V often about +10V. Don't exceed 15V in either direction. I am currently designing a project with a 16C63 - receive only - and I use a 2n2222 to invert the signal at the input to the PIC. An alternate suggestion would be to invert the data at the PC before sending it, or at the PIC after receiving it. A single instruction in either case. There is an article in the Jan 97 issue of Nut & Volts that shows how to send data to a PC (from a PIC) by "stealing" the negative voltage needed from the RS232 port. It uses a transistor and a couple of resistors. Good luck! Jeff