EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

UARTs and interrupts

Started by Ross Marchant May 11, 2005
Neil Kurzman wrote:
>>My own experience follows the teaching of one of my mentors in that one very >>rarely (if ever) needs to disable interrupts. In the 8051 world, use >>interrupt priority, short service routines and amenable data structures. In all >>of our 8051 communication products, I can not think of one that runs with >>interrupts disabled. Being an assembly language dinosaur helps here. > > > OK so how do you do a ring buffer without disabling interrupts during RX read , or a > Tx write? > The Interrupt could hit during that time. The Keil C sample disables RI during that > time.
The 51 core disables the interrupts while servicing an interrupt. It's THAT simple. Assuming you don't use different priorities for the interrupts refering to the same resource.
Grzegorz Mazur wrote:

> > The 51 core disables the interrupts while servicing an interrupt. It's > THAT simple. Assuming you don't use different priorities for the > interrupts refering to the same resource.
The 8051 core disables interrupts OF THE SAME PRIORITY while servicing an interrupt. An interrupt of a higher priority can interrupt one of a lower priority. In the old days it was still simple because the original 8051 had only two interrupt priority levels. However, some modern derivatives have more. Ian
I did not quite get a yes or no. I am using this on a PIC and 8051.
The Keil C example had interrupt disabled, so I did not look at it in detail.  I will
look to see if it can be done.
I an not a big fan of disabled interrupts.  I messes up the latency of the other
interrupts.

Neil Kurzman schrieb:
> I did not quite get a yes or no. I am using this on a PIC and 8051. > The Keil C example had interrupt disabled, so I did not look at it in detail. I will > look to see if it can be done. > I an not a big fan of disabled interrupts. I messes up the latency of the other > interrupts. >
An example for a buffer feeding routine without disabled interrupts for the 8051 is given in section 3.12 "Inline Assembler Code" of http://sdcc.sourceforge.net/doc/sdccman.pdf Greetings, Frieder
On 2005-05-17, Neil Kurzman <nsk@mail.asb.com> wrote:

> I did not quite get a yes or no.
Gee. Maybe there is no "yes or no" answer. -- Grant Edwards grante Yow! Put FIVE DOZEN red at GIRDLES in each CIRCULAR visi.com OPENING!!

Frieder Ferlemann wrote:

> Neil Kurzman schrieb: > > I did not quite get a yes or no. I am using this on a PIC and 8051. > > The Keil C example had interrupt disabled, so I did not look at it in detail. I will > > look to see if it can be done. > > I an not a big fan of disabled interrupts. I messes up the latency of the other > > interrupts. > > > > An example for a buffer feeding routine without disabled interrupts > for the 8051 is given in section 3.12 "Inline Assembler Code" of > http://sdcc.sourceforge.net/doc/sdccman.pdf > > Greetings, > Frieder
Thanks I will look.

Grant Edwards wrote:

> On 2005-05-17, Neil Kurzman <nsk@mail.asb.com> wrote: > > > I did not quite get a yes or no. > > Gee. Maybe there is no "yes or no" answer. > > -- > Grant Edwards grante Yow! Put FIVE DOZEN red > at GIRDLES in each CIRCULAR > visi.com OPENING!!
I hate when that happens.

The 2024 Embedded Online Conference