Searching \ for '[PIC]:Possible to use USART for RX and have TX as' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=usart
Search entire site for: 'Possible to use USART for RX and have TX as'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Possible to use USART for RX and have TX as '
2001\06\08@181104 by Mitch Berkson

picon face
With a 16F877, I would like to use the USART to receive asynchronous data but
use the TX pin as a general purpose I/O.  After having tried various
permutations of TXEN, SPEN and tristating the TX pin or not, I suspect that
this is not possible.

Disabling the entire USART when I want to use the TX as an output is not an
option because receive data can arrive at any time.  A software USART is also
not an option.

Thanks for any help.

Mitch Berkson

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\06\08@185401 by Michael Cook

flavicon
face
It should be perfectly possible. If you don't enable the USART, they
should be general IO pins. If memory serves me, the USART is DISABLED by
default, so as long as you don't touch the registers you should be fine.

{Original Message removed}

2001\06\08@192622 by Bill Westfield

face picon face
   With a 16F877, I would like to use the USART to receive asynchronous
   data but use the TX pin as a general purpose I/O. ....

   Disabling the entire USART when I want to use the TX as an output is
   not an option because receive data can arrive at any time.  A software
   USART is also not an option.

Well, if you want an output, and you're driving something like an LED
for "user" interaction, you can probably get away with actually
transmitting characters when you want the LED to light (or be off.)
Shucks, you can even get cheap PWM brightness control.  :-)

I was going to suggest leaving the trasnmitter "idle" to output a 1,
and sending a BREAK condition to output a 0, but it doesn't look to me
like the PIC USART has the ability to generate BREAK on its own...

BillW

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\06\08@201945 by Mitch Berkson

picon face
I won't be able to use the USART receiver portion if the USART is disabled.

Mitch Berkson

----- Original Message -----
From: "Michael Cook" <spam_OUTfoobarsoftTakeThisOuTspamFOOBARSOFT.COM>
To: <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>
Sent: Friday, June 08, 2001 6:52 PM
Subject: Re: [PIC]:Possible to use USART for RX and have TX as general purpose
I/O?


> It should be perfectly possible. If you don't enable the USART, they
> should be general IO pins. If memory serves me, the USART is DISABLED by
> default, so as long as you don't touch the registers you should be fine.
>
> {Original Message removed}

2001\06\08@214751 by Michael Cook

flavicon
face
Oops, good point. That's what I get for skimming ;)

With that requirement, what about multiplexing some of your other pins?
Use a serial to parallel shift register or whatever they're called, that
way with just 2 or 3 pins you can output or input 8. As long as you
don't need to do anything weird, it should work. The data into a LCD or
something else with 8 data input pins would work just fine this way.

{Original Message removed}

2001\06\09@090614 by Olin Lathrop

face picon face
> It should be perfectly possible. If you don't enable the USART, they
> should be general IO pins. If memory serves me, the USART is DISABLED by
> default, so as long as you don't touch the registers you should be fine.

Yes, but he wants to still use the UART for receiving while using the TX pin
for general I/O.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@115002 by Byron A Jeff

face picon face
On Sat, Jun 09, 2001 at 07:58:14AM -0400, Olin Lathrop wrote:
> > It should be perfectly possible. If you don't enable the USART, they
> > should be general IO pins. If memory serves me, the USART is DISABLED by
> > default, so as long as you don't touch the registers you should be fine.
>
> Yes, but he wants to still use the UART for receiving while using the TX pin
> for general I/O.

Which of course is impossible. It's not possible to engage 1/2 the UART. You
either assign both pins to the UART or neither pin.

Sad but true.

The best course is to enable the UART and utilize another pin for that output
function. The second alternative is to enable the UART and use some type of
one shot that is triggered by a transmit so that the bit value of the TX pin
is latched some time after the start bit. Then you could send:

         X
11111011111111111 to send a one
11111000000000111 to send a zero

and the bit gets latched at point X.

But it addes extra hardware to the task.

BAJ

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@123409 by Bob Ammerman

picon face
This problem is the result of an unfortunate design flaw in the mChip UART.
Just about every UART made has the ability to transmit a BREAK condition.
This allows you to use the TX pin as an output by just going back and forth
between IDLE and BREAK.

Unfortunately, mChip didn't see fit to include this capability in their
UART.

Some protocols (eg: DMX-512) _require_ the ability to send a break.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)



{Original Message removed}

2001\06\09@132406 by Kelly Kohls

picon face
One possible solution:  Tie a pull down resistor to the transmit pin.  When
you want the line to go low, clear the SPEN bit.  This disables the
transmitter portion of the UART and places the transmit pin into a high
impedence state.  When you want the line to go high, set the SPEN bit.
Since the idle state of the transmitter is high, the TX pin will be high.
This is the technique that I used in my DMX-512 transmitter to generate the
"break".  Note:  I used a 16C76 and 16F876 for my transmitters.  The
information about the TX pin going to a high impedence state when the
transmitter is disabled is only in the datasheet for the 16C76 part.  I
don't know why it was left out of the 16F876 datasheet, but it appears to
function just like the 16C76.  Hope this helps.

Kelly Kohls, N5TLE
Dallas, Texas
Homepage: http://www.qsl.net/n5tle/
There's never enough time to do it right, but plenty of time to do it over.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@135728 by Harold M Hallikainen

picon face
On Sat, 9 Jun 2001 12:21:34 -0500 Kelly Kohls <@spam@KKohlsKILLspamspamPRODIGY.NET>
writes:
> One possible solution:  Tie a pull down resistor to the transmit pin.
>  When
> you want the line to go low, clear the SPEN bit.  This disables the
> transmitter portion of the UART and places the transmit pin into a
> high
> impedence state.  When you want the line to go high, set the SPEN
> bit.
> Since the idle state of the transmitter is high, the TX pin will be
> high.
> This is the technique that I used in my DMX-512 transmitter to
> generate the
> "break".

       That's clever! I've done a lot of DMX stuff using the 16c73, 16c74, and
the 18c452. I ended up using a second output pin to generate the break. I
ran the TX pin through a resistor to the EIA422 driver. I also connected
an I/O pin to the driver input. That pin is programmed low, but usually
in input mode. To send a break, I clear the TRIS bit for it. Setting the
TRIS bit ends the break. Synchronizing the break with the transmitted
data was fun. I finally ignored the UART interrupt and do everything with
a timer interrupt. I put a byte in the txreg on one interrupt. By the
next interrupt, that byte has been transmitted and it's safe to set the
break. The next interrupt, I can clear the break.
       In my next design I'll have to have a look at the SPEN bit. One more I/O
pin available!!!

Harold




FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@225852 by David VanHorn

flavicon
face
At 12:31 PM 6/9/01 -0400, Bob Ammerman wrote:
>This problem is the result of an unfortunate design flaw in the mChip UART.
>Just about every UART made has the ability to transmit a BREAK condition.
>This allows you to use the TX pin as an output by just going back and forth
>between IDLE and BREAK.
>
>Unfortunately, mChip didn't see fit to include this capability in their
>UART.
>
>Some protocols (eg: DMX-512) _require_ the ability to send a break.


I've always done this by shifting down a couple baud rates and sending a null..

Had some fun on a barcode system recently, where the best they could tell
me was that I had to send a break, but they couldn't tell me how wide it
needed to be.. Either 10 bits at 9600, or 1.5 Seconds.  Neither worked
particularly well, and I found out later there were so many bugs in their
firmware as to make the whole excersize pointless.
--
Dave's Engineering Page: http://www.dvanhorn.org

I would have a link to http://www.findu.com/cgi-bin/find.cgi?KC6ETE-9 here
in my signature line, but due to the inability of sysadmins at TELOCITY to
differentiate a signature line from the text of an email, I am forbidden to
have it.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@230047 by Bill Westfield

face picon face
   Just about every UART made has the ability to transmit a BREAK
   condition.  This allows you to use the TX pin as an output by just
   going back and forth between IDLE and BREAK.

   mChip didn't see fit to include this capability in their UART.

   Some protocols (eg: DMX-512) _require_ the ability to send a break.

Fortunately, there are all sorts of tricks developed over the years for
sending a break when your hardware and/or API doesn't permit it.  The most
generic method is to set the transmit bit rate absurdly slow (much lower
than the actual desired transmission rate) and send a zero.  This requires
split bitrate capability, or that you be able to ignore reception of data
for the duration of the break (and a bit more.)  On a PIC, if you want to
send a BREAK, and can afford to lose reception "near" that time, you ought
to be able to disable the uart, send the appropriate state out the pin as a
direct output, and then re-enable uart...

BillW

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@230107 by Mitch Berkson

picon face
That sounds very promising.  I'll try it.  Thanks.

Mitch Berkson

----- Original Message -----
From: "Kelly Kohls" <TakeThisOuTKKohlsEraseMEspamspam_OUTPRODIGY.NET>
To: <RemoveMEPICLISTspamTakeThisOuTMITVMA.MIT.EDU>
Sent: Saturday, June 09, 2001 1:21 PM
Subject: Re: [PIC]:Possible to use USART for RX and have TX as general purpose
I/O?


{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspammitvma.mit.edu with SET PICList DIGEST in the body


2001\06\09@234745 by Mitch Berkson

picon face
I haven't tried this yet, but it looks like, from the 16C76 data sheet, that
you meant that TXEN (not SPEN) should be cleared to tristate the TX pin.  I
think clearing SPEN would disable both sections of the UART.

Mitch Berkson

{Original Message removed}

2001\06\10@113320 by Kelly Kohls

picon face
Mitch,

> I haven't tried this yet, but it looks like, from the 16C76 data sheet,
that
> you meant that TXEN (not SPEN) should be cleared to tristate the TX pin.
I
> think clearing SPEN would disable both sections of the UART.

Yes. You're right, it is the TXEN bit that I was refering to.  That's what I
get for relying on my memory. Sorry.

Kelly Kohls, N5TLE
Dallas, Texas
Homepage: http://www.qsl.net/n5tle/
There's never enough time to do it right, but plenty of time to do it over.

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestEraseMEspamEraseMEmitvma.mit.edu


2001\06\10@160416 by Olin Lathrop

face picon face
> I've always done this by shifting down a couple baud rates and sending a
null..

That's fine as long as you aren't trying to receive at the same time.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, RemoveMEolinspam_OUTspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspamspammitvma.mit.edu


2001\06\10@160621 by Mitch Berkson

picon face
That works great.  Thanks.

Mitch Berkson

----- Original Message -----
From: "Kelly Kohls" <EraseMEKKohlsspamspamspamBeGonePRODIGY.NET>
To: <RemoveMEPICLISTKILLspamspamMITVMA.MIT.EDU>
Sent: Sunday, June 10, 2001 11:30 AM
Subject: Re: [PIC]:Possible to use USART for RX and have TX as general purpose
I/O?


{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestSTOPspamspamEraseMEmitvma.mit.edu


2001\06\11@102158 by Martin Hill

picon face
It's not something I have done directly, but I wanted to receive and transmit at 115.2kbaud most of the time, but at some times receive at 4800baud whilst still transmitting at 115.2kbaud.  I did this by connecting one PIC pin directly to the RS232 interface chip, with the TX pin connected via a 10k resistor.  With the pic pin set as an input (high impedance) the TX pin drives the interface chip.  With the pic pin set as an output, it overrides the output from the TX pin and I could bit bang out at 115.2kbaud whilst still receiving at 4800baud on the RX pin.

Martin


>>> William Chops Westfield <KILLspambillwspamBeGonespamCISCO.COM> 06/10/01 01:32AM >>>
   Just about every UART made has the ability to transmit a BREAK
   condition.  This allows you to use the TX pin as an output by just
   going back and forth between IDLE and BREAK.

   mChip didn't see fit to include this capability in their UART.

   Some protocols (eg: DMX-512) _require_ the ability to send a break.

Fortunately, there are all sorts of tricks developed over the years for
sending a break when your hardware and/or API doesn't permit it.  The most
generic method is to set the transmit bit rate absurdly slow (much lower
than the actual desired transmission rate) and send a zero.  This requires
split bitrate capability, or that you be able to ignore reception of data
for the duration of the break (and a bit more.)  On a PIC, if you want to
send a BREAK, and can afford to lose reception "near" that time, you ought
to be able to disable the uart, send the appropriate state out the pin as a
direct output, and then re-enable uart...

BillW

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...