16f877 port configuration & interrupts


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    44

    Default 16f877 & interrupts

    For those who already ready this posting I had a duff pic!
    But I still have an Interrupt question

    My problem is I want to run a piece of code everytime RA1 < RA4 change status. Am I right in understanding that I can assign these all to one interrupt?
    Also when the interrupt happens will it stop it's current instruction? e.g. if I'm haveway through reading an rs232 input will it breakout or wait till it completed it's read?

    Is there a definitive idiots guide to interrupts and making sense of the datasheets for those of us who are learning?


    Rob
    Last edited by Rob Martin; - 15th April 2005 at 12:25.

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


    Did you find this post helpful? Yes | No

    Default

    1. You're out of luck if you want to use PortA for interrupt on pin change. Usually it's PortB (certainly on the 16F series, not sure on all the 18F) but your PICs Datasheet will tell you what triggers interrupts and what doesn't.

    2. PICBasic disables interrupts so that the current command completes execution before you get passed to your interrupt routine. There will be no problems if you use PICBasics interrupts. If you use Assembler interrupts then that's another story... PICBasic will be interfered with, commands such as DEBUG, SERIN, SEROUT etc will lose timing and you will lose Data, or in the least have it corrupted. If you're going to have Assembler interrupts then you really need to use the USART on the PIC and handle that externally from PICBasic as well.

    The Datasheet is the best and only informative document as to what you can and can't do with any PIC. Sorry there's no magic book or substitute - so make friends with it, save yourself the money and buy yourself a crate or two of beer (which also helps in the learning process).

  3. #3
    Join Date
    Mar 2004
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    I have a two beer fridges which probably wont help unless I can bribe someone to come round and teach me for beer

    I did download the data sheet and the interrupts sit on the RB pins as you thought. Having never used interrupts in my life I'm doing the time honoured way of trying to find some code that works as an example then break and see why it works. I'm not looking for a free ride I just need to get my head around how they work.
    From what you say If i need to act on three seperate pins I'll need to have three seperate interrupts on the three pins.

    Makes sense I just need to read and ask more questions

    Rob

Similar Threads

  1. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  2. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  3. port/ pin explanation 16F877
    By emmett brown in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th August 2006, 01:07
  4. Interrupts and Disable 16f877
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th April 2005, 21:08
  5. Interrupts using a 16F877
    By Niall in forum General
    Replies: 1
    Last Post: - 6th August 2003, 01:33

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