writing a interrupt program in 89c51

Discussion in 'Programmer's Corner' started by Abby, Jan 20, 2008.

  1. Abby

    Thread Starter New Member

    Jan 20, 2008
    2
    0
    i want to write a program to handle an external interrupt at int0

    for tht i must write a program a location 0013h

    how can i do this

    i using keil for programming
     
  2. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
  3. saha

    Well-Known Member

    Jun 1, 2006
    53
    0
    Hi,

    check this file a simple program copy and paste in keil save as .asm file add file to project . You should get it.

    regards,
    saha
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,790
    You should look in the compiler documentation for an "interrupt" keyword. This keyword will allow you to select which vector to use and more importantly tell the compiler to use an RETI instruction to return rather than the usual retrurn instruction.

    This is one of those "extensions" to the C language whose implementation is definitely non-standard. Whadya gonna do! -- Eh? Fageddaboudit!
     
  5. jvjtech

    Member

    Jan 26, 2008
    23
    0
    It has been a while since I worked with Keil tools. I took a look at the example suggested by Nanovate and see the "interrupt 0" qualifier on the ISR. I assume that the file REGS52.h maps this ISR to location 0013h as mentioned by Abby. A good source of reference information is the sample code available on the Keil and Atmel websites but one has to be aware of tool (compiler/assembler) specific twists. Regards.
     
Loading...