Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 20th September 2007, 08:57 PM   (permalink)
Default Problem with processing interrupts

Hi everyone.
I would like to know how do we process interrupts caused by the INT pin(RBO) in mikrobasic language?actually im using the PIC16F877A .
thanks
vinke is offline  
Old 22nd September 2007, 12:11 PM   (permalink)
Default

Once you have setup and enabled the interrupt, it's going to automatically jump to the hardware interrupt vector when the interrupt fires. Do what you need to do in the interrupt handler routine, clear the interrupt flag bit, and exit the interrupt handler.

The data sheet tells you all you need to know about setting up and enabling the interrupt.

I'm not familiar with mikrobasic, but most BASIC PIC compilers don't allow BASIC statements in the interrupt handler. These tend to corrupt system variables used internally by the compiler. So you may want to check with mikrobasic on that one.

It may require code in your interrupt handler to be written in pure assembler.

Some BASIC compilers offer a polled interrupt option, where the BASIC program statements are allowed to finish before the interrupt is serviced.

With this option the compiler normally just inserts a return at the hardware interrupt vector. The interrupt fires, jumps to the hardware int vector, returns leaving global interrupts disabled, the BASIC command is allowed to complete, then it jumps to the actual interrupt handler routine.

This approach is incredibly slow at servicing the interrupt, and normally it's easier to do this yourself by just monitoring interrupt flag bits, and leaving global interrupts disabled.

Most all compilers have different methods, so it's definitely best to check with mikrobasic. Just to be sure.
__________________
Regards,

Bruce
http://www.rentron.com
breyno2 is offline  
Old 22nd September 2007, 01:11 PM   (permalink)
Default

Quote:
but most BASIC PIC compilers don't allow BASIC statements in the interrupt handler. These tend to corrupt system variables used internally by the compiler. So you may want to check with mikrobasic on that one.

It may require code in your interrupt handler to be written in pure assembler.
...
Some BASIC compilers offer a polled interrupt option, where the BASIC program statements are allowed to finish before the interrupt is serviced.
...
Unless you do not use interrupts either of these should be enough to make you look for a better compiler.
3v0 is online now  
Old 22nd September 2007, 05:28 PM   (permalink)
Default

thanks guys.i got the answer .its so easy.first enable GIE and INTE then write a sub procedure called 'interrupt' and any interrupt will be vectored at this sub procedure
vinke is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Problem with LED Driver (STP16C596) brian1234 General Electronics Chat 9 26th September 2006 09:53 PM
Status of a comparator affecting interrupts. 2camjohn Micro Controllers 7 19th July 2005 12:14 PM
RF tranceiver problem darvaish General Electronics Chat 2 3rd April 2005 08:44 AM
Mysterious Problem! matasoft Micro Controllers 15 11th September 2004 08:50 PM
Big thermocouple ADC problem Oznog General Electronics Chat 9 4th May 2004 09:42 PM



All times are GMT. The time now is 06:53 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker