please dont rip this site

PIC Specific RS232 IO

NEW! RCL-1 RS232 Level Converter in a DB9 backshell

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

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

Second, read the datasheets. They are tricky as hell and the details may be buried in there

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 which would normally set the pin as an input. That isn't confusing with RX, but the requirement that the TRISC bit for the TX pin be set is rather counter-intuative.

Beyond the SPEN and TRIS setup, at least on some PIC's, the ANSEL bits can override the SPEN setting. So, even if SPEN is set, and TRIS is set for both RX and TX, if the associated pins are set as analog inputs, you may not receive any data.

PICUART.ZIP from http://redrival.com/mcgahee/  or http://mcgahee.freeservers.com is known to work and explains most of the common problems. The ZIP file only contains this ASM:  picuart.asm which is cached here since the mcgahee pages appear to have been lost.

the PICList.com SPBRG Calc (based on code from  Andy Kunz)

Automatic (asm macro) setting of the SPBRG, etc... values based on desired baud rate and processor speed from Olin Lathrop

.sti file generator for RS232 simulation in MPLAB

Calculating Parity

Detecting rising and falling edge events is a useful tool for "bit bang" or software only implementations of serial receive routines.

From the CHEAPIC tutorial:

Samples:

Also: RS232@, TTL to/from RS232@, TI Calc@ PIC C IO@ High speed serial IO pin sampleing

Books:

See also:

Books:

Questions:

Archive:

+

Code:

Comments:


file: /Techref/microchip/rs232.htm, 19KB, , updated: 2016/12/1 17:09, local time: 2024/10/13 00:24,
TOP NEW HELP FIND: 
35.171.164.77:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©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://piclist.com/techref/microchip/rs232.htm"> PIC RS232 IO</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?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .