Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem with processing interrupts

Status
Not open for further replies.

vinke

New Member
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
 
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.
 
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.
 
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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top