Instant Interrupts - Revisited - Page 6


Closed Thread
Page 6 of 20 FirstFirst ... 234567891016 ... LastLast
Results 201 to 240 of 773
  1. #201
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by emavil View Post
    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?
    Hey PAL....Let me give you a little hint...

    WE'RE ALL JUST HOBBYISTS!!!

    What makes you so special? And it's 10 bucks. If you can't afford that, then you probably shouldn't be buying any more hardware until you can save up that amount.
    Oh...but you're looking at buying the new PBP compiler...which means that you can't upgrade.
    Why can't you upgrade? Is this because the version you have right now isn't exactly....oh nevermind...I give up...

    Another one for the list...
    Last edited by skimask; - 22nd March 2007 at 04:59. Reason: $10 for upgrade...$25 for upgrade plus manual...duh!!!

  2. #202
    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
    Now, my question is, what is really the minimum version of PBP just to compile your "multiple interrupt" codes?
    My first version of PBP was 2.40, and that had to be 6 or 7 years ago. I don't know of anything that would keep DT_INTS from working with that. But 2.33, geez how many years ago was that. There's just no way of knowing if anything would work with it.

    Quote Originally Posted by emavil View Post
    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?
    I'm not a PBP reseller, which are the only ones that can sell you an upgrade. And to do that, they would have to have sold PBP to you in the first place.

    If you can't afford the price of the compiler, then you've chosen the wrong hobby. Because you'll be spending hundreds, if not thousands on the different parts, modules, processors, displays etc. The compiler itself is a relatively small cost, comparatively.

    And you'll find that the people that did pay for the compiler, aren't willing to help someone that's pirated theirs. Sorry, but that includes ME.
    <br>
    DT

  3. #203
    Join Date
    Jan 2006
    Posts
    31


    Did you find this post helpful? Yes | No

    Default

    thanks for your advice Darrel, you're a man of character.

    anyway, i would like to ask an apology to those guys who were not able to grasp what i meant.

    I will consult MELabs about the technical details of this issue.

    I was trying to ask for a reasonable price and location for PBP coz in my place (Philippines) there's no reseller or distributor for MELABs products. I have to order it abroad. That's what i meant for "COSTLY". I have to pay for extra charges. Unlike if it is available in my country, its easy for me order the right version without spending extra charges.

    Right now i will just go back to the old drawing board and maximize my resources. I will find resources just save extra for an upgrade of the latest version of PBP.

    thanks anyway, this forum is the best. I love people who always criticize for good.

    with regard to my post about the digital clock that utilizes 6 7-segment displays for time display, Darrel do you something in mind to maintain the 1/100 tick accuracy while refreshing the 7-segments? Right now i can use only one interrupt (TMR1) for timer tick count. I do not know how to refresh the displays(7-segments). This is no problem for the LCD, right?
    Last edited by emavil; - 22nd March 2007 at 03:23.

  4. #204
    Join Date
    Jan 2005
    Posts
    15


    Did you find this post helpful? Yes | No

    Default RBC interupt

    read the thread many times,

    pic 18F4525
    interupt on port B.0 works great with DT add-on using int0_int
    but on falling edge of incoming pulse
    the full program runs without any problem


    i want to change it on rising edge using rbc_int
    but - pic blocks - nothing works anymore ???
    even de ledflash sub .....
    what am i doing wrong - i don't see it.


    code



    '****************************
    ' as test for RBC_int
    INTCON.0 = 0 ' RBIF
    INTCON.3 = 1 ' RBIE
    ' INTCON2.0 = 1 ' RBIP
    '****************************
    ' ok for int0_int on port B but falling edge ( unusable in this case)

    INTCON2.6 = 1 ' rising edge ????
    INTCON.1 = 0
    INTCON.4 = 1 ' enable int0 interrupt RB0
    '****************************
    ' include special interupts
    INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
    INCLUDE "Elapsed_INT-18.bas" ; Elapsed Timer Routines

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    ; INT_Handler INT0_INT, _triggertest, PBP, yes
    INT_Handler RBC_INT, _triggertest, PBP, yes
    INT_Handler TMR1_INT, _ClockCount, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM
    gosub initial ; all var to 0
    gosub ledflash ; flash leds 10 times
    T0CON = %10010010 ; T0 = 16-bit, Prescaler 8
    ;@ INT_ENABLE INT0_INT ; enable external (INT) interrupts
    @ INT_ENABLE RBC_INT ; enable RB (INT) interrupts on change
    @ 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 trig_in =1 then
    ................
    endif

    trig_in = 0
    goto main
    '******************************************
    ';---[INT - interrupt handler]--------------------------
    triggertest:
    trig_in = 1 ' set flag interupt
    @ INT_RETURN
    end

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


    Did you find this post helpful? Yes | No

    Default

    tiger_bel,

    RBC_INT's generate an interrupt on BOTH edges of RB4 thru RB7. You can't set it to just Rising or Falling.

    Then once it interrupts, you have to read PORTB to "End the Mismatch".
    A simple Dummy = PORTB in the handler will do it.

    You also need to compare that read, with the value of PORTB the last time it interrupted to figure out which pin changed, and which state it changed to.
    <br>
    DT

  6. #206
    Join Date
    Jan 2005
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    many thanks for the info,

    i just figured out that using a simple sub to scan the port works fine...
    and i use port B.0 not 4...7

    rgds
    tb

  7. #207
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Am I missing something ?

    Hi,

    Quote Originally Posted by tiger_bel View Post
    many thanks for the info,

    i use port B.0 not 4...7
    Then why on earth you are enabling it
    @ INT_ENABLE RBC_INT ; enable RB (INT) interrupts on change
    Regards

    Sougata

  8. #208
    IE Ray's Avatar
    IE Ray Guest


    Did you find this post helpful? Yes | No

    Default CAN interrupt

    I have used the 18FXXX interupts, great stuff, does what is says on the tin. Taking things a stage further, are there and routines for the CAN interface for the 18F258/18F2580 chips?

    Thanks Ray

  9. #209
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    This is gonna sound like a dumb question.

    Where can I download the files for DT_INTS-18? I've been to Darrels website but cant find the link...

    http://darreltaylor.com/DT_INTS-18/home.html

    Can anyone help me out?

    Cheers
    Squib

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


    Did you find this post helpful? Yes | No

    Default

    Nah, it's not a dumb question. Knowing what happened last week, it's probably normal than few things are missing on his website.

    I've attach ALL files.

    Quote Originally Posted by DT
    ** Files removed **
    They're back on the website again.

    Thanks Steve!
    DT
    Last edited by Darrel Taylor; - 11th June 2007 at 07:45. Reason: removed files
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Nope, not a dumb question.

    But I got a dumb answer.

    The site was recently hacked by some Turkish Hacker Group. (Dirty Rats)

    The "dumb" part is that I haven't made a backup in over a year.
    So that's what the site looks like now. Same as a year+ ago.

    I'm so digusted at myself, I've not even been able to start the repairs.
    Every time I look at it, I just go .... "Uughhh! I don't want to do that right now."

    Thanks Steve, that ought to help out, for awhile.

    Regards,
    DT

  12. #212
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Thumbs down These bloody &*%^%

    These bloody ******* I tell you. I'd like to see them locked up. Weekly, sometimes even daily, I receive a dozen or so emails from fraudulent individuals either telling me that I've won the lottery (the motivation behind this is identity theft) - or requesting that I go and login into my bank account on their copied fraudulent web site.

    The internet needs to be policed by people that have the power to shut an operation down with as little as two keystrokes and a couple of clicks of the mouse.
    Last edited by T.Jackson; - 14th May 2007 at 06:41.

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


    Did you find this post helpful? Yes | No

    Default

    Yeah, I can see doing it for a profit. (credit card/phishing scams)
    No matter how much I hate the method. At least there's a reason.

    But what can someone possibly gain by defacing a website? Other than pissing the webmaster off.
    After a little searching, I found that it was only one of many thousands hacked by the same group.

    I even found a cached page on google that showed pbpgroup que'd for defacement. The cached page was dated prior to the actual hack.
    How nice of them to warn you. Sort of

    Quote Originally Posted by T.Jackson
    The internet needs to be policed by people that have the power to shut an operation down with as little as two keystrokes and a couple of clicks of the mouse.
    Yesterday 20:59
    That would be nice. But I don't know anyone that I would entrust those powers too.
    All govenments immediately exluded.
    <br>
    DT

  14. #214
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Guys,
    That would give you the ****s! Ok - so at least I'm not going blind unable to find the link on his website.

    I better do a backup of my website today.

    Cheers
    Squib

  15. #215
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    Quote Originally Posted by Darrel Taylor View Post
    That would be nice. But I don't know anyone that I would entrust those powers too. All govenments immediately exluded.
    <br>
    It would be a paid job like any other. Plenty of people around fit to do it.

  16. #216


    Did you find this post helpful? Yes | No

    Default Blinky Light Error?

    Darrel:

    I'm trying to use your "Blinky Light" interrupt code (16F690) and I get an error

    "ERROR: Variable wsave3 position request 416 beyond RAM_END 367."

    when I compile. Any suggestions about what I am doing wrong? Thanks.

    BrianB

  17. #217
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Yeah, I can see doing it for a profit. (credit card/phishing scams)
    No matter how much I hate the method. At least there's a reason.

    But what can someone possibly gain by defacing a website? Other than pissing the webmaster off.

    <br>
    Hi Darrel,
    I can think of a reason, maybe to run scripts to install a trojan to your visitors.
    or cgi redirects for that reason or other bad behavior. Oh and to piss you off too . . .
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by elevenscorpions View Post
    ... I get an error ... "ERROR: Variable wsave3 position request 416 beyond RAM_END 367."
    Hi Brian,

    Open the DT_INTS-14.bas file. You should see this near the top ...
    Code:
    wsave       var byte    $20     SYSTEM      ' location for W if in bank0
    ;wsave       var byte    $70     SYSTEM     ' alternate save location for W 
                                                ' if using $70, comment out wsave1-3
    
    ' --- IF any of these three lines cause an error ?? ---------------------------- 
    '       Comment them out to fix the problem ----
    ' -- It depends on which Chip you are using, as to which variables are needed --
    wsave1      var byte    $A0     SYSTEM      ' location for W if in bank1
    wsave2      var byte    $120    SYSTEM      ' location for W if in bank2
    wsave3      var byte    $1A0    SYSTEM      ' location for W if in bank3
    ' ------------------------------------------------------------------------------
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    I can think of a reason, maybe to run scripts to install a trojan to your visitors. or cgi redirects for that reason or other bad behavior. JS
    And create another SPAM spewing Zombie.
    I suppose that's a reason.
    (rassa fracken ricken racken ... Hackers)

    Oh and to piss you off too . . .
    Mission Accomplished!
    <br>
    DT

  20. #220
    Join Date
    Jun 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Problems with RX_INT

    Hi, all. In my program i put all you are saying about fast interrupts, and with INT_INT, works fine, and so better than it use with on interrupt goto..... I´ve probed also with TIMR0 at same time and works again. But if i put RX_INT, others work but RX_INT subrutine nothing happens.

    I delete all about INT_INT and TIMR0, and works. In RX_INT sub only have a sentence like HSERIN char, and in main program LCDOUT char to see the incoming char.

    Any ideas? I copied the code of first page to make it, and it should be work.

    Another question: If i want to save that char in a string to display it in the lcd, when carriage return income, how can i do it??? My head it´s warm....... sorry.

    Also i´ve read the post about string of Darrel but i´m newby and i don´t undestand so much.

    Thanks for all.

    PD.- micro it´s 16F877A or 16F876, or 16F84

  21. #221
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by nacho7577 View Post
    But if i put RX_INT, others work but RX_INT subrutine nothing happens.
    Are you sure that you're receiving anything in the first place?
    How about clearing RCIF?

    In RX_INT sub only have a sentence like HSERIN char, and in main program LCDOUT char to see the incoming char.
    Are you using HSERIN or the RX_INT?

    Another question: If i want to save that char in a string to display it in the lcd, when carriage return income, how can i do it??? My head it´s warm....... sorry
    Another thread subject...make an array, make a counter, keep adding 1 to the counter, store the character in the array with the index 'counter', if the incoming character is a CR, display it, otherwise, wait for more...again, should be a seperate thread.

  22. #222
    Join Date
    Jun 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default What I´m doing bad???

    ' PROGRAMA QUE USA INTERRUPCIONES INSTANTÁNEAS '
    ' INT_INT -- INT External Interrupt
    ' RBC_INT -- RB Port Change Interrupt
    ' TMR0_INT -- TMR0 Overflow Interrupt 16F
    ' TMR1_INT -- TMR1 Overflow Interrupt
    ' TMR2_INT -- TMR2 to PR2 Match Interrupt
    ' TX_INT -- USART Transmit Interrupt
    ' RX_INT -- USART Receive Interrupt
    ' CMP_INT -- Comparator Interrupt
    ' EE_INT -- EEPROM/FLASH Write Operation Interrupt
    ' BUS_INT -- Bus Collision Interrupt
    ' PSP_INT -- Parallel Slave Port Read/Write Interrupt
    ' AD_INT -- A/D Converter Interrupt
    ' SSP_INT -- Master Synchronous Serial Port Interrupt
    ' CCP1_INT -- CCP1 Interrupt
    ' CCP2_INT -- CCP2 Interrupt

    clear

    define OSC 16

    ' Define LCD connections
    DEFINE LCD_DREG PORTD ' LCD Data Port
    DEFINE LCD_DBIT 4 ' Starting Data Bit
    DEFINE LCD_RSREG PORTD ' Register Select Port
    DEFINE LCD_RSBIT 2 ' Register Select Bit
    DEFINE LCD_EREG PORTD ' Enable Port
    DEFINE LCD_EBIT 3 ' Enable Bit
    DEFINE LCD_BITS 4 ' Data Bus Size
    DEFINE LCD_LINES 2 ' Number of Lines on LCD

    ' Define RS232 line
    DEFINE HSER_BAUD 19200 'Hser baud rate
    DEFINE HSER_CLROERR 1 'Hser clear overflow automatically
    DEFINE HSER_SPBRG 51 'Hser spbrg init
    DEFINE HSER_RCSTA 90h 'Hser receive status init
    DEFINE HSER_TXSTA 24h 'Hser transmit status init

    ADCON1 = 7 'Set portA outputs to Digital / No ADC
    LCDOUT $FE,1 ' Initialize LCD
    PAUSE 200

    fase_a var portb.0
    subir var portb.1
    bajar var portb.2
    prog var portb.3

    salida var porta.0
    'sentido var porta.1
    'prueba var porta.2

    aux_subir var ppp.0
    aux_bajar var ppp.1
    aux var ppp.2
    escribir_inicio var ppp.3
    escribir_pulso var ppp.4

    ppp var byte
    cuenta var word
    pulso var word
    inicio var word
    que_escribir var word
    aux_aux var byte
    tmp var byte
    direccion var byte
    char var byte
    cadena var byte[20]
    i var byte

    INCLUDE "DT_INTS-14.bas" ' Required
    INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
    INCLUDE "Elapsed_INT.bas" ' Elapsed Timer Routines

    TRISA = 0
    PORTA = 0
    TRISB = $FF
    TRISC = %10000000
    TRISD = 0
    PORTD = 0
    PORTC = 0

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler INT_INT, _Int_RB0, PBP, yes
    INT_Handler RX_INT, _Int_RX, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor

    INT_ENABLE INT_INT ; enable external (INT) interrupts
    INT_ENABLE RX_INT ;

    ENDASM

    OPTION_REG = OPTION_REG & $80 | 1 ; Set TMR0 Prescaler to 256, leave RBPU alone

    Main:
    i = 0
    cuenta = 0
    aux_aux = 0
    inicio = 300
    pulso = 300
    'Reinicializar variables
    if subir and bajar then
    escribir_inicio = 1
    gosub escribir
    escribir_inicio = 0
    escribir_pulso = 1
    gosub escribir
    escribir_pulso = 0
    endif

    'Si no hay nada en eeprom graba variables
    read $0,tmp
    if tmp = $FF then
    escribir_inicio = 1
    gosub escribir
    escribir_inicio = 0
    escribir_pulso = 1
    gosub escribir
    escribir_pulso = 0
    endif

    'Se releen las variables
    gosub leer

    prog_: 'lazo principal

    if subir and prog and not aux_subir then
    gosub mod_inicio_subir
    endif

    if bajar and prog and not aux_bajar then
    gosub mod_inicio_bajar
    endif

    if subir and not prog and not aux_subir then
    gosub mod_pulso_subir
    endif

    if bajar and not prog and not aux_bajar then
    gosub mod_pulso_bajar
    endif

    if not subir then
    aux_subir = 0
    endif

    if not bajar then
    aux_bajar = 0
    endif
    'salida por LCD
    lcdout $fe,2
    lcdout "Posicion ",dec4(cuenta)
    lcdout $fe,$C0
    lcdout "Inicio ",dec4(inicio)
    lcdout $fe,$94
    lcdout "Pulso ",dec4(pulso)
    lcdout $fe,$d4
    cadena[I] = char
    LCDOUT STR cadena,20 'no aparece nada (nothing appears in lcd
    ' lcdout "Salida ",bin salida
    goto prog_

    'Subrutinas
    leer:
    INTCON = $00
    read $0,inicio.byte1
    Read $1,inicio.byte0
    read $2,pulso.byte1
    Read $3,pulso.byte0
    INTCON = $90
    RETURN

    escribir:
    if escribir_inicio = 1 then
    que_escribir = inicio
    direccion = $0
    endif

    if escribir_pulso = 1 then
    que_escribir = pulso
    direccion = $2
    endif

    ' porta.2 = 1 'chequeo para saber que ha escrito en eeprom
    Write direccion,(que_escribir.byte1)
    write direccion+1,(que_escribir.byte0)
    porta.2 = 0
    return

    mod_inicio_subir:
    inicio = inicio + 15
    aux_subir = 1
    if inicio >= 3000 then
    inicio = 3000
    endif
    escribir_inicio = 1
    gosub escribir
    escribir_inicio = 0
    return

    mod_inicio_bajar:
    inicio = inicio - 15
    aux_bajar = 1
    if inicio <= 50 then
    inicio = 50
    endif
    escribir_inicio = 1
    gosub escribir
    escribir_inicio = 0
    return

    mod_pulso_subir:
    pulso = pulso + 15
    aux_subir = 1
    if pulso >= 3000 then
    pulso = 3000
    endif
    escribir_pulso = 1
    gosub escribir
    escribir_pulso = 0
    return

    mod_pulso_bajar:
    pulso = pulso - 15
    aux_bajar = 1
    if pulso <= 50 then
    pulso = 50
    endif
    escribir_pulso = 1
    gosub escribir
    escribir_pulso = 0
    return

    '---[INT - interrupt handler]---------------------------------------------------
    Int_RB0:
    cuenta = cuenta + 1

    if cuenta >= inicio then
    salida = 1
    endif

    if cuenta >= (pulso + inicio) then
    salida = 0
    cuenta = 0
    endif
    @ INT_RETURN

    '---[TMR0 - interrupt handler]-------------------------------(Blinky Light)-----
    'T0Count Var WORD
    'ToggleLED2: 'aprox 1 segundo
    ' T0Count = T0Count + 1
    ' if T0Count = 512 then T0Count = 0 : Toggle LED2
    '@ INT_RETURN

    '---[RX - inmterrupt handler]--------------------------------------------------
    Int_RX:
    PORTA.1 = 1 'to check RX int has come
    i = i +1
    hserin [char]
    @ INT_RETURN

    ------------------------
    questions:

    Why LCD doesn´t display cadena?
    Why when i entry many chars by rs232 (fast) variables inicio and pulso corrupts and display an abnormal value?? This check was made without int_int interrupts (fase_a it´s an output from a incremental encoder, and this one was stopped).

    Thanx, and sorry if i´m 'heavy'.

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


    Did you find this post helpful? Yes | No

    Default

    I don't understand your language, so it's hard to tell what's going on.
    But here's a couple problems I can see...

    LCDOUT STR cadena,20 'no aparece nada (nothing appears in lcd

    should be...

    LCDOUT STR cadena\20

    And the reason you're missing characters, is probably because the data is received by the interrupt handler, but it's being put into the "buffer" array in the main loop. That should be done in the handler too.
    <br>
    DT

  24. #224
    Join Date
    Jun 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Thanx for your answer.

    I understand you about the understanding the code.... me too sometimes....

    OK lcdout cadena\20

    >And the reason you're missing characters, is probably because the data is >received by the interrupt handler, but it's being put into the "buffer" array in >the main loop. That should be done in the handler too.
    ¿? Something like this?:

    '---[RX - inmterrupt handler]----------------------------------------------
    Int_RX:
    PORTA.1 = 1 'to check RX int has come
    hserin [char]
    cadena[i] )= char
    i = i +1
    @ INT_RETURN

    but lcd displays rare....

    Don´t worry i´ll figth with it.

    Thanx for all.

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


    Did you find this post helpful? Yes | No

    Default

    Better, but it still needs a way to limit it to the "bounds" of the array. Or, it will overwrite all your other variables. Maybe like this.
    Code:
    '---[RX - inmterrupt handler]----------------------------------------------
    Int_RX:
        PORTA.1 = 1 'to check RX int has come 
        hserin [cadena(i)] 
        i = i +1
        if i >= 20 then i = 0
    @ INT_RETURN
    Of course this still has the problems of not knowing how many bytes were received, if the buffer overflows, if USART errored etc.

    You might want to take a look at this program from Joe S.

    LCD serial backpacks
    http://www.picbasic.co.uk/forum/showthread.php?p=28336

    It has a complete "Circular Buffer" using DT_INTS.
    <br>
    DT

  26. #226
    Join Date
    May 2007
    Posts
    21


    Did you find this post helpful? Yes | No

    Default New at many things, but learning

    hi all,
    Using 18f4550....
    I tried it on INT_INT -- INT External Interrupt and RBC_INT -- RB Port Change Interrupt. It works wonderfully.

    At this point, I want to use TX_INT -- USART Transmit Interrupt.But I could
    not manage it out.My code is

    ADCON1 = %00001111
    TRISC = %10000000
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    RCIF VAR PIR1.5
    TXIF VAR PIR1.4
    DATA var Byte
    Pause 5
    Main:
    If RCIF then hserin[data]
    goto Main


    which definitions do I need ?Many thanks

    Regards

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


    Did you find this post helpful? Yes | No

    Default

    TX or RX? Not sure why you want to monitor TX event so far, RX would be more valuable.
    Steve

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

  28. #228
    Join Date
    May 2007
    Posts
    21


    Did you find this post helpful? Yes | No

    Default New at many things, but learning

    define LOADER_USED 1
    define OSC 20
    DEFINE RESET_ORG 800H

    data var byte


    ADCON1 = %00001111
    TRISC = %10000000
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1

    INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler RX_INT, _recieve, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    @ INT_ENABLE RX_INT ; enable Timer 1 interrupts


    RCIF VAR PIR1.5

    Main:

    PAUSE 10
    GOTO Main

    DISABLE DEBUG
    '---[RC- interrupt handler]--------------------------------------------------
    recieve:
    hserin [data]

    @ INT_RETURN
    ENABLE DEBUG




    ok, I removed the definitions related to TX. can I get rid of other definitions?

  29. #229
    Join Date
    Oct 2004
    Location
    Porto - Portugal
    Posts
    28


    Did you find this post helpful? Yes | No

    Smile Thanks Darrel

    Hi all of you,

    For the first time I've used the famous Darrel Taylor's interrupt routine, no words to describe it, marvellous job.

    Thanks Darrel for the explendid job

    nomada
    nomada

  30. #230
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Sir Darrel Taylor.
    my counter code is working well.
    I want to counts the rising edge on INT0 and falling edge on INT1 of the pulse trains from encoder.
    How i configure interrupt on the INT1 as Falling edge and INT0 as rising edge.
    I short both pin but dont'know how to config. edge bit.

    code.
    Code:
    ' chip PIC18F4550
    DEFINE OSC 48
    INCLUDE "MODEDEFS.BAS"
    include "MYLCD.BAS"
    CMCON = 7
    ADCON1 = 15
    CVRCON = %00000000 'CVref turned off
    
    TRISB = %11111111
    w0 var word
    pause 500
    
    '-------------------------[ INT0 Interrpt setting ] -----------------------------
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT0_INT,  _ToggleLED1,   PBP,  yes
            INT_Handler    INT1_INT,  _ToggleLED2,   PBP,  yes                
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT0_INT     
    @   INT_ENABLE   INT1_INT
    '__________________________________________________________________________________
    
    
    start:  lcdout $fe,1
            lcdout "count = ",dec5 w0
            pause 200
            goto start
    
    
    
    ToggleLED1:
                w0 = w0+1
                @ INT_RETURN
                
    ToggleLED2:            
                 w0 = w0+1
                @ INT_RETURN
    Last edited by precision; - 25th July 2007 at 09:53.

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


    Did you find this post helpful? Yes | No

    Default

    The Edge Select bits are located in the INTCON2 register of the 4550.

    They are Rising edge by default, so for INT1 Falling edge...
    Code:
    INCON2.5 = 0  ; External INT1 on Falling edge
    <br>
    DT

  32. #232
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    I set INTCON bit but not working on falling edge.

    Code:
    ' chip PIC18F4550
    DEFINE OSC 48
    INCLUDE "MODEDEFS.BAS"
    include "MYLCD.BAS"
    CMCON = 7
    ADCON1 = 15
    CVRCON = %00000000 'CVref turned off
    
    TRISB = %11111111
    w0 var word
    pause 500
    
    '-------------------------[ INT0 Interrpt setting ] -----------------------------
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT0_INT,  _ToggleLED1,   PBP,  yes
            INT_Handler    INT1_INT,  _ToggleLED2,   PBP,  yes                
        endm
        INT_CREATE               ; Creates the interrupt processor
    INCON2.5 = 0  ; External INT1 on Falling edge
    ENDASM
    
    @   INT_ENABLE   INT0_INT     
    @   INT_ENABLE   INT1_INT
    '__________________________________________________________________________________
    
    
    start:  lcdout $fe,1
            lcdout "count = ",dec5 w0
            pause 200
            goto start
    
    
    
    ToggleLED1:
                w0 = w0+1
                @ INT_RETURN
                
    ToggleLED2:            
                 w0 = w0+1
                @ INT_RETURN

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


    Did you find this post helpful? Yes | No

    Default

    It's a regular PBP statement, but it's in an ASM block.

    Move it outside the block and it should work better.
    <br>
    DT

  34. #234
    Join Date
    Mar 2006
    Location
    INDIA
    Posts
    89


    Did you find this post helpful? Yes | No

    Default

    Syntex error

    Ohh. Sory sir, I cut yout code and paste, I don't see there are INCON

    Thanks sir, It's Working
    Last edited by precision; - 25th July 2007 at 13:22.

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


    Did you find this post helpful? Yes | No

    Default

    Oops!
    <br>
    DT

  36. #236
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Smile Multiple measurements with Instant Interrupts.

    Hi Darrel,

    some days ago, I was trying to measure the "ON time" of my car´s gasoline injectors (one of the 4)

    I´m using a 16F877 @ 10 Mhz, and I´m using the Timer0 as a 250 ms counter and Timer1 as a pulse counter, I ran out of possibilities of new measurements.

    Bruce told me that I should use a new device with more timers available, like the 18F4431 (or similar).
    The problem is : This device (or similar) is not available here in Brazil, and Microchip do not send samples to Brazil.

    I was reading this post about the interrupts and decided to ask :

    Is that possible to read the pulses on Timer1 on a fixed time interval (so, I would have the car´s speed and the mileage) and measure the injector on-time (so I would have the consumption) with the instat interrupts running on a 16f877 ?

    Thanks !

    Sergio

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


    Did you find this post helpful? Yes | No

    Default

    Sure you can.

    I'd use the Capture mode of the CCP modules using Timer1, for the ON time.

    Timer 2 can be the timebase used to count the speedometer pulses on the INT (external interrupt) pin.

    And the same signal from the Injector can be fed to T0CKI, so Timer 0 can count the RPM's too.

    Speed, Distance, Consumption and Tachometer.
    <br>
    DT

  38. #238
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Wow !

    thank you !

    I´ll try it this weekend and post the results here !

    Bye !

  39. #239
    Join Date
    Jul 2007
    Location
    Spain
    Posts
    2


    Did you find this post helpful? Yes | No

    Question Instant Interrupt & EEprom

    Hi,

    how i use the instant interrupt (very nice pice of code) and the write or eeprom comand. In the manual they say to turn off all interrupts. Or is there no problem to use them together?

    Many Thx for reply

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


    Did you find this post helpful? Yes | No

    Default

    If an interrupt happens at just the right time, or actually just the Wrong time, it can cause the EEPROM write operation to fail.

    But it's not always necessary to turn off the interrupts.

    What I do, is write the value to EEPROM, then read it back and compare it to what it was writing. If they're not the same, go back and try to write it again.

    After a certain number of tries (I use 10, but it never takes that much), if it still hasn't written it properly, then turn off the interrupts and write it one last time.

    It takes a little extra code, and some extra time, but it doesn't mess with the interrupts.

    HTH,
    DT

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