C8051F120 ISR List?

Discussion in 'Embedded Systems and Microcontrollers' started by crazyengineer, Jul 24, 2012.

  1. crazyengineer

    Thread Starter Member

    Dec 29, 2010
    156
    2
    In order to prepare for my microprocessor systems class, I brought the C8051F120 microprocessor. So I found the SDCC list of bit registers and sfr (page 7), but the problem is that I cannot find the list of ISR's for the C8051F120. Can someone please tell me where I can find them?
     
  2. Arm_n_Legs

    Active Member

    Mar 7, 2007
    183
    10
    I am not sure about SDCC. Maybe you can try the listing used by Keil C51.
    Interrupt 0 = external interrupt 0
    Interrupt 1 = timer 0 interrupt
    Interrupt 2 = external interrupt 1
    Interrupt 3 = timer 1 interrupt
    Interrupt 4 = serial interrupt
     
  3. JohnInTX

    Moderator

    Jun 26, 2012
    2,345
    1,027
  4. crazyengineer

    Thread Starter Member

    Dec 29, 2010
    156
    2
  5. JohnInTX

    Moderator

    Jun 26, 2012
    2,345
    1,027
    To round out what I think you are asking:

    The C code does not call interrupt routines. The processor gets interrupted and it calls the routine at the address specified by the interrupt source.

    Interrupt routines are special in that the interrupted code's context must be saved before executing any IRQ service (ISR) and restored before returning to the interrupted code. In C you will generally have some #pragma or other keyword associated with the ISR function definition that tells the compiler 1) that its an interrupt service and the compiler needs to save / restore context; 2)where to locate the code i.e. the vector and 3) in some 8051 implementations, which register bank to use.

    Between the brackets is up to you.. i.e. what the code does to service the interrupt must be written. You'll also have to sort out the various register settings to enable / configure the interrupt system for your chip and the hardware connected to it. Welcome to embedded programming!

    From your link, the class looks like a good one. The instructors may supply some standard routines if that's what you are looking for. Its more fun to write your own.

    Have fun.
     
  6. Arm_n_Legs

    Active Member

    Mar 7, 2007
    183
    10
    Are you asking about how to write interrupt routines in C. Below is an example of writing the timer 0 interrupt routine. The interrupt number, as in the example, 1 defines timer 0 interrupt. The number that corresponds to a particular interrupt is defined in the compiler manual.

    If you are using the Keil C51 compiler, the list can be found at http://www.keil.com/appnotes/files/apnt_103.pdf



    void timekeeper(void) interrupt 1
    {
    TF0=0; // Reset Interupt Flag​
    TH0=0xb8; // Next overflow in 5 ms​
    TL0=0x00;​
    }
     
Loading...