thanks dave for the quick response. i just tried the code you posted, i still get the same results. my apologies...i must have been i bit vague on what i have posted. anyway, im still aiming for the same results... heres my code:
im using 12f675 by the way. One more thing, in setting up an interrupt on
GPIO.2, do i have to put a pull-up resistor on the pin?
------------------------------------------------------------------------
define OSC 20 'OSC (20Mhz)
INTCON=%00010000 'Enable Interrupt
OPTION_REG.6=0 'Trigger on Falling edge
CMCON = 7 'Disables Analog Inputs
ANSEL = 0 'Sets Analog Inputs as Digital I/O
on interrupt goto init
pause 500
VARS:
LED1 VAR GPIO.0 'LED Port
Rx VAR GPIO.3 'Receive Data Port
CS VAR GPIO.2 'Interuppt Port
BUFF2 var byte[17] 'Rx Recive read buff
SPEED con 188 'Sio data speed 4800bps
Cnt var BYTE 'Recive data count
RD1 VAR byte 'Read Data Counter
CN var BYTE 'Counter
X var word
cmd var word
CNT = 0
CN = 0
eeprom ["1111111111111111"]
INCLUDE "MODEDEFS.BAS"
TRISIO = %101010
'-----------------------------------------------------------------
' RX Data from remote
'-----------------------------------------------------------------
MAIN:
serin2 rx,SPEED,5,SUB,[wait("#"),str buff2\18\"@"]
IF BUFF2[0]=">" THEN
for cn = 0 to 16
read cn,rd1
if rd1 = buff2[cn] then
CNT=CNT+1
ENDIF
next cn
IF CNT = 16 THEN
IF BUFF2[16] = "1" THEN
cmd = 1
'trigger interrupt here
LOW CS
PAUSE 200
HIGH CS
endif
IF BUFF2[16] = "2" THEN
cmd = 2
'trigger interrupt here
LOW CS
PAUSE 200
HIGH CS
endif
gosub GetCmd
ENDIF
endif
SUB:
CNT = 0
rd1 = 0
goto main
end
'--------------------------------------------------------------------------
'Interrupt Handler
'--------------------------------------------------------------------------
disable
INIT:
pause 200
high LED1
pause 100
INTCON.1 = 0
RESUME
ENABLE
'--------------------------------------------------------------------------
'routines
'--------------------------------------------------------------------------
GetCmd:
select case cmd
case 1 ' BLINK LED
pause 100
FOR CN = 0 TO 1
HIGH LED1
PAUSE 30
LOW LED1
PAUSE 30
HIGH LED1
PAUSE 30
NEXT CN
RETURN
case 2 ' turn LED ON for 30 secs.
PAUSE 100
low spk
pause 30000
high spk
RETURN
end select
-------------------------------------------------------------------------
Its just that in case 2 subroutine... when i comment command "pause" the
interrupt works fine, but the 30sec auto-off doesnt work. when i put back the "pause" command, auto-off enabled, but the interrupt wont work in between the 30sec delay.
thanks again!
-trebdms-
keepin'itreal
Bookmarks