Summary of Serial to PIC Interface using PIC Microcontroller
This article describes a single-pin serial interface circuit connecting a computer terminal to a PIC microcontroller. It enables bidirectional communication by converting TTL logic to RS-232 levels using DTR or RTS signals for control. The setup prevents data echo and simplifies debugging by allowing input and output through one pin.
Parts used in the Serial to PIC Interface:
- PIC Microcontroller
- Terminal program (computer)
- DTR signal (pin 4)
- RTS signal (pin 7)
- CTS/RTS hardware handshaking
- TTL true data line
- RS-232 level converter
One of the first things I like to do when creating a new project is to get the I/O working. This helps in debugging the code as I write it.
What about projects that do not have I/O? This device sneeks both input and output from your computer (terminal program) to the PIC using just one pin.
In order for this circuit to work, you need to set either DTR (pin 4) or RTS (pin 7) to positive voltage. Turning on CTS/RTS hardware handshaking usually does this.
All serial data from the computer is transfered to the PIC as TTL true data. TTL true data from the PIC is converted to rs-232 level and sent back to the computer. Additionally, the transmitted data from the computer is prevented from echoing directly back (CR4 above).
Here is some SAMPLE CODE at the PIC end that sends and receives on a single pin allong with the LAYOUT and PARTS PLACEMENT.
For more detail: Serial to PIC Interface using PIC Microcontroller
- How does this device handle input and output?
The device sneaks both input and output from your computer to the PIC using just one pin. - What voltage is required for the circuit to work?
You need to set either DTR (pin 4) or RTS (pin 7) to positive voltage. - Does turning on CTS/RTS hardware handshaking affect the circuit?
Yes, turning on CTS/RTS hardware handshaking usually sets the necessary pins to positive voltage. - How is serial data transferred from the computer to the PIC?
All serial data from the computer is transferred to the PIC as TTL true data. - How is data sent back to the computer?
TTL true data from the PIC is converted to rs-232 level and sent back to the computer. - Is there a risk of data echoing directly back?
No, the transmitted data from the computer is prevented from echoing directly back. - Can you send and receive on a single pin with this setup?
Yes, the sample code sends and receives on a single pin along with the layout and parts placement. - Why is this method useful for debugging?
It helps in debugging the code as you write it by getting I/O working early.
