Thread: Help with writing an interrupt

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    3

    Unhappy Help with writing an interrupt

    Hello people,

    Forgive me but I am quite new to C and have a project I am currently working on. At the moment I have found out I need to write my own interrupt for a sensor to be detected. I have looked at a few books but they have not been helpful. I need to know what to look out for and what needs to be defined

    Bearing in mind my C skills are beginner at best. Please Help.

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Methinks! you need to write an interrupt handler for the task.
    If the problem's defined better then someone can help, as in
    What interrupts the sensor and how?
    How does the sensor process the interrupt?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > At the moment I have found out I need to write my own interrupt for a sensor to be detected.
    I'm assuming that this is for some development board, with a PIC or an AVR micro-processor (or similar on it).

    We need a lot more detail than this to even make an attempt at helping:
    - which compiler are you using (for the target board)?
    - is there an OS on the board, or is it "bare metal" programming?
    - which sensor?
    - how is it wired to the processor?

    Web links to data sheets for boards and sensors are a good bet.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    3
    Hi sorry for not being clear earlier,

    1, It is a vibrating sensor I am trying to connect.
    http://www.rapidonline.com/netalogue/specs/78-0767.pdf

    2, The board in question is the ez430-rf2480
    http://focus.ti.com/lit/ug/swru151a/swru151a.pdf
    Z-Accel Demonstration Kit - EZ430-RF2480 - TI Tool Folder

    3, Yes it is bare metal programming.

    4, I am using the IAR embedded work bench IDE

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    3
    Thank's guys

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Seismic - Block Diagrams, Reference Designs and Recommended Products
    A rummage through the application notes revealed this.

    There's usually some example programs around to get started. But be prepared to do a lot of reading along the way.

    In order, I would suggest you try
    - lighting a LED
    - making the LED flash periodically
    - wire a simple on-off switch to a non-interrupt pin, then make the LED follow the state of the switch
    - do the same, but this time use interrupts.


    Your sensor would appear to be either "on" or "off" in its resting state. You might need some additional logic gates to provide you with an interrupt when there is a state change, and also provide that data to a non-interrupt pin so you can read the state (if that is important).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems installing Mingw5.1.4
    By BlackOps in forum C Programming
    Replies: 2
    Last Post: 07-26-2009, 03:28 AM
  2. Pointer within a Struct
    By Bladactania in forum C Programming
    Replies: 11
    Last Post: 04-03-2009, 10:20 PM
  3. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  4. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM