Interrupt problems!


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    Iran
    Posts
    94

    Default Interrupt problems!

    Hi,
    i found that interrupt in pic basic works in small programs but in big programs it doesn't work especially in programs that use alot of if sentences.for example , scanning keyboard with polling method(using if sentences) interrupt doesn't work. i wanted to scan keyboard and when serial data is coming the program goes to taking serial information and then goes back to scanning keyboard but it didn't work.but when i use this interrupt with other programs (in programs that we don't have scanning keyboard) it works. so i want to know that do you agree with me or my idea is wrong?

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Wrong if your program take care a little bit and don't have too much PAUSE or else command that need time to execute.

    There's no real problem with IF, FOR, WHile, etc

    There's some problem with LCDOUT,PAUSE, PAUSEUS, ADCIN, COUNT, PWM, etc etc
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There is no problem with PBP Interrupts in any program be it small or large.

    You will have remembered (if you read the PBP documentation) that in PICBasic a jump to interrupt (ON INTERRUPT command) is only executed AFTER the current PICBASIC command has completed. So, for example, if an interrupt occurs at the start of say a PAUSE 5000 command, the jump to interrupt will not occur for almost FIVE SECONDS!! Some PBP instructions take a long time to complete, and those should be avoided if you are waiting for an interrupt which needs to be serviced quickly.

  4. #4
    Join Date
    Aug 2006
    Location
    Iran
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hi,
    i know about pause so when i wanted to make a 5sec delay i use this method:
    for i=1 to 5000
    pause 1
    next i

    but about lcdout, my program had alot of lcdout and also it had adcon too.maby this is the problem.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Pause 1 is still fair but i would use a loop of PAUSEUS 10 OR use an internal Timer and a loop... but it's just me

    LCDOUT could slow down a little bit, it will depend how much data you send. But it certainely don't need seconds to finish. Personnally i use internal, external eeprom to store the texts string, so i send i character at the time. Still faster and may avoid some interrupt latency.

    OR you may decide to use a variant of 'Embedded string in your codespace'

    There's some days like that where asm interrupt or instants interrupts are handy.

    Without your whole code it's hard to spot the problem(s)
    Last edited by mister_e; - 3rd November 2006 at 14:58.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. RB0 interrupt problems
    By amindzo in forum General
    Replies: 1
    Last Post: - 26th August 2006, 11:52
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts