Peregrine M. McGehee wrote:
> > We also decided it was safer not to output the first character from
> > the Write function.
> >
> Why is that? How do you start the transmit cycle? In my case this occurs in
> the transmitter startup routine which is equivalent to the Write fucntion
> in the HiDEOS driver.
When you enable the transmit interrupt an interrupt will occur as soon
as the 1 character transmit buffer is empty, i.e. almost always
immediately.
Here are some reasons for NOT outputing a character from the Write
(startup) routine.
A) NEVER do the same thing in 2 different places unless you have a VERY
good reason.
B) to put a character three things must happen:
1) the character must be copied from the memory buffer to the transmit
buffer.
2) The memory buffer pointer must be incremented.
3) The number of characters to transmit must be decremented.
If these three operations are done in more than one place you MUST get
exclusive access while the three operations are occuring.
The following should be safe:
Write does the following:
1)If the transmit mask is already set ignore the request, i.e. an
attempt is being made to sent 2 messages on the same port at the same
time.
2) Set the buffer pointer and number of characters used by interrupt
service routine.
3) Enable the transmit interrupt mask bit (must lock because it is
shared with other ports).
The interrupt routine
1) uses transmit mask and transmit ready to decide when to move a
character to the transmit buffer.
2) turn off transmit mask when last character sent or error occurs.
I agree with Peregrine that the SR should be used to check for errors.
Marty Kraimer
- Replies:
- Re: Greenspring rs422 support Andrew Johnson
- References:
- Re: Greenspring rs422 support Peregrine M. McGehee
- Navigate by Date:
- Prev:
Re: synchronizing client requests & completions Peregrine M. McGehee
- Next:
Re: Greenspring rs422 support Andrew Johnson
- Index:
1994
1995
1996
1997
<1998>
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Greenspring rs422 support Peregrine M. McGehee
- Next:
Re: Greenspring rs422 support Andrew Johnson
- Index:
1994
1995
1996
1997
<1998>
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|