+ Reply to Thread
Results 1 to 7 of 7

Thread: at meg32

  1. #1
    ranjot singh Newbie
    Join Date
    Mar 2008
    Posts
    4

    Default at meg32

    hie all...does n e one knows how to use int0/int 1 in atmeg32. I couldn't understand how to do it. I have to write the code in C. I need two of my sensor inputs to be used as interrupts. please help .


  2. #2
    Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent
    Join Date
    Mar 2006
    Location
    Michigan, USA (GMT-5)
    Posts
    2,892

    Default

    I know how to do it. What is giving you the problem? Deciding which edge to use? Enabling the interrupt? Configuring the registers? Don't know how a part could get much simpler.
    We never have time to do it right; but we always have time to do it over.

  3. #3
    ranjot singh Newbie
    Join Date
    Mar 2008
    Posts
    4

    Default

    I couldn't get the c code for writing it. i mean i have to perform a particular function when say interupt1 is provoked. so i have to change instructions in the int1. how do i do that?

  4. #4
    Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent
    Join Date
    Mar 2006
    Location
    Michigan, USA (GMT-5)
    Posts
    2,892

    Default

    There is no preexisting set of INT1 instructions. There is a vector in low memory which points to a function that is to be executed when that interrupt occurs.

    Depending on the compiler that you are using, there will be a way to designate a function as an interrupt function. It is then the job of the compiler and the linker to link that interrupt function with the vector which the processor goes to for that interrupt source. The compiler will also take care of saving and restoring the machine state and putting an interrupt return instruction at the end of the function.

    I'm using CodeVision, so which compiler are you using?
    We never have time to do it right; but we always have time to do it over.

  5. #5
    ranjot singh Newbie
    Join Date
    Mar 2008
    Posts
    4

    Default

    i m using avrstudio.

  6. #6
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,665
    Blog Entries
    5

    Default

    Avr studio is the design enviornment, what compiler / assembler are you using?
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  7. #7
    Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent
    Join Date
    Mar 2006
    Location
    Michigan, USA (GMT-5)
    Posts
    2,892

    Default

    AVR Studio does have a built in assembler. There is also a hint that it supports the free and open source gcc compiler. I think the OP was asking about C code. So once again which C compiler are we talking about? Were not going to be able to help you very much if we ask you a question and you give us an answer to a different question. What exactly do you expect from us? Clairvoyance? Astral projection? What?
    We never have time to do it right; but we always have time to do it over.

+ Reply to Thread

Tags for this Thread