View Full Version : PBP Interrupts for beginners
Tomexx
- 15th November 2004, 00:28
Does anyone have some beginner's tutorial for using Interrupts in PicBasic Pro?
mister_e
- 15th November 2004, 03:01
well almsot everything is well explain in the PicBasic book. but i just take this code example on melabs website
' On Interrupt - Interrupts in BASIC
' Turn LED on. Interrupt on PORTB.0 (INTE) turns LED off.
' Program waits .5 seconds and turns LED back on.
led var PORTB.7
OPTION_REG = $7f ' Enable PORTB pullups
On Interrupt Goto myint ' Define interrupt handler
INTCON = $90 ' Enable INTE interrupt
loop: High led ' Turn LED on
Goto loop ' Do it forever
' Interrupt handler
Disable ' No interrupts past this point
myint: Low led ' If we get here, turn LED off
Pause 500 ' Wait .5 seconds
INTCON.1 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
also see this thread... http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=550
hope this help you
regards
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.