Searching \ for '[PIC]: two stop bits with 18F877 USART' 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: 'two stop bits with 18F877 USART'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: two stop bits with 18F877 USART'
2002\09\05@132100 by giudicelli

picon face
I'm surprised to hear that only one stop bit is supported in the '877... I
haven't worked with the hardware USART in that part so I don't have much
information, but I would suggest re-reading the datasheet very carefully and
perhaps asking others who have used the hardware.

In the worst case, you can always "Bit Bang" the serial port. This means
that you generate the serial data stream with software using an interrupt
service routine or some carefully timed code. This way, you have complete
control over the data produced. See
http://www.piclist.com/techref/microchip/rs232.htm Note that the code for
smaller PICs is easy to port to the '877

You can also simulate more stop bits by sending only one character at a time
and pausing between characters.

James

{Original Message removed}

2002\09\05@132841 by Jim

flavicon
face
 "You can also simulate more stop bits by sending only
  one character at a time and pausing between characters."

Is the 877 capable of generating an interrupt when the
transmit register is empty?

If so, simply delay a fixed time interval before reloading it ...

IMHO it would seem this would be the prudent way to do it versus
'bit-banging'.

(I could do this with ease on a Z80 so I leave it too others
on how to accomplish this on a PIC ...)

RF Jim


----- Original Message -----
From: "James Newton, webhost" <spam_OUTjamesnewtonTakeThisOuTspamPICLIST.COM>
To: <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>
Sent: Thursday, September 05, 2002 12:17 PM
Subject: [PIC]: two stop bits with 18F877 USART


> I'm surprised to hear that only one stop bit is supported in the '877... I
> haven't worked with the hardware USART in that part so I don't have much
> information, but I would suggest re-reading the datasheet very carefully
and
> perhaps asking others who have used the hardware.
>
> In the worst case, you can always "Bit Bang" the serial port. This means
> that you generate the serial data stream with software using an interrupt
> service routine or some carefully timed code. This way, you have complete
> control over the data produced. See
> http://www.piclist.com/techref/microchip/rs232.htm Note that the code for
> smaller PICs is easy to port to the '877
>
> You can also simulate more stop bits by sending only one character at a
time
> and pausing between characters.
>
> James
>
> {Original Message removed}

2002\09\05@134003 by Olin Lathrop

face picon face
> You can also simulate more stop bits by sending only one character at a
time
> and pausing between characters.

That will work, although there is no interrupt available to find out when
the last bit got sent.  The TX interrupt happens when the output buffer is
available to be loaded with another byte, which happens when the previous
byte is started not finished.

I'm surprised any is still using 2 stop bits.  I haven't seen that since the
mechanical teletype days when the mechanical componets needed extra time to
reset to the next byte.

I've never done this (couldn't see why I'd want to), but you should be able
to simulate an extra stop bit by putting the UART into 9 bit data mode and
setting the 9th bit the stop bit value.  The result should be
indistiguishable on the output line.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@134206 by Olin Lathrop

face picon face
>   "You can also simulate more stop bits by sending only
>    one character at a time and pausing between characters."
>
> Is the 877 capable of generating an interrupt when the
> transmit register is empty?

No.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@134828 by Jim

flavicon
face
   "The TX interrupt happens when the output buffer is
    available to be loaded with another byte, which
    happens when the previous byte is started not finished.'

There's your answer. Account for this time period *too* and
you have your *full* delay constant ... just be mindful if
you change your BAUD rate you must also adjust this delay
value.

RF Jim


{Original Message removed}

2002\09\05@140055 by Dale Botkin

flavicon
face
> I'm surprised to hear that only one stop bit is supported in the '877...

In hardware, yes.  But since the difference between one and two stop bits
is simply one bit time of idle signal, you could simply wait for the TXIF
flag, delay one bit time, and load the next character.

> The 16F877 seemed perfect to do the job since it has a
> rs232 port, however it seems, after reading the docs,
> that it only works with a 1 stop bit, and I need 2
> stop bits, is there a way to make it send 2 stop bits?

Dale

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@140301 by Dale Botkin

flavicon
face
Sorry, not TXIF, TRMT is the flag you want to watch.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@140528 by Dale Botkin

flavicon
face
On Thu, 5 Sep 2002, Olin Lathrop wrote:

> I've never done this (couldn't see why I'd want to), but you should be able
> to simulate an extra stop bit by putting the UART into 9 bit data mode and
> setting the 9th bit the stop bit value.  The result should be
> indistiguishable on the output line.

'Cept he needs 8 + parity.

Dale

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@142215 by Olin Lathrop

face picon face
> In hardware, yes.  But since the difference between one and two stop bits
> is simply one bit time of idle signal, you could simply wait for the TXIF
> flag, delay one bit time, and load the next character.

That won't work.  The TXIF flag indicates when TXREG is transferred to the
output shift register, not when the last bit got done.  For that you need to
monitor the TRMT bit in TXSTA, although there is no interrupt connected to
it.

However, I think you can get the UART to do two stop bits by using 9 bit
data mode and setting the 9th bit to the stop bit value.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@150741 by Harold M Hallikainen

picon face
You can use a timer interrupt instead of the uart interrupt to put a
delay between bytes transmitted. This is the same as extra stop bits.

Harold

On Thu, 5 Sep 2002 13:03:25 -0500 Dale Botkin <dalespamKILLspamBOTKIN.ORG> writes:
{Quote hidden}

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

Reach broadcasters, engineers, manufacturers, compliance labs, and
attorneys.
Advertise at http://www.hallikainen.com/FccRules/ .


________________________________________________________________
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/web/.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\05@154401 by Bob Ammerman

picon face
Yep:

When you write a value to the UART's TX reg, at the same time set a timer
for, in this case, at least 11 bit times:
(start+8 data+parity+2 stop)

Do _not_ enable TXIF interrupt processing. Instead use the timer interrupt
to determine when to send the next character.

Bob Ammerman
RAm Systems

{Original Message removed}

2002\09\06@011601 by Harold Hallikainen

picon face
I use the timer interrupt to run the uart transmit routine in all my products that have to transmit DMX (lighting control datastream). DMX calls for a break to identify the start of the frame. Trying to sync the break with the uart transmit with the transmit holding register just became too much of a pain. Using the timer interrupt, dumping a byte into the txreg means that byte starts transmitting right now. There is no other byte currently in the shift register. That works nicely. Doing the break on the PIC is a bit of a pain. In most products I use another pin that is connected to the tx output through a resistor. That pin is normally tristated. When I want a break, I program that pin low (pulling the serial data from the pin that I tristate instead of from the tx pin on the PIC).

Harold




________________________________________________________________
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/web/.

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


2002\09\06@021421 by David Duffy

flavicon
face
At 02:20 PM 05/09/2002 -0400, you wrote:
> > In hardware, yes.  But since the difference between one and two stop bits
> > is simply one bit time of idle signal, you could simply wait for the TXIF
> > flag, delay one bit time, and load the next character.

Olin:
>That won't work.  The TXIF flag indicates when TXREG is transferred to the
>output shift register, not when the last bit got done.  For that you need to
>monitor the TRMT bit in TXSTA, although there is no interrupt connected to
>it.

I do exactly this by checking TRMT in my 10ms interrupt routine. I only check
it however after loading the last byte by setting another flag that the ISR
checks.
Regards...
___________________________________________
David Duffy        Audio Visual Devices P/L
U8, 9-11 Trade St, Cleveland 4163 Australia
Ph: +61 7 38210362   Fax: +61 7 38210281
New Web: http://www.audiovisualdevices.com.au
___________________________________________

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


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