Author Topic: interrupts tutorial  (Read 8069 times)

0 Members and 1 Guest are viewing this topic.

Offline aruna1Topic starter

  • Supreme Robot
  • *****
  • Posts: 381
  • Helpful? 4
  • I'm an Ordinary guy
interrupts tutorial
« on: October 03, 2008, 07:17:40 PM »
hello
can some one give me a complete tutorial about using interrupts?(of course in C i don't know bit of assembly.so tutorial in CCS C would be great.)

what I'm trying to do is when in put value of a Analog signal change to specific level then carry out a specific task(for example when in put signal of analog pin 0 changes from 1v to 2v turn on  LED A and when input change from 2v to 3v trn on LED B).I use CCS C for programming. :)

thanks
I'm Me

Offline szhang

  • Robot Overlord
  • ****
  • Posts: 140
  • Helpful? 1
    • szhang.net
Re: interrupts tutorial
« Reply #1 on: October 04, 2008, 01:57:39 AM »
First, what device?

I never used CCS C, but most of the compilers come with rather detailed documentation about their supported functions.  Also, reading the datasheets is pretty much mandatory if you want to understand how things like interrupts work.

EDIT: I'll assume you're using the PIC12F675 like your last poast

In any case, you probably need the comparator interrupt, which means you'd need to provide a reference voltage on another pin.  Or you can use a timer interrupt and check every 10 ms or something for pin status changes.  It would probably be easier.


Here is a tutorial on interrupts, it also recommend reading the help file.
http://courses.ece.uiuc.edu/ece445/wiki/?n=Topics.PICCCSCInterrupts

EDIT2: Ewww, the tutorial seems to have a 20ms delay inside the ISR... that's very bad, don't do it!
« Last Edit: October 04, 2008, 02:09:17 AM by szhang »

Offline aruna1Topic starter

  • Supreme Robot
  • *****
  • Posts: 381
  • Helpful? 4
  • I'm an Ordinary guy
Re: interrupts tutorial
« Reply #2 on: October 04, 2008, 04:34:29 AM »
First, what device?

I never used CCS C, but most of the compilers come with rather detailed documentation about their supported functions.  Also, reading the datasheets is pretty much mandatory if you want to understand how things like interrupts work.

EDIT: I'll assume you're using the PIC12F675 like your last poast

In any case, you probably need the comparator interrupt, which means you'd need to provide a reference voltage on another pin.  Or you can use a timer interrupt and check every 10 ms or something for pin status changes.  It would probably be easier.


Here is a tutorial on interrupts, it also recommend reading the help file.
http://courses.ece.uiuc.edu/ece445/wiki/?n=Topics.PICCCSCInterrupts

EDIT2: Ewww, the tutorial seems to have a 20ms delay inside the ISR... that's very bad, don't do it!
thanks
I'm Me

 


Get Your Ad Here