PicBasic e Interrupt


Closed Thread
Results 1 to 2 of 2
  1. #1
    Alx PD's Avatar
    Alx PD Guest

    Question PicBasic e Interrupt

    Hi All
    I'm evalutating the real capability of PBP
    and a future use for my projects...

    The first App that i need to test is a control of a position
    by an encoder and write the number of pulse on a LCD ( HD44780 )

    i'm using a 16F628A and the frquency of the square signals of the
    encoder is about 1Khz timed 90 between them

    I'm using PortB as interrupt on change by PortB.4 e PortB.5
    A complete movements is 7200 pulses

    The problem is this:
    If i write on LCD at the end the complete movement the
    counting is ok and I read 7200

    If i write on LCD *during* the movement the
    counting is not ok: it losts some pulses
    ( about 10-20 for every write )

    Is possible that the LCDOUT stop the Interrupt ???

    I'tryed to write using the HSEROUT on a PC and the problem
    remain the same...

    If i use assemble language interrupt handler mode
    ( ref ASMINT.BAS ) con I' totaly resolve this problem ?

    Thank You
    Ciao
    Alx PD (it)

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default

    Hi Alx,
    If you're using PBP's built in interrupt then yes, the LCDOUT can make it loose counts. PBP way of doing interrupts is to always finish the current command and THEN jump to the Interrupt handler. Depending on how much info you're writing to the display the LCDOut statement may take several milliseconds to complete.

    Moving to an assmebler based interrupt handler will probably fix you up but an easier way, if your not that familiar with assembler is to use Darrel Taylors Instant Interrupt routines. Do a search on the forum and you'll find it. It will let you write your interrupthandler in Basic without the limitations of PBP's way of handling the interrupts and is very easy to setup and use.

    Another approach might be to switch PIC to a 18F2431 for example. It has built in hardware counter for quadrature encoders so you don't have to keep track of with software.

    Hope it helps.
    /Henrik Olsson.

Similar Threads

  1. 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
  2. How to use Interrupt on picbasic?
    By Shamir in forum mel PIC BASIC
    Replies: 2
    Last Post: - 1st June 2006, 14:29
  3. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  4. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07
  5. Replies: 0
    Last Post: - 27th August 2004, 07:20

Members who have read this thread : 0

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