This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to use the interrupt keyword in 8051 C code.

Hi,

There is an application note on using the interrupt vectors in C51 c programming for 8051. It goes like this-

unsigned int int_count;
unsigned char second;

void timer0 (void) interrupt 1 using 2
{ if (++int_count == 4000) { /* count to 4000 */ second++; /* second counter */ int_count = 0; /* clear interrupt counter */ }
}

Can anyone explain what does that "using 2" at the end of the function denote?

I understand that interrupt 1 specifies that this is the ISR for interrupt number for timer0 overflow at adress 000Bh. Does the last keyword "using 2" denote the polling priority of the interrupt?

TIA,
Mrunmoy

Parents
  • Everyone that call any uC 'ugly' should examine their application vs the chosen chip.

    If you are going to produce in volume - or have very specific requiremens about power consumption, availability, support for magic function x, ... - you are seldom in a position to select a chip based on how funny and/or easy it is to program, or how efficiently it can handle an interrupt request.

    Then you can be in a position that you really, truly dislike a specific processor, but you will still select it for a product, or someone may already have designed the hardware and request software for it.

    Sometimes, a chip may be selected just because someone thinks that they own a compiler for it.

    I have worked with projects where the HW designer selected the uC because he happened to have made a construction with the same chip 5 years earlier - ignoring end-of-life, price, and need for external chips because of lack of built-in devices.

    Nothing is as funny as developing for a brand new chip that has so favourable price that it is selected on the speculation that the chip manufacturer _may_ be able to follow their projected release plan.

    If the chip is then suddenly delayed with 6 months, or the manufacturer reports that they can only deliver 1k instead of 10k chips, I can promise that you will consider the panic replacement chip an ugly *** when you try to port the source in a frenzy.

Reply
  • Everyone that call any uC 'ugly' should examine their application vs the chosen chip.

    If you are going to produce in volume - or have very specific requiremens about power consumption, availability, support for magic function x, ... - you are seldom in a position to select a chip based on how funny and/or easy it is to program, or how efficiently it can handle an interrupt request.

    Then you can be in a position that you really, truly dislike a specific processor, but you will still select it for a product, or someone may already have designed the hardware and request software for it.

    Sometimes, a chip may be selected just because someone thinks that they own a compiler for it.

    I have worked with projects where the HW designer selected the uC because he happened to have made a construction with the same chip 5 years earlier - ignoring end-of-life, price, and need for external chips because of lack of built-in devices.

    Nothing is as funny as developing for a brand new chip that has so favourable price that it is selected on the speculation that the chip manufacturer _may_ be able to follow their projected release plan.

    If the chip is then suddenly delayed with 6 months, or the manufacturer reports that they can only deliver 1k instead of 10k chips, I can promise that you will consider the panic replacement chip an ugly *** when you try to port the source in a frenzy.

Children
No data