0
\$\begingroup\$

Recently I have come across the two terms in call back functions(Which will notify the User) in particular Project i)Interrupt Level ii)Task Level. My understanding is,

Interrupt Level

    The user will get a notification Instantly, though other Task is running.

Task Level

 The user will get notify if Running Task is Completed.

If above is Correct, then how we can Configure the Interrupt Level in MicroController. I know there will be GPIO Interrupt, UART Interrupt. My question how it will notify in interrupt level. Can we change any reserved Interrupt Table? or how it can accomplish.

\$\endgroup\$
2
  • \$\begingroup\$ Which MCU are you talking about? In 8-bit PICs, for example, there is a single interrupt which is combined with flags for deciding which interrupt(s) occurred. Other MCUs may have several interrupts with differing priorities. \$\endgroup\$ Commented May 14, 2015 at 12:57
  • \$\begingroup\$ I am using RH850 \$\endgroup\$ Commented May 14, 2015 at 12:59

1 Answer 1

1
\$\begingroup\$

Imagine you have a main loop. Your code is happily running through this main loop, over and over. One of the functions is to read a pin. If that pin goes high, then something has completed, and notify the user. This is a "task level" event, and only occurs when the main loop code calls that function, and the condition is true.

An interrupt happens immediately, regardless of where the main loop code was. So say you add an interrupt for incoming serial data. The main loop code is happily running, then a serial byte comes in. BAM! The position in the main loop is saved, and execution immediately jumps to the interrupt routine. This is an "interrupt level" event. Copy the received byte to RAM, then return. The main loop's position is restored, and it goes back to processing "user-level" tasks.

Main loop "task level" functions are relatively slow, and significant time can pass before the pin state is noticed, so they are used for general-purpose functions or those that are time-insensitive. Interrupts are used mainly for time-critical events which must be handled quickly, like serial data.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for your kind reply, as I mentioned I know the serial interrupt and Gpio Interrupt. Suppose say there are 3 task is running. Among that task, 1 task will run every 1 sec(which will check the some value). if condition met, It need to notify the user. How can I do this? whether I need to do some changes in interrupt settings of the Controller. \$\endgroup\$ Commented May 14, 2015 at 13:23
  • \$\begingroup\$ The RH850 has several variants and many, many documentations so I am going to guess. Most microcontrollers have a timer feature, either 8-bit, 16, or 32-bits wide. If yours were a 16-bit timer, and the uC clock were 8MHz but each instruction took 4 clock cycles (2M instructions per second), then 2M / 2^16 = 30.52 complete overflows of the timer to equal 1 second. So setup a byte variable, and increment it each time the timer overflows. (Timer should have an interrupt.) Once the value >= 30, almost 1 second has passed. \$\endgroup\$
    – rdtsc
    Commented Aug 21, 2015 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.