Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problems with UART interrupt

Status
Not open for further replies.

john2020

Full Member level 5
Joined
Nov 13, 2005
Messages
292
Helped
12
Reputation
24
Reaction score
8
Trophy points
1,298
Activity points
4,911
hi all,

The problem is when I start the uart_interrupt to get user input from keyboard, I found that the web server will be slow down and even stop echoing our request. If I disable the uart_interrupt, the web server works well again. It is strange that I didn't do anything special in our UART ISR.

Hopes you can help me

void uart_interrupt (void) small interrupt 4 using 0
/* ------------------------------------------------------------------------ --
* Purpose : Interrupt function. Save received char in buffer.
* Remarks : interrupt "4": seriel port interrupt, using cpu internal mem. bank "2"

************************************************************************ */
{
unsigned char ch;
int i;
// GPIO_LED = 0;//Light on LED
P3RxD = 1; //Force pull high //<<<<<<
ES = 0;
EA = 0;
if (RI) {/**************** Second problem ******************/
RI = 0;
/* save any framing error */
if (SM0) {
// uart_framing_error = TRUE;
SM0 = 0;
}
ch = SBUF;
rx_buf[rx_head] = ch;//save into ring buffer
rx_head = (rx_head + 1) & (RX_BUF_SIZE - 1);
}
P3TxD = 1; //Force pull high //<<<<<<
EA = 1;
ES = 1;
}

reply me as early as possible.

regards
john
 

void uart_interrupt (void) small interrupt 4 using 0

/****** You define USING 0 -> it is BANK 0 *******/
/* ------------------------------------------------------------------------ --
* Purpose : Interrupt function. Save received char in buffer.
* Remarks : interrupt "4": seriel port interrupt, using cpu internal mem. bank "2"

************************************************************************ */
{
unsigned char ch;
int i;
// GPIO_LED = 0;//Light on LED
P3RxD = 1; //Force pull high //<<<<<< //******* do not need
ES = 0; //******* do not need
EA = 0; //******* do not need
if (RI) {/**************** Second problem ******************/
RI = 0;
/* save any framing error */
if (SM0) { // uart_framing_error = TRUE; SM0 = 0;
return ; //******* char into SBUF is INVALID !!!}
ch = SBUF;
rx_buf[rx_head] = ch;//save into ring buffer
rx_head = (rx_head + 1) & (RX_BUF_SIZE - 1);
//*********** RX_BUF_SIZE is power of 2?
}
P3TxD = 1; //Force pull high //<<<<<< //******* do not need
EA = 1; //******* do not need
ES = 1; //******* do not need
}

//******* do not need -> better to delete

Where is trasmitting part ?
Must be error hiding into ?
 

hi kukaz

i did a mistake,i didnt add TI part,must have TI=0,you are right.

thanks
john
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top