Searching \ for 'how to invert hardware uart output in software?' 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/ios.htm?key=output
Search entire site for: 'how to invert hardware uart output in software?'.

Truncated match.
PICList Thread
'how to invert hardware uart output in software?'
1999\06\26@145259 by engelec

picon face
Hi to all engineers.

I am working with hardware uart 16c74a  I need to invert the uart
output beside adding external inverter is there any way of doing it
in software ? any help will appreciated.

Andre

1999\06\27@050704 by Russell McMahon

picon face
Probably not I'd say.
BUT
To do it in software probably costs very little.
single NPN small signal transistor, emitter to ground.
10k resistor from output pin to transistor base.
Resistor (size depends on drive required - 1k to 10K probably) from
collector to Vcc.
Output from collector.


           Russell McMahon

-----Original Message-----
From: Andre Abelian <spam_OUTengelecTakeThisOuTspamearthlink.net>
To: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU <PICLISTspamKILLspamMITVMA.MIT.EDU>
Date: Sunday, June 27, 1999 6:53 AM
Subject: how to invert hardware uart output in software?


>Hi to all engineers.
>
>I am working with hardware uart 16c74a  I need to invert the uart
>output beside adding external inverter is there any way of doing it
>in software ? any help will appreciated.
>
>Andre
>

1999\06\27@135839 by Chris Eddy

flavicon
face
Russell;

The send function in a UART is actually somewhat simple.  Assuming you
have interrupts, which is the real efficient way to do it, just bang
your message out.  Then let the recieve run through the UART.  The
recieve is the real work.  You said you wanted to invert the send, not
recieve.  If you want to do both, well, that is a different story.

Chris Eddy

Russell McMahon wrote:

{Quote hidden}

> {Original Message removed}


'how to invert hardware uart output in software?'
1999\07\03@174334 by engelec
picon face
Russell ,

Thanks for your replay.  at this point I inverted externally
using logic gate single transistor is good idea too.

andre




Russell McMahon wrote:

> Probably not I'd say.
> BUT
> To do it in software probably costs very little.
> single NPN small signal transistor, emitter to ground.
> 10k resistor from output pin to transistor base.
> Resistor (size depends on drive required - 1k to 10K probably) from
> collector to Vcc.
> Output from collector.
>

1999\07\03@192900 by engelec

picon face
Chris,

thanks for your idea but couldn't understand clearly. what to do ?

Chris Eddy wrote:

> Russell;
>
> The send function in a UART is actually somewhat simple.  Assuming you
> have interrupts,

sorry I do not use interrupt for uart

> which is the real efficient way to do it, just bang
> your message out.

that is from transmitter right ?

> Then let the recieve run through the UART.

is this means connecting transmit and receive together ?

> The
> recieve is the real work.

if the receiver takes the data back then how am I transmit ?

> You said you wanted to invert the send,

yes transmit only

{Quote hidden}

> > {Original Message removed}

1999\07\04@070444 by paulb
flavicon
face
Andre Abelian wrote:

> thanks for your idea but couldn't understand clearly.  What to do ?

 He was suggesting you "bit-bang" the serial transmit function and use
the UART for receive.  This on the (correct) premise that serial
transmission is much easier than receive.

> sorry I do not use interrupt for uart

 If you use simple timing loops to clock out the transmitted bits, you
tend to occupy all the processor's time.  If you have a source of
interrupts at the desired bitrate however, you can use these to clock
out the transmitted bits.

 You can use timer interrupts to receive serial data, but then you need
interrupts at least three times the bitrate, and this is not so
efficient.

>> Then let the recieve run through the UART.
> is this means connecting transmit and receive together ?

 No, just saying you use a general-purpose I/O to "bit-bang" the sent
data, but connect the received data to the UART as before (via an
inverter I presume).

 It sounds like you went for the "hardware" solution anyway - just as
we  as you really should isolate the PIC from the serial line.
--
 Cheers,
       Paul B.

1999\07\04@114202 by Dave VanHorn

flavicon
face
>
>   You can use timer interrupts to receive serial data, but then you need
> interrupts at least three times the bitrate, and this is not so
> efficient.


I've done this on an 84, with ints AT the bitrate.
The trick is to catch the edge of the start bit, and sync the ints up half a
bit-time late.
I wouldn't use this approach in a noisy environment or on long lines.

1999\07\04@192359 by paulb

flavicon
face
Dave VanHorn wrote:

> I've done this on an 84, with ints AT the bitrate.
> The trick is to catch the edge of the start bit, and sync the ints up
> half a bit-time late.

 Yes, but that's the hybrid technique; you still need to poll for the
start bit and synchronize the interrupts.  Only *thereafter* it has low
overhead.

 Fine if you are not using the timer for anything else - such as
timing!

> I wouldn't use this approach in a noisy environment or on long lines.

 Muse:  How many UARTs *actually* do take multiple samples and average
them, and how many just sample in the middle of each bit?

--
 Cheers,
       Paul B.

1999\07\04@193435 by Dave VanHorn

flavicon
face
>   Yes, but that's the hybrid technique; you still need to poll for the
> start bit and synchronize the interrupts.  Only *thereafter* it has low
> overhead.

nananana.. I put the serial in on an external int.
I used the timer for a bunch of functions.

1999\07\05@071801 by paulb

flavicon
face
Dave VanHorn wrote:

> nananana.. I put the serial in on an external int.
> I used the timer for a bunch of functions.

 I think there is still a restriction insofar as you must synchronise
the timer to this serial interrupt on the start bit - you still cannot
use the timer for some other task.

 Alternatively there is the technique of reading the timer each time
the serial line toggles and thus generates an interrupt (a lˆ BayCom).
That makes it both efficient and highly accurate (you can determine
*precisely* when the transition was and implement a PLL algorithm).

 It takes a bit of design (i.e., thought) as for example, one interrupt
often shifts in as many as nine bits simultaneously, but is undoubtably
the best.  I haven't actually implemented it myself yet, mind you.
--
 Cheers,
       Paul B.

1999\07\05@084317 by wwl

picon face
On Mon, 5 Jul 1999 09:23:39 +1000, you wrote:

>Dave VanHorn wrote:
>
>> I've done this on an 84, with ints AT the bitrate.
>> The trick is to catch the edge of the start bit, and sync the ints up
>> half a bit-time late.
>
>  Yes, but that's the hybrid technique; you still need to poll for the
>start bit and synchronize the interrupts.  Only *thereafter* it has low
>overhead.
Not necessarily - you can either sample at 2x baud rate, or generate
an edge interrupt on the startbit.

1999\07\05@135320 by Dave VanHorn

flavicon
face
----- Original Message -----
From: Mike Harrison
> >Dave VanHorn wrote:
> >
> >> I've done this on an 84, with ints AT the bitrate.
> >> The trick is to catch the edge of the start bit, and sync the ints up
> >> half a bit-time late.
> >
> >  Yes, but that's the hybrid technique; you still need to poll for the
> >start bit and synchronize the interrupts.  Only *thereafter* it has low
> >overhead.

> Not necessarily - you can either sample at 2x baud rate, or generate
> an edge interrupt on the startbit.

That's what I said I did.. The second bit was someone else.

1999\07\05@150319 by Wagner Lipnharski

picon face
This could be so simple if the manufactories just implement a
programmable "uart tx/rx data polarity bit"... in some cases it could be
important... but they think "what the hack? who in the world would need
it?", well I guess not even this question passed their heads...  the
same for high/low speed internal programmable clock speed,  when any
interrupt would automatically set high speed back from saving power...
but... again "who need it?" answer: WE DO!  they would say "use sleep
mode, it works"... not at all, I want to keep the processor doing
something, while saving 90% of the power... not sleeping... but simple
things are impossible to be done by manufacturers.

Wagner.

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