+ Reply to Thread
Page 18 of 18 FirstFirst ... 81415161718
Results 681 to 696 of 696

Thread: Instant Interrupts - Revisited

  1. #681
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    557

    Default Re: Instant Interrupts - Revisited

    Hi,

    When using multiple interrupt sources you can prioritize which Interrupt flags to check when vectored to ISR, still the results may not be deterministic every time. Say you are already servicing a lower priority interrupt (not Hardware but DT's scheme) a higher priority interrupt like your time tick occurs. Generally adding the rolling timer with the offset value does the trick however if you would like more precision then use the compare module on the PIC which resets the associated timer automatically and gives a rock solid time base.
    Regards

    Sougata

  2. #682
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,750

    Default Re: Instant Interrupts - Revisited

    You need to fine tune the timer, not the OSC.
    Here is an example
    http://www.picbasic.co.uk/forum/show...3259#post23259
    And here is another
    http://www.picbasic.co.uk/forum/show...5912#post75912
    And this will help with the calcs.
    http://www.picbasic.co.uk/forum/cont....-PICMultiCalc


    Hi, we are pleased to see that you are using our forum.

    We'd like you to become a member of our community. Membership is FREE, please REGISTER and view our forums without these annoying reminders!

    Once registered you may post on the forums, download from the file areas and use the WIKI without interruption.




    Dave
    Always wear safety glasses while programming.
    http://mackrackit.cambs.net/

  3. #683
    Join Date
    May 2012
    Posts
    5

    Default Re: Instant Interrupts - Revisited

    Hello good people,


    I follow this forum for a long time, it is excellent! I found a lot of good stuff on it.


    Now I have a problem with the code from Mr. Darrel Taylor.


    Thus, I use pic18f2550 and connect DS1307z and 4 PWM channels to PORTA


    SDA Var PORTA.1
    SCL Var PORTA.0


    ASM
    SPWM_LIST macro
    SPWM_PIN PORTA, 2, _CH1
    SPWM_PIN PORTA, 3, _CH2
    SPWM_PIN PORTA, 4, _CH3
    SPWM_PIN PORTA, 5, _CH4
    endm
    SPWM_INIT SPWM_LIST


    INT_LIST macro
    INT_Handler TMR1_INT, SPWMhandler, ASM, yes
    endm
    INT_CREATE
    ENDASM
    @ INT_ENABLE TMR1_INT


    Now i got problem with this configuration. When i enable SPWM_LIST then RTC stop working, in fact he working but value he give, its not good. When i disable software pwm, RTC is working good.


    I hope that you understande what is my problem and that one of you has a solution for this problem.


    Sory for my english


    Thanks a lot, Damir

  4. #684
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,759

    Default Re: Instant Interrupts - Revisited

    Do you have this in your program ... ?

    Code:
    ADCON1 = 15
    DT

  5. #685
    Join Date
    May 2012
    Posts
    5

    Default Re: Instant Interrupts - Revisited

    Thank you for quick reply!

    Yes i have, this is configuration for my pic



    ADCON1 = $0F
    CMCON = 7
    UCFG.3 = 1
    PORTA = 0
    PORTB = 0
    PORTC = 0

  6. #686
    Join Date
    May 2012
    Posts
    5

    Default Re: Instant Interrupts - Revisited

    Just want to add,when I turn off TRM1 before reading i2c, rtc is operating normally, but problem is with LED strips on PWM channel they strart flashing.

    T1CON.0=0
    I2CRead sda,scl,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCDay,RTCDate,RTCMonth,RTCY ear]
    T1CON.0=1
    Last edited by DaTiNs; - 31st May 2012 at 13:09.

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

    Default Re: Instant Interrupts - Revisited

    Damir,

    I can duplicate the issue here, which appears to be the old R-M-W hardware problem.
    I moved the PWMs over to PORTC, and everything works fine.

    Since I2C uses pull-ups instead of bi-polar driven outputs, it's more susceptable to R-M-W problems.

    If you cannot move pins around on your project, you can get away with the following.
    In general, I do not recommend doing this type of modification.
    But in your specific case, it should work.

    Code:
      SPWM_LIST macro 
          SPWM_PIN LATA, 2, _CH1 
          SPWM_PIN LATA, 3, _CH2 
          SPWM_PIN LATA, 4, _CH3 
          SPWM_PIN LATA, 5, _CH4 
        endm
    DT

  8. #688
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,759

    Default Re: Instant Interrupts - Revisited

    I should have also mentioned that when using the LATA register, you'll need to set the pins to output manually.
    Code:
    TRISA = %11000011
    Last edited by Darrel Taylor; - 31st May 2012 at 19:56.
    DT

  9. #689
    Join Date
    May 2012
    Posts
    5

    Default Re: Instant Interrupts - Revisited

    Thank you very much!

    I must add TRISA = 0 to the begin of code, and then start work great.

    One more time, thank you, Damir.

  10. #690
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    346

    Default Re: Instant Interrupts - Revisited

    Darrel,
    While poking around and getting ideas, I got to looking at ver 1.2 of "Elapsed_INT-18.bas". I was particularly interested in the nice routine to calculate the timer reload constant:

    Code:
    ' -------------- calc timer reload Constants -------------------------------
    ASM
    T1PS = 1                             ; start with 1:1 postscaler
    TimerConst = ((OSC*1000000)/4/100)   ; how many timer ticks will it take
      while TimerConst > 65400           ; if it's more than the timer can count
    T1PS = T1PS * 2                      ;   double the postscaler
    TimerConst = TimerConst / 2          ;   halve the count
      endw
    TimerConst = 65536 - TimerConst + 8  ; final reload value
    But, I think there is an error in the formula. The absolute time it takes to execute the 8 instruction cycles doesn’t change. But, the time in relation to the TMR1L will be proportional to the prescaler. So, that should be accounted for in the formula, as such:
    Code:
    TimerConst = 65536 - TimerConst + (8/T1PS)  ; final reload value
    Since it's not likely the prescaler will need to be above 1:8, the 8/T1PS shouldn’t get too low.

    Thanks again for your great work and inspiring examples,
    Steve
    Last edited by SteveB; - 5th December 2012 at 22:38. Reason: typo

  11. #691
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    346

    Default Re: Instant Interrupts - Revisited

    The code could also be changed thus, not that it makes a difference:

    Code:
    T1PS = 1                             ; start with 1:1 postscaler
    TimerConst = ((OSC*1000000)/4/100)+8 ; how many timer ticks will it take
      while TimerConst > 65400           ; if it's more than the timer can count
    T1PS = T1PS * 2                      ;   double the postscaler
    TimerConst = TimerConst / 2          ;   halve the count
      endw
    TimerConst = 65536 - TimerConst      ; final reload value

  12. #692
    Join Date
    Aug 2005
    Posts
    40

    Default Re: Instant Interrupts - Revisited

    Hi Darryl,

    Currently getting an error with Latest MPLAB IDE:
    MPLAB 8.90.00.00

    PIC is an 18F45K22 and DT_INTS-18 is latest from your website, both MPLAM and DT_INTS were downloaded from the respective sites on 15/3/2013


    ERROR: Unable to execute mpasmwin.Warning[206] M:\<FOLDERPATH><FILE>ASM 2170 : Found call to macro in column 1. (INT_ENABLE)
    Error[116] M:\<FOLDERPATH><FILE>.ASM 696 : Address label duplicated or different in second pass (Z00032)
    Error[116] M:\<FOLDERPATH><FILE>.ASM 759 : Address label duplicated or different in second pass (Z00033)
    Error[116] M:\<FOLDERPATH><FILE>.ASM 812 : Address label duplicated or different in second pass (Z00034)
    Error[116] M:\<FOLDERPATH><FILE>.ASM 843 : Address label duplicated or different in second pass (Z00035)

    Can you advise if there is any fix for this or do i need to use an older version of MPLAB IDE

  13. #693
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,750

    Default Re: Instant Interrupts - Revisited

    Dave
    Always wear safety glasses while programming.
    http://mackrackit.cambs.net/

  14. #694
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    368

    Default Re: Instant Interrupts - Revisited

    I've used the DT_INTS sucessfully with an 18F4550. I had to move to an 18F87J50 but the DT_INTS would not compile. Not sure if I'm doing something wrong or if the DT_INTS was never tested with J series PIC's. When I compile, I get the following warning message:
    Code:
    Unable to fit variable VP_DelayCount in requested bank 0
    In the "VirtualPort.bas" code, I changed this code:
    Code:
    VP_DelayCount  VAR WORD BANK0  ; Used for internal Delay only
    to this:
    Code:
    VP_DelayCount  VAR WORD BANK1  ; Used for internal Delay only
    and it compiled as expected. I have no clue if this will cause unexpected problems with my program or if this is the correct way to solve it but I haven't noticed any ill effects yet. Seems like this problem could be related to the SFR's but it's way above my level of knowledge.

    Just thought I'd pass it along.

  15. #695
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,759

    Default Re: Instant Interrupts - Revisited

    NO! You can't just change the variable to BANK1!
    That variable must be in BANK0.

    Both DT_INTS-18 and VirtualPort.bas fit quite comfortably in an 18F87J50, with room to spare. Even when using PBPL.

    How many variables have you declared in BANK0 in your program?
    Or, what other include files are you using that may have variables placed in BANK0.
    DT

  16. #696
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    368

    Default Re: Instant Interrupts - Revisited

    Quote Originally Posted by Darrel Taylor View Post
    NO! You can't just change the variable to BANK1!
    Oh. The door was locked and I couldn't find the key so I just picked the lock.

    Quote Originally Posted by Darrel Taylor View Post
    How many variables have you declared in BANK0 in your program?
    Or, what other include files are you using that may have variables placed in BANK0.
    Good questions and ones that I wish I had answers for. I'm using HIDmaker so that's probably the root cause. Do I need to figure this problem out or is there a workaround?

+ Reply to Thread
Page 18 of 18 FirstFirst ... 81415161718

Similar Threads

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

Members who have read this thread : 204

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