PDA

View Full Version : how can imake interrupt by TMR0



eng.alamin
- 28th August 2008, 16:03
hello

am using picbaisc pro i want make interrupt every 50ms and goto spacial sup routine

iwant help plzzzzzzzzz

HenrikOlsson
- 28th August 2008, 16:30
Please (plzzzzzzzz) look at Darrel's Instant Interrupt routines (http://www.picbasic.co.uk/forum/showthread.php?t=3251&highlight=Instant+interrupts). It will let you do what you need.

/Henrik.

eng.alamin
- 28th August 2008, 16:57
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : [eng . Mohammad Alamin Ali] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 8/23/2008 *
'* Version : 1.0 *
'* Notes : ero servo driver *
'* : *
'************************************************* ***************

define osc 12

include "modedefs.bas"

value var byte
angle var byte
d var byte [16]
INTCON = %00100000
option_reg = %11100100
TMR0 = 100

on interrupt goto submain
INTCON = %10100000
main:

serin2 portc.1 , 84 , [WAIT($A6 ,$41), str d\9 ]


if d[0] = $C6 then


high portc.0


endif
goto main


disable
submain:


high portc.4

gosub servo1
gosub servo2
gosub servo3
gosub servo4
gosub servo5
gosub servo6
gosub servo7
gosub servo8
TMR0 = 100
INTCON.2 = 0


resume
enable

goto main

servo1:

servo2:

servo3:
.
.
.
etc

-------------------------------------------------------------------------------

this code spouse to jump to submain when timer over flaw but it never goto sub routine
idon't know why
!!!!!!
can you help me (please ) :)

regard

HenrikOlsson
- 29th August 2008, 06:06
Hi,
Which PIC is this?

/H.

eng.alamin
- 29th August 2008, 11:12
am using 16f877a but guess what i found the problem :)

the problem is going to sub routine from sub routine

but other wise it worked probably

thanx man for your attention