PIC32MX: RS232

From Mech
Revision as of 15:08, 26 August 2009 by Andrew Long (talk | contribs)
Jump to navigationJump to search

RS232 is a method of real time communication between two devices such as PIC to PIC or PIC to PC.

More information about RS232 can be found here.

The PIC32 has 2 sets of pins UART1 and UART2. The pins are:

  • UxCTS - clear to send (input to PIC)
  • UxRTS - ready to send (output from PIC)
  • UxRX - PIC receive
  • UxTX - PIC transmit

PIC to PC

To communicate PIC to PC, you need to have a COMM port or a USB to RS232 converter. You can read about the TTL-232R cable (USB to RS232 converter) here.

The TTL-232R cable has six wires, color coded and in this sequence on the SIP connector:

   BLACK   GROUND  Connect to PIC ground.
   BROWN   CTS#    Unused. "Clear to send" (flow control).
   RED     Vcc     +5V from PC.  !!  DO NOT CONNECT TO PIC +5  !!
   ORANGE  Tx      "PC Transmit." Data from PC, to PIC Rx (pin 26). 
   YELLOW  Rx      "PC Receive."  Data from PIC Tx (pin 25), to PC. 
   GREEN   RTS#    Unused. "Request to send" (flow control).

Note that the TTL-232R cable gives you access to the PC's +5 supply (Red wire), which is limited in current (probably to 500mA) by the USB port which is designed to protect from short circuits. If you wish, you can probably power your PIC from the PC, using USB as a power source. If you do that, get rid of any other +5 source. Don't connect two +5 sources at once. In contrast, be sure that you do connect the PIC's ground to the PC's ground (Black wire).