Serial Interrupt with DT_Ints - Error


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240

    Default Serial Interrupt with DT_Ints - Error

    Hi Again everyone;

    I'm trying to make a program using serial interrupt with DT_Ints, however i'm getting some erros when i compile, can somebody help me?

    PIC16F877A
    4Mhz
    PBP Pro 2.60a
    Mplab 8.53

    Code:
    DEFINE  OSC 4
     
     include "modedefs.bas"
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    
    ASM
    INT_LIST  macro   ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    RX_INT,    _serialin,   PBP,  no
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   RX_INT     ; enable external (INT) interrupts
    
    
     
    '                               VARIÁVEIS
    ' ====================================================================
    DADO  var byte
    DADOS var byte(4)
    ID    var byte(2)
    '                              REGISTOS PINOUT 1 = IN; 0 = OUT
    ' ====================================================================
             '76543210
    TRISA  = %00000001 
    TRISB  = %00001111 
    TRISC  = %10000000 
    TRISD  = %00000000 
    TRISE  = %00000000
    ADCON1 = 7
    '                              NOMES PINOUT
    ' ====================================================================
    LED    VAR PORTA.1
    Botao  var PORTA.0
    TX     Var PORTC.6
    RX     VAR PORTC.7
    '                              DEFINIÇÕES
    ' ====================================================================
       DEFINE LCD_DREG PORTB       ' LCD Data bits on PORTB
       DEFINE LCD_DBIT 4           ' PORTB starting address
       DEFINE LCD_RSREG PORTB      ' LCD RS bit on PORTB
       DEFINE LCD_RSBIT 3          ' LCD RS bit address
       DEFINE LCD_EREG PORTB       ' LCD E bit on PORTB
       DEFINE LCD_EBIT 2           ' LCD E bit address
       DEFINE LCD_BITS 4           ' LCD in 4-bit mode
       DEFINE LCD_LINES 2          ' LCD has 2 rows
       DEFINE LCD_COMMANDUS 2000   ' Set command delay time in us
       DEFINE LCD_DATAUS 50        ' Set data delay time in us
       
       
    '                             INICIO PROGRAMA
    ' ====================================================================
    Start:
     HIGH LED
     PAUSE 500
     LOW LED
     PAUSE 500
     HIGH LED
    
     LCDOUT $fe, 1
     lcdout "  Teste  Interrupt  "
     lcdout $FE,$C0," Por Hugo  Oliveira"
     pause 1000
    
    Main:
     toggle led
     Pause 1000
     goto main
     
    
    serialin:				        ' Buffer the character received
    
    
    @  INT_RETURN
    The Erros are;

    Code:
    xecuting: "C:\Programas\PBP\PBPMPLAB.BAT" -ampasmwin -k#   -p16F877A "Interrupt.pbp"
    Executing: "C:\Programas\PBP\PBPW.EXE" -ampasmwin -k# -p16F877A "Interrupt.pbp"      
    PICBASIC PRO(TM) Compiler 2.60A, (c) 1998, 2010 microEngineering Labs, Inc.
    All Rights Reserved.
    
    ERROR: Unable to execute mpasmwin.Error[113]   C:\PROGRAMAS\PBP\PBPPIC14.LIB 1181 : Symbol not previously defined (wsave)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 383 : ERROR: (wsave variable not found,)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 347 : ERROR: ("                     Add:"       wsave VAR BYTE $70 SYSTEM)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 404 : ERROR: (Chip has RAM in BANK1, but wsave1 was not found.)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 354 : ERROR: ("   Add:"       wsave1 VAR BYTE $A0 SYSTEM, Or change to   wsave BYTE $70 SYSTEM)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 420 : ERROR: (Chip has RAM in BANK2, but wsave2 was not found.)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 361 : ERROR: ("   Add:"       wsave2 VAR BYTE $120 SYSTEM, Or change to   wsave BYTE $70 SYSTEM)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 430 : ERROR: (Chip has RAM in BANK3, but wsave3 was not found.)
    Error[101]   C:\DOCUMENTS AND SETTINGS\HUGO OLIVEIRA\AMBIENTE DE TRABALHO\NOVA PASTA\INTERRUPT.ASM 368 : ERROR: ("   Add:"       wsave3 VAR BYTE $1A0 SYSTEM, Or change to   wsave BYTE $70 SYSTEM)
    Halting build on first failure as requested.
    BUILD FAILED: Tue Aug 10 02:48:20 2010
    Thanks
    Last edited by gadelhas; - 10th August 2010 at 02:56.

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


    Did you find this post helpful? Yes | No

    Default

    The answer is in the error ...

    Code:
    ERROR: (wsave variable not found,)
    ERROR: ("                     Add:"       wsave VAR BYTE $70 SYSTEM)
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    The answer is in the error ...

    Code:
    ERROR: (wsave variable not found,)
    ERROR: ("                     Add:"       wsave VAR BYTE $70 SYSTEM)
    Many Thanks Darrel for the answer.

    Itt compiles fine now.
    However, cam up another issue;
    how can i get a string of chars, like i use in Hserin, for instance;
    Code:
    Hserin [wait("OK"),STR ID\2,str DAdos\4]
    I Will Send to the pic "OK32Hugo" and then i want to compare the "ID" and the "Dados".
    I'm trying to figure out the example that you gave int the
    http://www.picbasic.co.uk/forum/show...8336#post28336
    but i'm not getting there, can you help me here on this? Waht to i have to put in the
    Code:
    serialin:				        
    
    
    @  INT_RETURN
    To Receive the data?

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


    Did you find this post helpful? Yes | No

    Default

    There are many ways you can do it. It depends on what you need.

    If you want the main program to continue running while it's receiving data, then you'll need to use the buffer method as shown in that thread.

    If you just want the main program to stop what it's doing and grab the serial data, then simply put your HSERIN in the serialin handler.
    You should add a timeout if you do that though.
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Hi Again, and thanks for the replys.

    Hi made this way, ad it works fine, however i don't have sure that is the best solutio;

    Code:
    '****************************************************************
    '*  Name    : Teste Interrupt Serial.BAS                                      *
    '*  Author  : Hugo Oliveira                                     *
    '*  Notice  : Copyright (c) 2010 ProSystems                     *
    '*          : All Rights Reserved                               *
    '*  Date    : 10-08-2010                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
     DEFINE  OSC 4
     include "modedefs.bas"
     INCLUDE "DT_INTS-14.bas"
     include "ReEnterPBP.bas"
     
     ASM
     INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    RX_INT,        _Interr,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
     ENDASM
     @   INT_ENABLE   RX_INT     ; enable external (INT) interrupts
    
     
    '                               VARIÁVEIS
    ' ====================================================================
    DADO  var byte
    DADOS var byte(4)
    ID    var byte(2)
    wsave VAR BYTE $70 SYSTEM
    '                              REGISTOS PINOUT 1 = IN; 0 = OUT
    ' ====================================================================
             '76543210
    TRISA  = %00000001 
    TRISB  = %00001111 
    TRISC  = %10000000 
    TRISD  = %00000000 
    TRISE  = %00000000
    ADCON1 = 7
    '                              NOMES PINOUT
    ' ====================================================================
    LED    VAR PORTA.1
    Botao  var PORTA.0
    TX     Var PORTC.6
    RX     VAR PORTC.7
    '                              DEFINIÇÕES
    ' ====================================================================
       DEFINE LCD_DREG PORTB       ' LCD Data bits on PORTB
       DEFINE LCD_DBIT 4           ' PORTB starting address
       DEFINE LCD_RSREG PORTB      ' LCD RS bit on PORTB
       DEFINE LCD_RSBIT 3          ' LCD RS bit address
       DEFINE LCD_EREG PORTB       ' LCD E bit on PORTB
       DEFINE LCD_EBIT 2           ' LCD E bit address
       DEFINE LCD_BITS 4           ' LCD in 4-bit mode
       DEFINE LCD_LINES 2          ' LCD has 2 rows
       DEFINE LCD_COMMANDUS 2000   ' Set command delay time in us
       DEFINE LCD_DATAUS 50        ' Set data delay time in us
       
       DEFINE HSER_RCSTA 90h
       DEFINE HSER_TXSTA 24h 'Testado 300-20h,600-20h,1200-20h,2400-20h,4800-24h,9600-24h,14400-24h,19200-24h,28800-24h
       DEFINE HSER_BAUD 28800
       DEFINE HSER_CLROERR 1
       
    '                             INICIO PROGRAMA
    ' ====================================================================
    Start:
     HIGH LED
     PAUSE 500
     LOW LED
     PAUSE 500
     HIGH LED
    
     LCDOUT $fe, 1
     lcdout "  Teste  Interrupt  "
     lcdout $FE,$C0," Por Hugo  Oliveira"
     pause 1000
    
    Main:
     HIGH LED
     PAUSE 500
     LOW LED
     PAUSE 500
    goto Main
    
    Interr:
     Hserin [wait("OK"),STR ID\2,str DAdos\4] 'Testado 300-20h,600-20h,1200-20h,2400-20h,4800-24h,9600-24h,14400-24h,19200-24h,28800-24h
    if id(0)="3" and id(1)="2" then
        if DADOS(0)="H" and DADOS(1)="u" and DADOS(2)="g" and DADOS(3)="o" then
            high led
            LCDOUT $fe, 1 
            lcdout "      Teste USB"
            lcdout $FE,$C0,"Recebido H          "
        endif 
             
        if DADOS(0)="L" and DADOS(1)="u" and DADOS(2)="L" and DADOS(3)="u" then
            low led
            LCDOUT $fe, 1 
            lcdout "      Teste USB"
            lcdout $FE,$C0,"Recebido L          " 
        endif
     
        if DADOS(0)<>"L" and DADOS(0)<>"H"  then
            LCDOUT $fe, 1 
            lcdout "      Teste USB"
            lcdout $FE,$C0,"Recebido    :",DADOS(0),DADOS(1),DADOS(2),DADOS(3)    
        endif
    endif
    @ INT_RETURN
    END
    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    The best solution ... I've never found one of those.
    Found things that "work" along the way, but there's always something better.

    Don't know if this is better or not, but it is definitely different.
    Code:
    <font color="#000000"><b>ID     </b><font color="#008000"><b>VAR BYTE
    
    </b></font><b>Interr</b>: 
        <font color="#008000"><b>Hserin </b></font><font color="#800000"><b>100</b></font>,<b>RXfail</b>, [<b>wait</b>(<font color="#FF0000">&quot;OK&quot;</font>),<font color="#008000"><b>DEC2 </b></font><b>ID</b>, <font color="#008000"><b>str </b></font><b>DAdos</b>\<font color="#800000"><b>4</b></font>] 
    
        <font color="#008000"><b>if </b></font><b>ID </b>= <font color="#800000"><b>32 </b></font><font color="#008000"><b>then
            </b></font><b>ARRAYREAD DAdos</b>, <font color="#800000"><b>4</b></font>,<b>No_Hugo</b>,[<b>WAIT</b>(<font color="#FF0000">&quot;Hugo&quot;</font>)]
                <font color="#008000"><b>high </b></font><b>led
                </b><font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$fe</b></font>, <font color="#800000"><b>1 
                </b></font><font color="#008000"><b>lcdout </b></font><font color="#FF0000">&quot;      Teste USB&quot;
                </font><font color="#008000"><b>lcdout </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>$C0</b></font>,<font color="#FF0000">&quot;Recebido H          &quot;
            </font><b>No_Hugo</b>:         
    
            <b>ARRAYREAD DAdos</b>, <font color="#800000"><b>4</b></font>,<b>No_LuLu</b>,[<b>WAIT</b>(<font color="#FF0000">&quot;LuLu&quot;</font>)]
                <font color="#008000"><b>low </b></font><b>led
                </b><font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$fe</b></font>, <font color="#800000"><b>1 
                </b></font><font color="#008000"><b>lcdout </b></font><font color="#FF0000">&quot;      Teste USB&quot;
                </font><font color="#008000"><b>lcdout </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>$C0</b></font>,<font color="#FF0000">&quot;Recebido L          &quot; 
            </font><b>No_LuLu</b>:
    
            <b>ARRAYREAD DAdos</b>, <font color="#800000"><b>2</b></font>,<b>NO_LH</b>,[<b>WAIT</b>(<font color="#FF0000">&quot;LH&quot;</font>)]
                <font color="#008000"><b>LCDOUT </b></font><font color="#800000"><b>$fe</b></font>, <font color="#800000"><b>1 
                </b></font><font color="#008000"><b>lcdout </b></font><font color="#FF0000">&quot;      Teste USB&quot;
                </font><font color="#008000"><b>lcdout </b></font><font color="#800000"><b>$FE</b></font>,<font color="#800000"><b>$C0</b></font>,<font color="#FF0000">&quot;Recebido    :&quot;</font>,<font color="#008000"><b>STR </b></font><b>DADOS</b>\<font color="#800000"><b>4
            </b></font><b>NO_LH</b>:
    
        <font color="#008000"><b>endif
    </b></font><b>RXfail</b>:
    <font color="#000080">@ INT_RETURN
    </font>
    If nothing else, you should add the RXfail timeout to the HSERIN statement.
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    The best solution ... I've never found one of those.
    Found things that "work" along the way, but there's always something better.

    Don't know if this is better or not, but it is definitely different.

    If nothing else, you should add the RXfail timeout to the HSERIN statement.
    WOW, Thank you Darrel. Much more btter and organized... must "better solution" than mine!

    Just tell me one thing, were can i find a descripion of he arrayread comand? I search on the PBP manual, but i cannot find it.

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    ARRAYREAD/ARRAYWRITE are new in PBP 2.60.

    I guess the RTFM would be section 5.3 (page 50) in the manual.
    There haven't been any tutorials that I know of yet.

    Essentially, ARRAYREAD is the same as a SERIN2.
    But it works on data that is already in an Array, instead of data being received via RS232.

    All the same modifiers work. WAIT DEC HEX BIN etc.
    Instead of a timeout, you specify the number of bytes to check.
    If it runs out of bytes before it satisfies the parameters, it jumps to the label. (ex. No_Hugo)

    The way I used it makes it more like an IF statement for Strings.

    hth,
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    ARRAYREAD/ARRAYWRITE are new in PBP 2.60.

    I guess the RTFM would be section 5.3 (page 50) in the manual.
    There haven't been any tutorials that I know of yet.

    Essentially, ARRAYREAD is the same as a SERIN2.
    But it works on data that is already in an Array, instead of data being received via RS232.

    All the same modifiers work. WAIT DEC HEX BIN etc.
    Instead of a timeout, you specify the number of bytes to check.
    If it runs out of bytes before it satisfies the parameters, it jumps to the label. (ex. No_Hugo)

    The way I used it makes it more like an IF statement for Strings.

    hth,
    Thanks for reply.

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