please dont rip this site

PIC Specific RS232

There has been a lot of confusion on how the RX or TX pins should be set with reguard to TRIS on the PICs with hardware USARTs especially with reguard to makeing them work in interrupt mode.

First, keep in mind that MPLAB does not (correctly or otherwise) simulate the USART Hardware.

Second, read the datasheets.

From DS30292B-page 33 (the '873 datasheet section 3.3 PORTC and TRISC Registers):

When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is enabled, read-modify-write instructions (BSF, BCF, XORWF) with TRISC as destination should be avoided. The user should refer to the corresponding peripheral section for the correct TRIS bit settings.

From DS30292B-page 95 (the '873 datasheet section 10.0n on USART):

Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be set in order to configure pins RC6/TX/CK and RC7/RX/DT as the Universal Synchronous Asynchro-nous Receiver Transmitter.

In Microchip lingo "set" means make the bit a 1.

The bottom line, don't do read-modify-write operations on a TRIS register that is controlling pins with another active peripheral, such as the TRISC register when using the UART or CCP.

Finally, PICUART.ZIP from http://redrival.com/mcgahee/  or http://mcgahee.freeservers.com is known to work and explains most of the common problems.

Samples:

rs232@ TTL to/from RS232@ TI Calc@ PIC C IO@

See also:

cover "Serial PIC'n : PIC Microcontroller Serial Communications" by David Benson

Code:


file: /Techref/scenix/lib/io/osi2/serial/rs232.htm, 6KB, , updated: 2003/6/15 10:07, local time: 2024/11/21 19:54,
TOP NEW HELP FIND: 
3.142.156.58:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/techref/scenix/lib/io/osi2/serial/rs232.htm"> PIC Specific RS232 </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .