Society of Robots - Robot Forum

Software => Software => Topic started by: aruna1 on October 03, 2008, 07:17:40 PM

Title: interrupts tutorial
Post by: aruna1 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
Title: Re: interrupts tutorial
Post by: szhang 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!
Title: Re: interrupts tutorial
Post by: aruna1 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