Interrupts 101


Closed Thread
Results 1 to 3 of 3

Thread: Interrupts 101

  1. #1
    Join Date
    Oct 2009
    Posts
    4

    Default Interrupts 101

    Hello everyone. I am having a bit of a problem, this code (or it's equivalent) works merrily on assembler, but it seems to lose the declarations for the ports after if executes the interrupt routine.
    Can anyone tell me what I am doing wrong? This code works ok, but as soon as it hits the asm routine, it stops working. The interrupt works, the sequence works, values are sent to the variable portc.3 but the port does not respond. Even if I use "portc.3" instead for led4, it does not respond.

    Thanks for your help

    (at 4Mhz, there would be 234375 interrupts per minute, roughly 1500 interrupts per half a second)
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Somehow, I doubt it is this easy, but... what is the square on BCF IN "square" TCON,2 ???

    Code:
    ; Insert interrupt code here
             bsf   	_myflag		
           movf psave, W
                 movwf PCLATH
            swapf ssave, W
            movwf STATUS
                 swapf wsave, F
            swapf wsave, W
            bcf     IN   TCON,2
            bsf     INTCON      ,7
          retfie ; Return from      rupt
    endasm

  3. #3
    Join Date
    Oct 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default sorry about that

    I will have to revise that code, it was written on a PC, and copied to a MAC via USB thumbdrive, something got garbled in the way.
    The program was tested in MPLAB, the sequences work as expected, just the ports don't respond, or only some bits respond. It is not an MPLAB issue either, because a programmed chip does the same.
    Thanks

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  3. Microcode studio - PIC16F877A Interrupts
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th January 2009, 06:10
  4. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  5. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10

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