Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Wow! 7 years & still adding pages! A conversation with Daryl led me here. I want to have an event occur just prior to the end of a PWM period. I was told it had to be done in assembly. My project is based on the PIC16F1828, uses CCP for PWM, DSM (Digital Signal Modulation) to embed HF within a slower PWM clock, and just before the Off/On I need to trigger an event. Got it working thanks to Daryl. Here's what it looks like:



    The code looks like this:


    define OSC 32
    define ADC_BITS 8
    define ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50

    #CONFIG
    CONFIG1_FOSC_INTOSC
    CONFIG1_MCLRE_OFF
    CONFIG1_CLKOUTEN_OFF
    CONFIG2_PLLEN_ON
    #endconfig

    OSCCON = %11110011
    TRISA = %00111100
    TRISB = %01100000
    TRISC = %11001011
    ANSELA = %00011111
    ANSELB = %01100000
    ANSELC = %11001011
    WPUA = 0
    WPUB = 0
    WPUC = 0
    MDSRC = %10000010 'DSM Activated (.7) on CCP1 (RC5) (<3:0>
    MDCARH = %10000011 'OOK Mode
    MDCARL = %10100000 'Disables Low Carrier Signal; OOK Mode
    MDCON = %11000000 '.7 Enables OOK, .3 Current State (read only)
    CLKRCON = %10110000

    b0 var byte
    b1 var byte
    b1 = 0
    LED1 VAR PORTC.5
    TPS_In var PORTC.7 'AN9

    INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler TMR2_INT, _SetTR4, PBP, yes
    INT_Handler TMR4_INT, _GP, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    'T1CON = %00110001 ; Prescaler=8, TMR1ON
    @ INT_ENABLE TMR2_INT ; enable Timer 2 interrupts

    Main:
    adcin 9, b0
    hpwm 1, b0, 1056
    PAUSE 1
    GOTO Main

    '---[TMR1 - interrupt handler]--------------------------------------------------
    SetTR4:
    T4CON = T2CON
    PR4 = PR2
    TMR4 = TMR2 - 246
    @ INT_ENABLE TMR4_INT
    @ INT_RETURN
    GP:
    pulsout PORTC.5, 5
    @ INT_DISABLE TMR4_INT
    '@ INT_CLEAR TMR1_INT
    @ INT_RETURN

    end


    All I can say is, I'm so glad I found ME Labs and now this forum. Overwhelming thanks to Charles, Daryl, and many whose work I've gleened from, but have yet to get to know personally.

    Mike

  2. #2
    Join Date
    Mar 2005
    Location
    CROATIA
    Posts
    38


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Hi, is there any known error /workaround for using eeprom "read"(didn't test write) while @ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts ?
    I use 16f1827, if I comment INT_enable line, all works great, but if line is enabled, read command return same index instead value
    i experimented with putting int_disable before read int_enable after, putting some pause between disabling/enabling GIE before/after read
    but nothing give me result, only when INT_enable commented, never executed, then works...

  3. #3
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    ShoKre, I have never had a problem using the READ and WRITE commands while having the interrupts enabled. I have used it with 18F8722, 18F67k22, 18f46k22, 18f4620, 18f452, 16f1825, 18f1320, 16f88, 12f1840.
    Maybe you should post some code and we here can have a look?
    Dave Purola,
    N8NTA
    EN82fn

  4. #4
    Join Date
    Mar 2005
    Location
    CROATIA
    Posts
    38


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    i figured out what interfere, i have readcode command in my (basic)ISR, and read in main-loop, after i commented readcode in isr read in main-loop has began to work, so, now i have to find another way
    for reading LED gamma table in isr, or pattern eeprom in main, at least I found what interfere, and the way will come, maybe put read in isr too.... there is more than 500ln of code so it will probably make
    treed dirty with non important/regarded stuff...
    ..it is good to know that there isn't other problems with dt-ints and read.
    ...found interesting or sad errata for 16f1827 http://ww1.microchip.com/downloads/e...Doc/80485G.pdf so ih you bught chip with 1M/100k read write eeprom/flash, you actually get 1k/10k , good to know for save lifespan with fewer writes... i was reading that when couldn't read eeprom...
    (sorry for my bad English if sentences sometime don't have sense

    thanx anyway,

  5. #5
    Join Date
    Nov 2014
    Posts
    2


    Did you find this post helpful? Yes | No

    Question Re: Instant Interrupts - Revisited

    Hi all

    Could anybody help me with a problem I'm having with using instant interrupts "Thanks to Darrel for all his work" and the IC3 module of the PIC18F2431
    I can get IC1 (CAP1) to work OK also IC2(CAP2) but when I compile using IC3 (CAP3) I get the following errors.

    Symbol not previously defined (IntFlagReg)
    Symbol not previously defined (IntFlagBit)
    ERROR: (Interrupt Source IntFlagReg,IntFlagBit) not found)

    Following is a snip-it from parts of the program and if I substitute IC3DRIF_INT for IC1IF_INT or IC2QEF and change the CAP3BUF's for 1 or 2 every thing works OK.

    I've tried every thing I can think of but not bright enough to sort this out.
    Using PBX 3.0.4.1


    INT_Handler IC3DRIF_INT

    INT_LIST macro ;IntSource, Label, Type, ResetFlag?

    INT_Handler IC3DRIF_INT, _InputSignal, ASM, yes

    @ INT_Handler IC3DRIF_INT

    InputSignal: 'Input pulse width capture of CAP3


    ReciverOutput.lowbyte = CAP3BUFL
    ReciverOutput.highbyte = CAP3BUFH

    Passthrough = ReciverOutut


    Thanks in advance Geoff

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Totally wild guess, Darrel's routine only has code for #1 and 2. Can't check includes and asm files from my phone, but I'd start there.

    Robert

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 22:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 21:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 21:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 07:32
  5. Replies: 1
    Last Post: - 1st November 2006, 04:11

Members who have read this thread : 4

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts