Troubled with Instant Ints and TMR2


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Josuetas View Post
    Still cant get my 125us interrupt with 4Mhz internal OSC this should be possible unless DT´s routines take more than 125 instructions to work (just my guess),.. Patience....Again i am sure HE knows
    This page might explain it.
    http://darreltaylor.com/DT_INTS-14/kudos.html
    Especially the last paragraph.
    <br>
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Red face Ok now thats bad news

    So Darrel if i made this with just an ASM interrupt i would be able to get my 125uS since i wouldnt need the Reenter Context Saving...


    BUT please o please can you help me?..

    I use to get to this point where: i dont know any assembler!!!
    even worst
    A bit Array of 120 samples in Assembler .... mmm..... mmmmm....

    By the way would you consider (in my case) the pauseus 125 Take Sample option?

    Please some lead to solve this matter.

    Thanks again

    DJC

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    >> So Darrel if i made this with just an ASM interrupt i would be able to get my 125uS since i wouldnt need the Reenter Context Saving...
    Correct.

    >> A bit Array of 120 samples in Assembler .... mmm..... mmmmm....
    In ASM, you would just shift the bits into a byte var. After 8 bit's move to the next byte. After 15 bytes you're done.

    >> By the way would you consider (in my case) the pauseus 125 Take Sample option?

    YES!
    Your program just sits in a loop anyways, waiting for the sample to finish.
    No need to use interrupts, if it's not doing anything in the first place.

    Or, you can still use the timer. Just poll the TMR2IF Flag.
    <br>
    DT

  4. #4


    Did you find this post helpful? Yes | No

    Default Thanks for your advise Darrel

    I will keep working on the interrupt option... This is supposed to detect DTMF (we talk about it before) so for it to work in the background of anything else is the best choice.

    Everything is so complicated in ASM!.. thanks god there is picbasic.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Here's a quick untested stab at an ASM handler.

    Change the Handler type to ASM
    Code:
    Samples      VAR BYTE[15] BANK0 SYSTEM
    SamplePTR    VAR BYTE     BANK0 SYSTEM
    SamplesAddr  CON EXT
    @SamplesAddr = Samples
    BitCount     VAR BYTE     BANK0 SYSTEM
    ByteCount    VAR BYTE     BANK0 SYSTEM
    FlagSample   VAR BIT
    TMR2ON       VAR T2CON.2
    
    ;----[Start getting the 120 samples]------------------------------------------
    GetSamples:
        FlagSample = 0
        SamplePTR = SamplesAddr
        ByteCount = 15
        BitCount  = 8
        PR2 = 125 : TMR2 = 0 : TMR2ON = 1
    return
        
    ;----[TMR2 Handler]-----------------------------------------------------------
    ASM
    Sample
        MOVE?BB  SamplePTR, FSR      ; Load FSR with pointer to array
        MOVE?TT  CMCON,7, STATUS,C   ; Put sample in carry flag
        rrf      INDF, F             ; Shift in the sample bit
        decfsz   BitCount, F         ; Are all 8 bits in ?
        goto     Int_Done            ;   NO, done for now
        MOVE?CB  8, BitCount         ;   Yes, reset bitcount
        incf     SamplePTR, F        ;     Point to next byte
        decfsz   ByteCount, F        ; Are all 15 bytes done ?
        goto     Int_Done            ;   NO, done for now
        MOVE?CT  1, _FlagSample      ;   Yes, Indicate - Samples Complete
        MOVE?CT  0, _TMR2ON          ; stop the timer
    Int_Done
        INT_RETURN
    ENDASM
    DT

  6. #6


    Did you find this post helpful? Yes | No

    Smile I Will be testing it for the next couple of hours

    Your wish to help is INFITE and appreciated Darrel.

    Thanks Again
    Last edited by Josuetas; - 5th October 2007 at 16:32.

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Ha!

    You are using ....

    LCD_AnyPin
    Instant Interrupts
    Elapsed Timer


    and you showed your "Colors" when posting.

    How could I possibly Not Help??
    <br>
    DT

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