Instant Interrupts - Revisited - Page 5


Closed Thread
Page 5 of 20 FirstFirst 12345678915 ... LastLast
Results 161 to 200 of 773
  1. #161
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    sougata,

    I'm glad it's working out for you. And yes, it is more managable. Kinda the whole idea behind it.

    Squibcakes,

    No, it doesn't work that way.

    The AD_INT is fired on the completion of an A/D conversion. Not when the value changes.

    So, in your AD_INT handler, you could test to see if the recent A/D reading differs from the previous A/D value. If it does, call a subroutine.

    Then start another conversion before exiting the handler.

    Added: Or like sougata said, have a timer periodicaly start a conversion, then do the same.

    HTH,
    DT

  2. #162
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Hmm,

    That kind of defeats the purpose of what I wanted to do....

    All understood and thanks for the info.

    Rgds,
    Squib

  3. #163
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Use your compare module in special event trigger

    Hi Squibcakes,

    You can use your compare module to automatically fire your ADC at a given interval. So the ADC will automatically generate interrupts. In your interrupt routine compare the current value with the old value. Keep some margin as two consecutive results may be different even if your pot is unchanged. When a change is found set a flag and process it in your main loop.
    Regards

    Sougata

  4. #164
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Question Darrels' Bring Together Interrupts

    Hello,


    I have been toying with Darrels' interrupts and the elapsed timer

    programs. It's an amazing piece of work and just what I need at the

    moment. Thanks!

    Going on, I tried the "bring together" demo but that didn't go so

    well. It won't compile using MPASM. The error messages are ;


    FATAL ERROR too many errors
    Error line 15: redefination of VAR. (DT_INTS-14.bas)
    Error line 26: redefination of VAR. (DT_INTS-14.bas)
    Error line 27: redefination of VAR. (DT_INTS-14.bas)


    ........Etc.


    I am using the Pic 16f877 but that shouldnt matter at this point.

    Any ideas?

    Thanks John
    Thanks,
    Homerclese

  5. #165
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    mmm, weird, no problem here. so we talk about
    http://darreltaylor.com/DT_INTS-14/combine.html

    If so, did you add something special in the code or you're using EXACTLY the following...
    Code:
    LED1   VAR  PORTD.0
    LED2   VAR  PORTD.1
    
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    INCLUDE "Elapsed_INT.bas"    ' Elapsed Timer Routines
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT_INT,  _ToggleLED1,   PBP,  yes
            INT_Handler   TMR0_INT,  _ToggleLED2,   PBP,  yes
            INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    OPTION_REG = OPTION_REG & $80 | 1  ; Set TMR0 Prescaler to 256, leave RBPU alone
    @    INT_ENABLE   INT_INT     ; enable external (INT) interrupts
    @    INT_ENABLE  TMR0_INT     ; enable Timer 0 interrupts
    @    INT_ENABLE  TMR1_INT     ; Enable Timer 1 Interrupts  
    
    GOSUB ResetTime              ' Reset Time to  0d-00:00:00.00
    GOSUB StartTimer             ' Start the Elapsed Timer
    
    Main:
        IF SecondsChanged = 1 THEN  
           SecondsChanged = 0
           LCDOUT $FE,$C0, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
        ENDIF
    GOTO Main
    
    '---[INT - interrupt handler]---------------------------------------------------
    ToggleLED1:
         TOGGLE LED1
    @ INT_RETURN
    
    '---[TMR0 - interrupt handler]-------------------------------(Blinky Light)------
    T0Count  VAR WORD
    ToggleLED2:
        T0Count = T0Count + 1
        IF T0Count = 512 THEN T0Count = 0 : TOGGLE LED2
    @ INT_RETURN
    which version of PBP and MPASM are you using?

    Are all files located in the same folder?
    Last edited by mister_e; - 2nd March 2007 at 01:11.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #166
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Question

    Hello,

    I tried a cut and paste of your code and got a whole new set of errors. The only code differences I could find were the ones at the top for outputting to a LCD display. The include files all exist in my usual PBP folder. I'm using Microcode Studio version 2.2.1.1 with Pic Basic Pro 2.40.


    Thanks John
    Thanks,
    Homerclese

  7. #167
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    did you get...
    <img SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1438&stc=1&d=117284877 8">

    If so, make sure you have selected MPASM in the View>> Compile And Program option >>> Assembler

    EDIT
    Pic Basic Pro 2.40.
    I don't know if it could be the problem... The current version is now 2.47.
    Attached Images Attached Images  
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #168
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Question

    Gettin' better!

    MPASM box was not checked. I didn't know it existed. No errors on compile now, however it can not find the .HEX file for programming. I did a system search and there is no .HEX file generated after compile. There are .HXH and .HXL files.

    Is your result box a screen capture?

    Thanks again
    Thanks,
    Homerclese

  9. #169
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It happen because you probably have selected INH8XS file format under the MPASM check box. use INHX8M instead.

    Is your result box a screen capture?
    Yes indeed, CTRL + PrintScr, then you paste it in Paint or whatever else to edit it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #170
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Question

    Good, That worked. However, when I add a line to the top of the program as simple as :
    TRISA = %00000000
    AlarmOUT VAR PORTA.0

    I get

    Error[113 cbp\pbpic14.lib 1588 : Symbol not previously defined (port A)
    Error[113 cbp\pbpic14.lib 1612 : Symbol not previously defined (port A)
    Error[113 cbp\pbpic14.lib 1619 : Symbol not previously defined (port A)

    .........Etc.


    Also, going back to the previously working "elapsed timer demo" and using the MPASM settings I get the same type of errors there if I try to add a port reference.

    I can get the result box into Photoshop but can't get the edited image to paste into the forum.


    Thanks
    Last edited by Homerclese; - 3rd March 2007 at 20:44.
    Thanks,
    Homerclese

  11. #171
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    <table><td></td><td>It really drives me nuts when it work here but not elsewhere. Ok then just copy/paste your code here and place it between code bracket. you just need to type...

    [code]
    ---paste your code here---
    [/code]

    to edit your screen capture, use Windows paint. If you don't find it, click on Start> run then type mspaint. then save it to a .jpg file</td></table>
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #172
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Homerclese View Post
    Good, That worked. However, when I add a line to the top of the program as simple as :
    TRISA = %00000000
    AlarmOUT VAR PORTA.0

    I get

    Error[113 cbp\pbpic14.lib 1588 : Symbol not previously defined (port A)
    Error[113 cbp\pbpic14.lib 1612 : Symbol not previously defined (port A)
    Error[113 cbp\pbpic14.lib 1619 : Symbol not previously defined (port A)

    .........Etc.


    Also, going back to the previously working "elapsed timer demo" and using the MPASM settings I get the same type of errors there if I try to add a port reference.

    I can get the result box into Photoshop but can't get the edited image to paste into the forum.


    Thanks
    You said you were using the 16F877. Are you sure it's not the 16F877A?
    'cause if it is, you need to upgrade your PBP. You said you've got PBP 2.40. The 16F877A isn't supported until PBP 2.42

  13. #173
    Join Date
    Oct 2005
    Posts
    35


    Did you find this post helpful? Yes | No

    Unhappy

    "Not previously defined" error was caused by having PortA instead of PORTA. It's 4AM and I think MPASM is the cause of some strange chip behavior. Only when I uncheck MPASM do I get back to a working 16F877 chip. I patched pic basic Pro to 2.40 but any attempts to go higher are met with "unknown version" errors. I'll hit it again tommorrooowww....

    "Homer sleep now".
    Thanks,
    Homerclese

  14. #174
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    somehow strange but you could still try to uncheck the Case Sensitive option in MCS.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  15. #175
    Join Date
    Aug 2005
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    Darrel,
    I recently replaced the On Interrupt code in an existing program with the RX_INT and it works great.The code was reduced by 127 words and I was able to eliminate a interrupt anomaly I sometimes experienced.Though compilation was successful,I would get a warning "Temp variables exceeding T4",which was generated in the ReEnterPBP.bas.I found what caused it in my code was this long comparison evaluation "if (fwd_cycle_comp = 1 and portb.4 = 1 and portb.2 = 1 and porta.0 = 1) or (datain1 > 1638) then".If I shortened the code the warning disappeared.Since everything was working fine I commented out the error routine for T4.I am using the latest Mplab and PBP.
    Thanks & Good Job

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by arniepj View Post
    Since everything was working fine I commented out the error routine for T4.
    As long as the long formula isn't in the Interrupt Handler, you should be OK.

    There's no way for the program to tell if a complex formula is in the handler or somewhere else. So I err'd on the side of caution and had it give a warning no matter where it is.

    Glad you like it.
    DT

  17. #177
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    So I err'd on the side of caution and had it give a warning no matter where it is.
    Maybe on POST 116 which is few time after the Green splat thingy
    http://www.picbasic.co.uk/forum/show...&postcount=116
    Last edited by mister_e; - 6th March 2007 at 23:15.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #178
    Join Date
    Mar 2006
    Posts
    41


    Did you find this post helpful? Yes | No

    Smile DT_INTS with MPLAB 7.50

    Good day to all!!!
    I'm Ryan from the philippines i've been wanting to use my homebuilt icd2 but i'm having a hard time compiling my sourcecode with Darrel's instant interrupt in MPLAB has anyone tried and successfully compiled it in MPLAB?
    To anyoneThanks in advance!!!

  19. #179
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    is this happen to ANY PBP program or just when using DT-INT.

    I don't know why it shouldn't. can you at least post some code OR the errors message + PIC#
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  20. #180
    Join Date
    Mar 2006
    Posts
    41


    Did you find this post helpful? Yes | No

    Default here it is

    Yes indeed just when using dt_ints it fails to compile here are the following error message

    "Executing: "C:\PBP\PBPW.EXE" -p16F877A -ampasm -oq -z "SMS_CONTROL1_MPLAB.bas"
    Error[113] C:\PBP\PBPPIC14.LIB 2784 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2785 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2789 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2790 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2800 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2871 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2889 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2913 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2920 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2928 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2934 "
    Attached Files Attached Files

  21. #181
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by leisryan View Post
    Yes indeed just when using dt_ints it fails to compile here are the following error message

    "Executing: "C:\PBP\PBPW.EXE" -p16F877A -ampasm -oq -z "SMS_CONTROL1_MPLAB.bas"
    Error[113] C:\PBP\PBPPIC14.LIB 2784 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2785 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2789 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2790 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2800 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2871 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2889 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2913 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2920 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2928 : Symbol not previously defined (PortD)
    Error[113] C:\PBP\PBPPIC14.LIB 2934 "
    Which version of PBP?

  22. #182
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The problem is due to your LCD DEFINES
    Code:
        		' 	LCD Display
        		'	-----------
        	DEFINE LCD4X20 	
        	DEFINE LCD_DREG	       	PortD		' Set LCD Data to PortD
        	DEFINE LCD_DBIT	       	0		    ' Set starting Data to Bit0
          	DEFINE LCD_EREG	       	PortD		' Set LCD Enable to PortC
        	DEFINE LCD_EBIT        	5		    ' Set LCD Enable line to PortC.1
        	DEFINE LCD_RSREG       	PortD		' Set LCD Register Select to PortB
        	DEFINE LCD_RSBIT       	4		    ' Set LCD RS line to PORTC.0
        	DEFINE LCD_BITS	       	4		    ' Set for a 8 bit Bus
    Always make sure that ALL DEFINEs are properly written. you MUST use PORTD in uppercase.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  23. #183
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    The problem is due to your LCD DEFINES
    Code:
        		' 	LCD Display
        		'	-----------
        	DEFINE LCD4X20 	
        	DEFINE LCD_DREG	       	PortD		' Set LCD Data to PortD
        	DEFINE LCD_DBIT	       	0		    ' Set starting Data to Bit0
          	DEFINE LCD_EREG	       	PortD		' Set LCD Enable to PortC
        	DEFINE LCD_EBIT        	5		    ' Set LCD Enable line to PortC.1
        	DEFINE LCD_RSREG       	PortD		' Set LCD Register Select to PortB
        	DEFINE LCD_RSBIT       	4		    ' Set LCD RS line to PORTC.0
        	DEFINE LCD_BITS	       	4		    ' Set for a 8 bit Bus
    Always make sure that ALL DEFINEs are properly written. you MUST use PORTD in uppercase.
    Of course! That's right! Just like it says in the PBP manual on page 30!

  24. #184
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    and one suggestion, add
    Code:
    @ errorlevel -306
    as MPLAB output list a $%$%^ load of those annoying...
    Message[306] C:\PBP\PBPPIC14.LIB 624 : Crossing page boundary -- ensure page bits are set.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  25. #185
    Join Date
    Mar 2006
    Posts
    41


    Did you find this post helpful? Yes | No

    Smile thanks guys!!!

    thanks Mr. E!!! thanks skimask!!! next time i'll post my orcad and gerber file of my clone icd2 here so everybody can have a taste of it!!! trully wonderful debugger and fast programmer too!!!

  26. #186
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default On Change style Int with RB0

    Hi,

    I hope this is the right place to grab your attention. I am using a 16F73 @ 20Mhz with Hardware USART @ 115Kbps. I am using RB0 external interrupt portb.0 (can't help it only it is available) . Initially it is set to fire interrupt on a Low2High edge. Now when inside the interrupt I want to toggle the INT edge bit in the option_reg to have an interrupt on High2Low edge. The simple idea is to reset a timer when a variable duty cycle pulse begin and read the timer value when it turns off. Can't sit in a tight loop to watch if portb.0 = 0 cause got other tasks to do. So I am using Darrel's INT in both ASM and PBP. Here is the code:

    Code:
    ASM
    INT_LIST macro   ; IntSource,  Label,         Type,  ResetFlag?
        INT_Handler  INT_INT,     INT_ASM,        ASM,   NO
        INT_Handler  INT_INT,     _INT_PBP,        PBP,   YES    
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM    
    
    ; BELOW IS THE ASM INTERRUPT HANDLER
    ASM
    INT_ASM
           BSF   STATUS, RP0             ; SELECT BANK 1
           BTFSS OPTION_REG, INTEDG      ; CHECK THE INTERRUPT EDGE
           GOTO  EDGE_LOW
    
    ; IF HERE THEN EDGE IS HIGH2LOW AND INT OCCURED AND NEEDS TO BE ALTERED/////////
    EDGE_HIGH
           BCF   OPTION_REG, INTEDG      ; SET TO INTERRUPT ON LOW2HIGH TRANSITION
           CLRF  STATUS                  ; SELECT BANK0
           CLRF  TMR0                    ; CLEAR TIMER0
           BSF   _HIGH_EDGE              ; SET FLAG THAT THIS IS A LOW2HIGH_EDGE INT
           INT_RETURN                    ; RETURN FROM THE ASM INTERRUPT
    ; IF HERE THEN EDGE IS LOW2HIGH AND INT OCCURED AND NEEDS TO BE ALTERED ////////       
    EDGE_LOW       
            ; BANK1 IS ALREADY SELECTED
           BSF   OPTION_REG, INTEDG      ; SET TO INTERRUPT ON LOW
           CLRF  STATUS                  ; SELECT BANK0
           MOVF  TMR0, 0                 ; MOVE TIMER0 TO W
           MOVWF _TIMER                  ; MOVE TO THE TIMER VARIABLE IN BANK 0
           BCF   _HIGH_EDGE              ; SET FLAG THAT THIS IS HIGH2LOW_EDGE INT
           INT_RETURN                    ; RETURN FROM THE ASM INTERRUPT
    ENDASM
    
    INT_PBP:                     '  PBP INTERRUPT HANDLER
    IF HIGH_EDGE = 1 THEN        '
    HSEROUT [10,"L2H",10]        '
    @ INT_RETURN                 ; RETURN FROM INSTANT INTERRUPT
    ELSE
    HSEROUT [10,"H2L",#TIMER, 10]
    ENDIF
    @ INT_RETURN                 ; RETURN FROM INSTANT INTERRUPT
    Now my questions are :

    1. Will this work ? Chances of false interrupt should not be, cause anyway while changing the option_reg the INT0 flag is not cleared and taken care of in the next PBP slice. Am I right ?

    2. Should I manually check the transmit buffert (TRMT) and do the transmission to make things faster or let it be handled by PBP (keeps my hairfall under control )

    P.S. : Actually I am counting on the email notification and everybody working with Darrel's II . Lester/Darrel please move this thread if you think that this should go as a new thread.
    Last edited by sougata; - 13th March 2007 at 19:26.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    As far as the interrupt routines go, it looks like it should work.

    But the limiting factor is the number of bytes you're sending the results with.
    Even at 115200, sending a string of 10 characters will take over 800us. With trying to find both high and low transitions you double that (1600us). So you'd be limiting the frequency to around 600hz.

    I don't think a buffer and TX handler would help speed it up, because it's just the total amount of data being sent that limits it. A buffer would just over-run if it couldn't keep up.

    HTH,
    DT

  28. #188
    Join Date
    Jan 2006
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Multiple interrupt

    Hi Darrel

    I've seen lots sample codes of digital clock and elapsed timer demos in this forum and all of them are using LCD as an output device. I was wondering why is it that nobody post sample codes driving 7-segment displays in multiplex mode?

    I've seen your code and it was amazing. I tried compiling it but i received errors. I'm using PIC16F628A, 4MHz xTAL and PICBasic Pro v2.33.

    I'm planning to test your code using TMR0 interrupt handling the refreshing of the 7-segments and TMR1 handling the 1/100 timer tick.

    Can you share to me sample approaches on how to handle the elapsed timer using 7-segment displays in multiplexed mode?


    emavil

  29. #189
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Thumbs up Thanks Darrel

    Hi,

    It works. Your II rules. I am using it to 100Hz and thanks for your concern.
    Regards

    Sougata

  30. #190
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    Interrupt for 18F's works fine.
    How to write assembly to set a variable instead of toggle led?

    Norm


    Code:
    '---[TMR1_INT - interrupt handler]------------------------------------------
    ASM
    ToggleLED1
        btg  _LED1               ; toggle the pin
        INT_RETURN
    ENDASM

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


    Did you find this post helpful? Yes | No

    Default

    That depends on the type of variable, and what you want to set it too.
    <br>
    DT

  32. #192
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    That depends on the type of variable, and what you want to set it too.
    INTERRUPT_SET VAR BIT
    set to 1

    Norm

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


    Did you find this post helpful? Yes | No

    Default

    Code:
    '---[TMR1_INT - interrupt handler]------------------------------------------
    ASM
    ToggleLED1
        MOVE?CT   1, _INTERRUPT_SET
        INT_RETURN
    ENDASM
    DT

  34. #194
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    Works good. Thank you.

    I would like to reload timer 1 on each interrupt from a variable.

    Something like:
    Code:
    wTIMER1 var TMR1L      ' access 16 bits of TMR1 
    wTimerPreload VAR WORD
    wTimerPreload  = 65211  'adjust in program
    
      
    '---[TMR1_INT - interrupt handler]------------------------------------------
    ASM
    ToggleLED1
        MOVE?CT   1, _INTERRUPT_SET    ; SET FLAG
        INT_RETURN
    
    wTIMER1 = wTimerPreload  ; in assembly
    
    ENDASM
    Norm

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


    Did you find this post helpful? Yes | No

    Default

    See this page...
    DT_INTS-14 (Timer Template)
    http://darreltaylor.com/DT_INTS-14/TimerTemplate.html

    It's in the 14-bit section, but it's pretty much the same for 18F's
    <br>
    DT

  36. #196
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    Interrupt now OK with one time adjustable Hz.

    Is their a way to change a Hz variable before each interrupt on?
    wFREQ_Hz var word

    Something like:

    ;--- Change these to match the desired interrupt frequency -------------------
    ;--- See http://DarrelTaylor.com/DT_INTS-14/TimerTemplate.html for more Info.
    ;@Freq = 10 ; Frequency of Interrupts in Hz
    @Freq = wFREQ_Hz ; in assembly

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


    Did you find this post helpful? Yes | No

    Default

    I don't have anything ready-made for DT_INTs like that.

    But this program has a routine to calculate the timer ticks required to produce a given frequency at a given dutycycle.

    Slow speed Software PWM
    http://www.pbpgroup.com/modules/wfse...hp?articleid=6

    Just use the SetSPWM and CalcSPWM routines.
    The interrupt portion isn't compatible with DT_INTS.

    HTH,
    DT

  38. #198
    Join Date
    Jan 2006
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Multiple interrupts

    Hi darrel,

    This is my follow up inquiry about your excellent code for multiple interrupts.

    I've seen your code and it was amazing. After compiling, Microcode studio locked up. I'm using PIC16F628A, 4MHz xTAL and PICBasic Pro v2.33.

    Your site states that MPASM is required. Does it have any relevance to the compilation?

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by emavil View Post
    Your site states that MPASM is required. Does it have any relevance to the compilation?
    Besides the fact that it won't work without it. No.

    Hmmm, PBP V2.33
    There's been at least a hundred different things fixed with PBP since that version from Several years ago.
    There's no telling what could be going wrong with such an ancient compiler.

    Time to spend the 10 bucks for an upgrade.
    DT

  40. #200
    Join Date
    Jan 2006
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    thanks a lot for that reply.

    I have also this notion that its really the PBP Compiler that limits me from utilizing your code. thank you very much.

    With regard to PBP 2.33. I managed to enable the feature of 16F628A coz if we look at the installation files, only 16F628 is present.

    Now, my question is, what is really the minimum version of PBP just to compile your "multiple interrupt" codes?

    You said 10 bucks, with all your respect, can you let me have that upgrade for that amount. I'm just a hobbyist and purchasing a new PBP compiler by far costly for me? What are the possible solutions can you suggest?

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 : 9

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