DT Instant Interrupts - Clarification?


Closed Thread
Results 1 to 23 of 23
  1. #1
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166

    Default DT Instant Interrupts - Clarification?

    Hi All,

    I am preparing to tackle my first project using interrupts and have been looking at Darrel's Instant Interrupts. The link I have is for DT_INST-18 Ver 3.3 but the web page says this is for use with PIC18F's. I intend to use a PIC12F683 or PIC12F1822 for my project. Am I correct in assuming that DT_INST-18 cannot be used on these devices? If so, is there another version which can be used?

    Cheers
    Barry

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    That is correct, there are two versions - one (DT_INTS-18) for PIC18 and one (DT_INTS-14) for PIC12 and 16. See here for more details.

  3. #3
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Hmmm.... it would appear that DT_INST-14 doesn't work with PIC12F683
    I downloaded Ver 1.1 of the application and trialed the "Hello World" program from Darrel's website.
    I made the necessary change from PORTB.1 to GPIO.1 for the LED1 variable but got a host of errors when compiling:

    Error[101] DT_INTS-14 TEST.ASM 235 : ERROR: (wsave variable not found,)
    Error[101] DT_INTS-14 TEST.ASM 201 : ERROR: (" Add:" wsave VAR BYTE $20 SYSTEM)
    Error[101] DT_INTS-14 TEST.ASM 256 : ERROR: (Chip has RAM in BANK1, but wsave1 was not found.)
    Error[101] DT_INTS-14 TEST.ASM 208 : ERROR: (" Add:" wsave1 VAR BYTE $A0 SYSTEM)


    Should I be able to do this with a PIC12F683?
    Can anyone provide some input to this problem?

    I have attached a copy of the full code for review.

    Cheers
    Barry
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    The cool thing is the answer is in the error message.
    Error[101] DT_INTS-14 TEST.ASM 235 : ERROR: (wsave variable not found,)
    Error[101] DT_INTS-14 TEST.ASM 201 : ERROR: (" Add:" wsave VAR BYTE $20 SYSTEM)
    So..
    Put
    wsave VAR BYTE $20 SYSTEM
    in your code's variable section.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Thanks Dave.

    I have added the two variables wsave and wsave1 as specified in DT_INST-14.bas
    I now have more errors at compilation:

    Executing: "C:\PBP\PBPMPLAB.BAT" -ampasmwin -k# -p12F683 "DT_INTS-14 Test.bas"
    Executing: "C:\PBP\PBPW.EXE" -ampasmwin -k# -p12F683 "DT_INTS-14 Test.bas"
    PICBASIC PRO(TM) Compiler 2.60C, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    Executing: "C:\PBP\PBPMPLAB.BAT" -ampasmwin -k# -p12F683 "DT_INTS-14.bas"
    Executing: "C:\PBP\PBPW.EXE" -ampasmwin -k# -p12F683 "DT_INTS-14.bas"
    PICBASIC PRO(TM) Compiler 2.60C, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    ERROR: Unable to execute mpasmwin.Error[113] C:\PBP\PBPPIC14.LIB 1165 : Symbol not previously defined (INT_ENTRY)
    Error[101] C:\PBP\PROJECTS\DT_INTS-14 TEST\DT_INTS-14.ASM 187 : ERROR: (wsave variable not found,)
    Error[101] C:\PBP\PROJECTS\DT_INTS-14 TEST\DT_INTS-14.ASM 153 : ERROR: (" Add:" wsave VAR BYTE $20 SYSTEM)
    Error[101] C:\PBP\PROJECTS\DT_INTS-14 TEST\DT_INTS-14.ASM 208 : ERROR: (Chip has RAM in BANK1, but wsave1 was not found.)
    Error[101] C:\PBP\PROJECTS\DT_INTS-14 TEST\DT_INTS-14.ASM 160 : ERROR: (" Add:" wsave1 VAR BYTE $A0 SYSTEM)
    Halting build on first failure as requested.

    Any clues here?

    Again, I have attached a copy of my main code for review.

    Cheers
    Barry
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    It's trying to compile both your source file and the include file separately.
    Remove DT_INTS-14.bas from the "Source Files".

    You should only have your main program in the source files list of MPLAB.
    DT

  7. #7
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Thanks Darrel - that did the trick.

    Now that I have the simple things sorted it is onwards and upwards to bigger and better phases of my project.

    Cheers
    Barry

  8. #8
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    OK, I have now tried to implement the DT_INST-14 routines into my main project code. The attached code file has sufficient comments to explain what it is doing.

    I am getting the following errors when I try to compile the program:

    Executing: "C:\PBP\PBPMPLAB.BAT" -ampasmwin -k- -p12F683 "PICSprayer.bas"
    Executing: "C:\PBP\PBPW.EXE" -ampasmwin -k- -p12F683 "PICSprayer.bas"
    PICBASIC PRO(TM) Compiler 2.60C, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    ERROR: Unable to execute mpasmwin.Error[127] C:\PBP\PROJECTS\PIC SPRAYER\PICSPRAYER.ASM 912 : Too many arguments
    Error[128] C:\PBP\PROJECTS\PIC SPRAYER\PICSPRAYER.ASM 473 : Missing argument(s)
    Halting build on first failure as requested.
    BUILD FAILED: Fri Jul 08 11:35:51 2011

    My code compiles properly without the interrupt routine for the manual switch operation. Now I just don't know where to start looking to fix these errors.

    Any help would be greatly appreciated.

    Cheers
    Barry
    PICSprayer.bas
    PICSPRAYER_r6.pdf

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Please post your code using code tags.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    You don't need to place these in your code;
    Code:
    wsave VAR BYTE $20 SYSTEM
    wsave1 VAR BYTE $A0 SYSTEM
    Just uncomment them in your DT_INTS-14.bas file.

    For assembly you need to use the ; for comments. INT_LIST macro should look like this;
    Code:
    INT_LIST macro       ; IntSource, Label, Type, ResetFlag?
      INT_Handler INT_INT, _ManualSwitch, PBP, yes
     endm
     INT_CREATE       ; Creates the Interrupt Processor
    ENDASM
    @ INT_ENABLE INT_INT      ; Enable external (INT) interrupts
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  11. #11
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Quote Originally Posted by Aussie Barry View Post
    OK, I have now tried to implement the DT_INST-14 routines into my main project code. The attached code file has sufficient comments to explain what it is doing.

    I am getting the following errors when I try to compile the program:

    Executing: "C:\PBP\PBPMPLAB.BAT" -ampasmwin -k- -p12F683 "PICSprayer.bas"
    Executing: "C:\PBP\PBPW.EXE" -ampasmwin -k- -p12F683 "PICSprayer.bas"
    PICBASIC PRO(TM) Compiler 2.60C, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.
    ERROR: Unable to execute mpasmwin.Error[127] C:\PBP\PROJECTS\PIC SPRAYER\PICSPRAYER.ASM 912 : Too many arguments
    Error[128] C:\PBP\PROJECTS\PIC SPRAYER\PICSPRAYER.ASM 473 : Missing argument(s)
    Halting build on first failure as requested.
    BUILD FAILED: Fri Jul 08 11:35:51 2011

    My code compiles properly without the interrupt routine for the manual switch operation. Now I just don't know where to start looking to fix these errors.

    Any help would be greatly appreciated.

    Cheers
    Barry
    Attachment 5752
    Attachment 5751
    Please replace your interrupt routine by code by this one, and post your results;

    Code:
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
    INT_Handler   INT_INT,   _ManualSwitch,   PBP,  yes
       endm
       INT_CREATE               ; Creates the interrupt processor
     
    INT_ENABLE  INT_INT     ; Enable 
    ENDASM

    EDIT: Bruce was faster than me...
    Last edited by gadelhas; - 8th July 2011 at 12:34. Reason: Bruce was faster
    Thanks and Regards;
    Gadelhas

  12. #12
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Thanks Bruce and Gadelhas.
    I have made the recommended changes and am pleased to advise that it now compiles correctly.
    Now to fire it up on the breadboard to see if it works as expected.

    Dave, I do no understand your comment regarding the use of code tags. Can you explain further or direct me to somewhere that will outline what I am not doing?

    Cheers
    Barry

  13. #13
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Hi All,

    I am pleased to announce that the external interrupt routine is now working properly. Thank you to all who have helped me resolve my problems - much appreciated

    To aid in my PCB layout I would like to move my ADC channels to AN1 and AN2. This will mean that I need to alter the type of interrupt from an external interrupt on GP2 to a Change on Interrupt on GP4. To do this I have changed the Interrupt Handler in DT_INST-14 from INT_INT to GPC_INT, Enable GPC_INT and enabled bit 4 of the Interrupt-On-Change GPIO Register (ie IOC.4=1). My interrupt switch is set up with a 10k pull-up resistor from GP4 to +5V and a momentary action switch from GP4 to 0V. The code compiles without error but the change on interrupt function does not work in "the real world".

    I would have thought this was a pretty straight forward change but I am obviously missing something important. Would someone please direct me to where I have gone wrong?

    Cheers
    Barry

  14. #14
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Hi Barry,
    In your latest attached code you have the line
    Code:
    ANSEL = %01011010       ' Set Fosc/16
    Which sets GPIO.4/AN3 to analog mode. Try changing it to digital if you haven't already done that.

  15. #15
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Hi Henrik,

    Yes, I had already changed the ANSEL register
    I had changed the TRISIO register too.
    Attached is my full code listing for reference.

    Now what? I am sure it is only something simple but I just can't figure it out...PICSprayer.bas

    Cheers
    Barry

  16. #16
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    [ code] remove the spaces in the brackets [ /code]
    Code:
     remove the spaces in the brackets
    It will save folks from having to download your code to look at it.
    Dave
    Always wear safety glasses while programming.

  17. #17
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Unless I am not following your changes right, It seems in your ISR you are still waiting while gpio.2 is high. since that is now an analog input (I think) it might just be zooming right through the ISR making it look as though it was never called.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  18. #18
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Yes, it was the GPOI.2 statement in the ISR that was causing the problem.
    All fixed now

    Code:
    This is a Code Space Test
    Hey, I even got the code space thing happening - I'm on fire!!!

    Thanks for all your help guys - really appreciate it.
    I will post details of the final project once it is all up and running - code, circuit diagram, PCB and some pretty pictures of the finished product.

    Cheers
    Barry

  19. #19


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Just continuing on from this thread i have my own question about DT Interrupts for the 12F683.

    Having looked at the example given by darrell for the generic timer the code below seems unecessary if we know what the values are for the prescaler etc?

    Code:
    ;---[TMR1 reload - interrupt handler]-----------------------------------------
    ASM ; Calculate Timer Reload Constant
    ReloadInst = 8; # of Intructions used to reload timer
    if ((Prescaler == 1)||(Prescaler == 2)||(Prescaler == 4)||(Prescaler == 8))
    MaxCount = 65536 + (ReloadInst / Prescaler)
    TimerReload = MaxCount - (OSC*1000000/4/Prescaler/Freq)
    if ((TimerReload < 0) || (TimerReload > (65535-ReloadInst)))
    error Invalid Timer Values - check "OSC", "Freq" and "Prescaler"
    endif
    else
    error Invalid Prescaler
    endif
    ENDASM
    
    Do we need this error checking if we know and are happy with osc/prescaler/freq etc or am i missing something else. It looks like it might take a fair bit of code space?

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


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    That snip perform calculations at compilation time and doesn't take ANY codespace. 'course you can remove it. It's there for convenience and ease of use.
    Steve

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

  21. #21
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    Hi guys ,

    although this thread is old , it has been helpful in me understanding some of the setup and use of DT instant interrupts , as well as using IOC setting in the 12F683

    I do have a question on using IOC and DT_interupt,bas

    If the pin for the interrupt is used both as input as well as output , do i need to change anything in setting on the IOC pin (IOC.4=1 - set interupt on change from high on gp4 ) or within DT interrupt.bas when the GPIO its set to output

    do i need to turn off or to stop the interrupt routine being called incorrectly if pin is then set to output

    Or is the IOC and DT interrupt routines only applicable when its GPIO is an input

    regards

    Sheldon

  22. #22
    Join Date
    Jun 2006
    Location
    California
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    It has been awhile since I used "instant interrupts." All my projects are working fine. Last summer I upgraded to PBP 3.0. When I went to load "Instant Interrupts" today the text file says install in the directory where "PBPW.exe" exists; it is not there anymore. I see "PBPX.exe" under C:\PB3 directory; is that the replacement for PBPW.exe ??

    I did search of the forum but could not find anything on the subject. Sorry, for asking a dumb question but I am a little rusty these days!

  23. #23
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupts - Clarification?

    PBPX is the new executable. It runs in normal mode or with the switch -n in LONG (variable) mode.

    Ioannis

Members who have read this thread : 1

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