Discussion Forum

Problem in Interrupt Enable process

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Wang Zhijian
Posted
5-Oct-2000 06:25 GMT
Toolset
C51
New! Problem in Interrupt Enable process
since working with RTX, to enable interrupt should be operated by os_enable_isr(), and directly setting bit in IE is no useful......but, the problem is why it failed to call os_enable_isr(4) to enable serial port0 interrupt.......anybody can give me some advice on it. thanks in advance.
Read-Only
Author
Wang Zhijian
Posted
5-Oct-2000 08:43 GMT
Toolset
C51
New! RE: Problem in Interrupt Enable process
According to the result of trace, it failed when to check a base-address add the specified interrupt number, the address(in Code address) return 0, then it return fail information.......why did it return fail? what should I put in the address? any other way to enable interrupt except the RTX function os_enabled_interrupt()?
Read-Only
Author
Keil Support
Posted
5-Oct-2000 10:10 GMT
Toolset
C51
New! RE: Problem in Interrupt Enable process
Did you create an interrupt function?

Keil Support
Read-Only
Author
Wang Zhijian
Posted
5-Oct-2000 12:29 GMT
Toolset
C51
New! RE: Problem in Interrupt Enable process
Yes, of course.

Now I can get a very simple example with interrupt and RTX-51 tasks to work well now. But my original program still can work, but the two programs are in the same proccess on interrupt.

Thanks very much
Read-Only
Author
Keil Support
Posted
10-Oct-2000 07:53 GMT
Toolset
C51
New! RE: Problem in Interrupt Enable process
I got this working in RTX51. It was pretty straight-forward.

1. Create the interrupt service routine as you would in a standard Keil C51 program. This is the int0 function in the following example.

2. Create some code that enables the interrupt source. The statements EX0 = 1; and IT0 = 1; in the startup task do this.

3. Call the os_enable_isr function and pass the interrupt number. This is also done in the startup task.

For example:

#include <rtx51.h>
#include <reg51.h>
#include <stdio.h>

#define STARTUP_TASK 0

//-----------------------------------------------
//-----------------------------------------------
void int0 (void) interrupt 0
{
static unsigned int i;

i++;
}

//-----------------------------------------------
//-----------------------------------------------
void task0 (void) _task_ STARTUP_TASK
{
os_set_slice (1000);        /* Set for OSC Frequency / 10,000 */

EX0 = 1;                    /* Enable External Int 0 */
IT0 = 1;                    /* Edge-triggered */

os_enable_isr (0);          /* Enable interrupt #0 */


while (1)
  {
  os_wait (K_TMO, 100, NULL);
  }
}
//-----------------------------------------------
//-----------------------------------------------
void main (void)
{
os_start_system (STARTUP_TASK);
}


You may download this complete uVision2 application from the following URL:

http://www.keil.com/download/docs/rtx51_ints.zip.asp

Keil Support
Read-Only
Author
Wang Zhijian
Posted
10-Oct-2000 13:28 GMT
Toolset
C51
New! RE: Problem in Interrupt Enable process
Thanks very much.
I've got it work now.
Read-Only
Author
Wang Zhijian
Posted
6-Oct-2000 10:24 GMT
Toolset
C51
New! RE: Problem in Interrupt Enable process
Can anybody give me some information about it? Thanks in advance.

Next Thread | Thread List | Previous Thread Start a Thread | Settings