This is a series of include files that simplify the process of creating
interrupt driven programs for PicBasic Pro.
MPASM required.
Once you try this, you may never use ON
INTERRUPT again.
<table border=0 cellpadding=5><tr><td valign=top>
Features:
Assembly language Interrupts
Basic language Interrupts
Both ASM and Basic interrupts in the same program
Service Multiple Interrupt sources
Prioritized execution order
Very easy to use
No ON INTERRUPT "Code Bloat"
No ON INTERRUPT " I'll service your interrupt
whenever I feel like it." mentality.
One of the best things about this system, is that you don't have to remember where all the Enable bits and
Interrupt flags are located.
Each
interrupt "source" is given a unique name that is used to reference it. The system "Looks Up" the correct bit locations for that name. Reducing those RTFM sessions to a minimum. The table to the right lists the Named Interrupts.
</td><td ><table border=1 cellpadding=5><tr><td valign=top nowrap> <center><b>Available
Interrupt Sources</b> 14-bit</center><pre> INT_INT -- INT External
Interrupt<br> RBC_INT -- RB Port Change
Interrupt<br> TMR0_INT -- TMR0 Overflow
Interrupt 16F<br> TMR1_INT -- TMR1 Overflow
Interrupt<br> TMR2_INT -- TMR2 to PR2 Match
Interrupt<br> TX_INT -- USART Transmit
Interrupt<br> RX_INT -- USART Receive
Interrupt<br> CMP_INT -- Comparator
Interrupt<br> EE_INT -- EEPROM/FLASH Write Operation
Interrupt<br> BUS_INT -- Bus Collision
Interrupt<br> PSP_INT -- Parallel Slave Port Read/Write
Interrupt<br> AD_INT -- A/D Converter
Interrupt<br> SSP_INT -- Master Synchronous Serial Port
Interrupt<br> CCP1_INT -- CCP1
Interrupt<br> CCP2_INT -- CCP2
Interrupt</pre></td></tr></table></td></tr></table>Here's a simple example of toggling an LED using the external
interrupt (INT). (Hello World)
Code:
<font color="#000000"><b>LED1 </b><font color="#008000"><b>VAR </b></font><b>PORTB</b>.<b>1
</b><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">"DT_INTS-14.bas" </font><font color="#0000FF"><b><i>' Base Interrupt System
</i></b></font><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">"ReEnterPBP.bas" </font><font color="#0000FF"><b><i>' Include if using PBP interrupts
</i></b></font><font color="#008000"><b>ASM
</b></font><font color="#000080">INT_LIST macro </font><font color="#0000FF"><b><i>; IntSource, Label, Type, ResetFlag?
</i></b></font><font color="#000080">INT_Handler INT_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE </font><font color="#0000FF"><b><i>; Creates the interrupt processor
</i></b></font><font color="#000080">INT_ENABLE INT_INT </font><font color="#0000FF"><b><i>; enable external (INT) interrupts
</i></b></font><font color="#008000"><b>ENDASM
</b></font><b>Main</b>:
<font color="#008000"><b>PAUSE </b></font><b>1
</b><font color="#008000"><b>GOTO </b></font><b>Main
</b><font color="#0000FF"><b><i>'---[INT - interrupt handler]---------------------------------------------------
</i></b></font><b>ToggleLED1</b>:
<font color="#008000"><b>TOGGLE </b></font><b>LED1
</b><font color="#000080">@ INT_RETURN</font>
<font size=-2>Code Size = 234 words</font>
<script language="javascript" src="http://www.darreltaylor.com/files/forum_ii.js"></script>
This project, and it's associated files, have been moved.
Please download them from my website.
DT_INTS-14 (12F-16F)
http://darreltaylor.com/DT_INTS-14/intro.html
DT_INTS-18 (18F)
http://darreltaylor.com/DT_INTS-18/home.html
<br>
Bookmarks