Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    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.

  2. #2
    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

  3. #3
    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

  4. #4
    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.

  5. #5
    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'.

  6. #6
    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

  7. #7
    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.

Similar Threads

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

Members who have read this thread : 6

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