void serial_int (void) interrupt 4 //ISR for Serial interrupt
{
if((IE & BIT4) == BIT4) //UART interrupt source
REN = 1; // enables serial port reception { while(RI == 0) {} RI =
0; ucRxChar1 = SBUF;
} this is how i have written the ISR...
I am unable to run my program...
it is giving error...
is der any other way to write ISR?
REGARDS
MAYURI
Read-Only
Author Per Westermark
Posted 17-May-2012 07:53 GMT
Toolset C51
RE: Serial ISR for ADUC842
Per Westermark
Do you really think an interrrupt handler should have a busy-loop
where it waits for the hardware to be ready for something? Isn't the
intention with an interrupt handler that the processor interrupts the
normal program execution when the hardware gets ready for
something?
What hapens if you have an ISR that gets stuck in an infinite
loop? Will the main program ever run then?
By the way - did you seriously dislike the look of your post with
the code posted using the proper tags as described directly above the
message input box? What made you think using the tags was a bad idea
best avoided?
Read-Only
Author erik malund
Posted 17-May-2012 14:27 GMT
Toolset C51
RE: Serial ISR for ADUC842
erik malund
if((IE & BIT4) == BIT4) //UART interrupt source
do you really think the interrupt will fire if it is not
enabled?
did you seriously dislike the look of your post with the code
posted using the proper tags as described directly above the message
input box? What made you think using the tags was a bad idea best
avoided?
easy - requirs reading instructions
Erik
Read-Only
Author Mayuri Ghosalkar
Posted 18-May-2012 03:21 GMT
Toolset C51
RE: Serial ISR for ADUC842
Mayuri Ghosalkar
i have enabled all interrupts.
Am i suppose to include any registry/look up table or
something?
Am i missing out something?
Regards
Mayuri
Read-Only
Author Andrew Neil
Posted 18-May-2012 07:05 GMT
Toolset C51
RE: Am i missing out something?
Andrew Neil
Basic study of the 8051 architecture, and how to use it?
The 8051 has been around for years - there are plenty of examples,
tutorials, etc; eg,
#include<8051.h>
unsigned char str;
void init_serial() // Initialize serial port
{
TMOD=0x20; // Mode=2
TH1=0xfd; // 9600 baud
SCON=0x50; // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit , Receiving on
TR1=1; // Start timer
}
void transmit_data(unsigned char str) // Function to transmit data through serial port
{
SBUF=str; // Store data in sbuf
while(TI==0); // Wait till data transmit
TI=0;
}
void receive_data() interrupt 4 // Function to recieve data serialy from RS232 into microcontroller
{
str=SBUF; // Read sbuf
RI=0;
transmit_data(str); // Transmit to HyperTerminal
}
void main()
{
init_serial(); // Initialize serial port
IE=0x90;
while(1);
}
Try this to check the interrupt..
Read-Only
Author Erik Malund
Posted 18-May-2012 22:48 GMT
Toolset C51
that would require
Erik Malund
Try this to check the interrupt..
that would require that someone had an ICE for the ADUC842, or, at
least, an ADUC842. '51 derivatives are NOT identical re I/O
I do not know the ADUC but does it have separate UART interrupts
for recieve and transmit? code assumes so
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.