Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Hi Darrel,
    yes you are right, i had 8.56, now 8.66 and it works.

    BTW: For all I2C Slave progger:
    To get the I2C Slave running on a 25K22, use SSP1_INT or SSP2_Int, and, very important, you must set ANSC4 & ANSC3 = 0 for SSP1 and ANSB1 & ANSB0 = 0.

    Regards,
    Ralf

  2. #2
    Join Date
    Feb 2008
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Weird PortB change interrupt

    Hey there,
    I'm trying to code a portb change interrupt routine with DT's Inst Ints, but it does very weird stuff, and I can't find out why.

    The setup:
    PIC 16F876 @ 20 MHz
    I have connected LEDs to the ports c0, c3, c4 and c5 to check what happens
    The input switches are connected to ports b1-b4

    The code looks something like this:

    Code:
    define OSC 20 
    
    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    RBC_INT,  _PortBInterrupts,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @    INT_ENABLE   RBC_INT     ; enable PortB change interrupts
    
    main:
       toggle led              ' Toggles a LED that indicates if the program still runs :-)
       pause 250
       low portc.0
       low portc.3
       low portc.4
       low portc.5
    goto main
    
    PortBInterrupts:
    
        if portb.1 = 1  then 
            high input1
        endif
        
        if portb.2 = 1  then 
            high input2
        endif
        
        if portb.3 = 1 then  
            high input3
        endif
        
        if portb.4 = 1  then 
            high input4
        endif 
     
    @ INT_RETURN
    What happenes is the following:

    If I press any button except of b4, nothing happens.
    If I press only button b4 nothing happens

    If I press b1 just before b4 then the LED according to b4 lits.
    If i press any other button along with b4, the right LEDs light up.

    It seems that button b4 is the mainswitch for all other buttons within the interrupt routine. Without b4 nothing happens.

    So to verify the code I wrote something like this without interrupts:

    Code:
    main:
    if portb.1 = 1 then high portc.0
    if portb.2 = 1 then high portc.3
    if portb.3 = 1 then high portc.4
    if portb.4 = 1 then high portc.5
    pause 250
    low portc.0
    low portc.3
    low portc.4
    low portc.5
    goto main
    With this code everything works fine. Every input lits the according output LED. So it must be a interrupt handling issue that makes the errors...

    any ideas?

    Pls. Excuse my bad english, it's not my mother tongue...

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


    Did you find this post helpful? Yes | No

    Default

    The 16F876 only has "Interrupt On Change" on RB4-7.
    DT

  4. #4
    Join Date
    Feb 2008
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Hm, thanks Darryl. The datasheet isn't really clear in this case (written in the datasheet is only PORTB<7:4>). I always thought portb change is the whole portb as the name says.
    I'll check this out tomorrow. Hope it works.

    That complicates my circuit a little 'cause I wanted the rb7 and rb6 only for ICSP. Now I have to solder in some jumpers :-)

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    A couple of resistors maybe are enough to isolate the ICSP from the rest of the circuit without need of any jumpers.

    Ioannis

  6. #6
    Join Date
    Nov 2009
    Location
    DFW area of Texas
    Posts
    24


    Did you find this post helpful? Yes | No

    Default pbppi14e.lib errors

    DT, you have given the PBP & PIC users a great gift with your instant interrupts!
    My application can't wait for the current statement execution to complete for 'ON INTERRUPT' use.
    I've implemented your latest creations after reading your website on DT_INTS-14.
    Also, have studied many similar threads with similar problem & tried the posted solutions, but I still get compile errors:
    (using PIC16F1826 / PBP2.60C / MPASM )
    Error[113]c:\pbp\pbppi14e.lib 1182 : Symbol not previously defined (INT_ENTRY)
    Error[113]c:\pbp\pbppi14e.lib 1182 : Symbol not previously defined (INT_ENTRY)
    Error[113]c:\pbp\pbppi14e.lib 720 : Symbol not previously defined (INT_EXIT)
    Error[113]c:\pbp\pbppi14e.lib 733 : Symbol not previously defined (INT_EXIT)
    Error[113]c:\pbp\pbppi14e.lib 737 : Symbol not previously defined (INT_EXIT)
    Warning[207]c:\microc~2\pi34cc~1.asm 720: Found label after column 1. (INT_Create)

    complete code:

    Code:
    '******************************
    OSCCON = $73 'or %01110011 is for use intosc of 8Mhz         
    'OSCCON = %11110000  '32Mhz intosc use
    Define OSC 8         'define the timing for PBP timing such as pause & serout
    '*********************************************
    '
    'Tris register 1=input(PORdefault) 0=output
    'Ansel register 1=analoginput(PORdefault, digital reads are 0) 0=digitalinput
    ANSELA = %00001100     '1 = Analog used  / Vref+(A3) and Vref-(A2)
    ANSELB = %00100000     '1 = Analog used  / ADC in (B5 / AN7)
    TRISA =  %00111100      '0 is output ;  1 is an input(POR Default)
    TRISB =  %10111111      'Port B 
    'OPTION_REG.6 = 1        'INT interrupt acts on RISING EDGE
    'CLKRCON = %11010000  'Turn on ref clock output  BE SURE TO DISABLE "CLOCK OUT" IN MEPROGRAMMER
    '
    '
    '*******Variables*************************
    'HeadUnit Connections
    HUdat   var PORTB.0  'Headunit communications  Input or Output
    'Strain Gage Connections     
    GagePwr var PORTA.1  'PowertoStrainBride Output
    ADCPin  VAR PORTB.5  'StrainSample AN7 Input
    'Hall Effect Sensor Connections 
    SpdDat  var PORTB.3  'HallSensor Input
    'Digital Pot Connections 
    PotCS   var PORTA.0  'CS DigiPot Output
    PotClk  var PORTA.7  'SCK DigiPot Output
    PotDat  var PORTA.6  'SDI DigiPot Output
    'Temperature Sensor Connections 
    TmpSDA  var PORTB.4  'SDA Data TempSensor Input
    TmpSCL  var PORTB.6  'SCL Clock TempSensor  Output
    '**
    wsave   VAR BYTE    $20     SYSTEM      ' location for W if in bank0
    '**
    '****************************************
    Y       var byte
    Neg     var byte
    Pos     var byte
    X       var word '16bit variable for PULSIN, 0 to 65,535
    SData1  var word 'Speed data
    SData2  var word 'Speed data to be sent (Use prior pulse)
    WiprPos var byte 'Digipot Command
    WiprNeg var byte 'Digipot Command
    Mark    var byte
    Space   var byte
    Strain  var word 'Sampled Strain Value from WheatstoneBridge
    '****************************************
    wiprneg=%00100000           'Wiper0 v 0000 0000 (nv 0010 0000) write
    wiprpos=%00110000           'Wiper1 v 0001 0000 (nv 0011 0000) write
    mark=60
    Y=0
    neg=0
    pos=0
    x=0
    input hudat         'start HUdat as an input pin
    '*********************************************
    'Interrupt system works on "INT" pin B.0 that is named "HUdat" in the above
    include "DT_INTS-14.bas"    ;Interrupt System  
    INCLUDE "ReEnterPBP.bas"    ;to use with PBP Interrupt handlers
    '*********************************************
    ASM
    INT_LIST macro  ; IntSource,   Label,  Type,  ResetFlag
           INT_Handler INT_INT, _HandleInt, PBP, yes
        endm
        INT_Create      ;create interrupt processor
    endasm    
    @ INT_ENABLE  INT_INT ;enables external interrupts 
    '*****************************************
    Start:
    'Set Digital Pots
    pause 10
    neg=240     '257 is ground
    pos=60     '0 is full +V supply                              
    low potcs     'Use Digital Pot's mode 0,0 and its MSB first & Clk idles low
    shiftout potdat, potclk, 1, [wiprneg, neg]  '8bit digi pot
    high potcs
    pause 50
    low potcs     'Use Digital Pot's mode 0,0 and its MSB first & Clk idles low
    shiftout potdat, potclk, 1, [wiprpos, pos]  '8bit digi pot
    high potcs
    pause 10    
    '***********************
    Main:
    pauseus 10
    pulsin spddat,1,sdata1
    sdata2 = sdata1         'store speed data into another var as keep-safe vs. INT
    'if hudat then
    ''  pauseus 2100
    '  output hudat
    '  serout2 hudat,16530,[strain.highbyte,strain.lowbyte]   
    'endif
    goto Main
    '********************************************
    HandleInt:
    output hudat         'make HUdat an output pin to send data
    strain=24650   'test value
    serout2 hudat,16530,[strain.highbyte,strain.lowbyte]
    input hudat          'switch HUdat back to an input pin to receive interrupt
    @ INT_RETURN
    '* * * * * * * * * * * * * * * * * *
    Your help would be greatly appreciated, since my application must have an 'instant interrupt'.

    [ In this application I have a sensor-unit(code shown above) connected to a head-unit. HUdat pin is on the sensor-unit and awaits a simple signal from the head-unit to activate an interrupt and send data on the same connection. ]

    You guys are the best & thanks in advance!
    -ray
    -ray
    "Imagination is more important than knowledge", Albert.E.

  7. #7
    Join Date
    Nov 2009
    Location
    DFW area of Texas
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited


    My code had
    INT_Create
    instead of
    INT_CREATE
    I suppose I should wear my glasses more often.
    DTaylor's instant interrupt works great now in my application.
    thanks for your patience,
    -ray
    "Imagination is more important than knowledge", Albert.E.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: pbppi14e.lib errors

    I have had similar problems , it seems I cut and pasted the asm section from somewhere that included an illegal non printing character. simple solution is to retype the asm section ,remember its case sensitive
    ASM
    INT_LIST macro
    INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
    endm
    INT_CREATE
    ENDASM

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