How to use interrupt on pic basic ?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Posts
    14

    Default How to use interrupt on pic basic ?

    Hi all,
    I'm new here and on picbasic,

    I'm working on a old version of program that written in PICBASIC, and I want to add interrupt to it, but I can't understand how to do it...

    On picbasic pro, there is "ON INTERRUPT" command but on picbasic I couldn't find how to do it, can you help me ?

    I know how to enable the interupt, and check for it, but how do i tell the chip to goto the interrupt routine when he get one ?

    Thanks
    Shamir

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


    Did you find this post helpful? Yes | No

    Default

    Interrupts in PBC can only be done in ASSEMBLER. PICBasic itself does not support or handle interrupts. See section 7.3 of the PBC Manual for your limitations.

    Refer to the DATASHEET of your PIC in order to discover how to set and enable them.

    Read and thoroughly understand the Microchip Mid-Range Reference Manual for the PIC features you intend to use.

    Unless you are skilled in Assembler, do not attempt interrupts in PBC.

    Since this is a PBC thread, I have moved it out of the PBP Section.

  3. #3
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    Shamir:

    There is a magazine called Nuts and Volts. It has an article this month on interrupts for PBASIC or PBISIC PRO (Sure it was the latter). Might want to get this months copy or see if parts of it are online.

  4. #4
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile another option - polling

    In some cases you can use the features of the interrupts without really using the interrupts. You can poll the interrupt bits and see when things happen. (The interrupt bits still get set even if all interrupts are disabled). In fact, this is my preferred way of handling most “interrupt issues,” even in PBP!

    For example (with a 16F628), if you wanted to use TMR0 interrupts, you could poll for the interrupt bit instead of actually using the interrupts.

    Symbol INTCON = $0B ' 16F628 location of INTCON
    Main:
    TimeLoop:
    peek INTCON, B0
    if Bit2 = 0 then TimeLoop ; no TMR0 overflow so keep polling
    poke INTCON, 0 ; TMRO overflow so reset flag

    rest of program here
    but less than overflow time of TMR0

    goto Main


    (Ihave not used PBC for 7 years but think the above format is correct)

    What interrupts are you wanting to use?

    Paul Borgmeier
    Salt Lake City, Utah
    USA

Similar Threads

  1. Pic to pic interrupt ans serial comm
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th May 2008, 22:43
  2. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  3. using AND as an IF statement
    By dw_pic in forum mel PIC BASIC
    Replies: 27
    Last Post: - 8th June 2006, 18:05
  4. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07
  5. How to use 93C46 Type EEPROM using PIC Basic PRo
    By in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st April 2003, 04: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