replace polling with interrupt

Hello Everyone, I am trying for the first time to write an interrupt driven routine. Here I want to transmit n*8 bytes of data over a serial interface

While( Count < n) { // sent an byte

for(;;) // i will be polling the registers to check which flag is set { read_register() If (Tx_Flag_Successful) Decrement Count break else Count=0 ; Resend data from begining } }

Now if I want to replace the above with an interupt driven process, I can do so easily for the inner for loop(). If I want to replace even the while loop ( i.e transmit a bolck of data with interrupts) how can I do it ? Please advice me on this.

Thanks in advance, Warm Regards, Swathi

Reply to
swathimathur80
Loading thread data ...

On 30 Jun 2006 11:26:35 -0700, snipped-for-privacy@gmail.com wrote in comp.arch.embedded:

What processor or microcontroller? What UART?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
Reply to
Jack Klein

Reply to
swathimathur80

On 1 Jul 2006 03:36:17 -0700, snipped-for-privacy@gmail.com wrote in comp.arch.embedded:

If you are using an unidentified proprietary OS, it will be very difficult for anybody here to help you. How you set up an interrupt routine is usually very dependent on the OS.

Reply to
Jack Klein

Whoa - hold on one sec. Are you trying to use a UART to send data over I2C? Does your UART have a I2C mode then?

In general, setting up IRQ-driven transmission involves the following steps: - set up a pointer to the start of a buffer - enable a tx-buffer-empty interrupt - send the first character, increment the pointer - within the interrupt, send the next character if there is one and increment the pointer, else disable the interrupt

Steve

formatting link

Reply to
Steve at fivetrees

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.