We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi! For a few months i started programming with ARM7(CPU:LPC 2138).I have this interrupt driven UART I/O:
void sio_irq (void) __irq { volatile char dummy; volatile char IIR; struct buf_st *p; /*------------------------------------------------ Repeat while there is at least one interrupt source. ------------------------------------------------*/ while (((IIR = U1IIR) & 0x01) == 0) { switch (IIR & 0x0E) { case 0x06: /* Receive Line Status */ dummy = U1LSR; /* Just clear the interrupt source */ break; case 0x04: /* Receive Data Available */ case 0x0C: /* Character Time-Out */ p = &rbuf; if (((p->in - p->out) & ~(RBUF_SIZE-1)) == 0) { p->buf [p->in & (RBUF_SIZE-1)] = U1RBR; p->in++; } break; case 0x02: /* THRE Interrupt */ p = &tbuf; if (p->in != p->out) { U1THR = p->buf [p->out & (TBUF_SIZE-1)]; p->out++; tx_restart = 0; } else { tx_restart = 1; } break; case 0x00: /* Modem Interrupt */ dummy = U1MSR; /* Just clear the interrupt source */ break; default: break; } } VICVectAddr = 0; /* Acknowledge Interrupt */ }
....
int __swi(8) com_putchar (int c); int __SWI_8 (int c) { struct buf_st *p = &tbuf; /*------------------------------------------------ If the buffer is full, return an error value. ------------------------------------------------*/ if (SIO_TBUFLEN >= TBUF_SIZE) return (-1); /*------------------------------------------------ Add the data to the transmit buffer. If the transmit interrupt is disabled, then enable it. ------------------------------------------------*/ if (tx_restart) { tx_restart = 0; U1THR = c; } else { p->buf [p->in & (TBUF_SIZE - 1)] = c; p->in++; } return (0); }
/*------------------------------------------------------------------------------ ------------------------------------------------------------------------------*/
int __swi(9) com_getchar (void); int __SWI_9 (int c) { struct buf_st *p = &rbuf; if (SIO_RBUFLEN == 0) return (-1); return (p->buf [(p->out++) & (RBUF_SIZE - 1)]); }
How can i modify this so that only when a specific character(for example:'#') is given then the interrupt flag is setting? Thank you in advance for any help.
Hi! very thanks for answer me. But still have question(please excuse my inexperience)
The signal can be a bit set in a global variable, for example.
How and where can i set this bit?
Please look up on the net: FIFO, circular buffer, signal flags, interrupt handler
i have looked for all that but i didn't find something good for signal flag and circular buffer. plaese when you have some links for me i would be thanksfull to have it.
Best regard
www.google.com/search
Well, as I've just been doing some searching on this, I have these 2 references to hand:
c2.com/.../wiki
www.embedded.com/.../printableArticle.jhtml
but you really need to learn how to use internet search engines effectively!
Thanks for trying to help me.I have found the solution of mein problem.
may God blessed you.