Embedded strings in code mpasm error


Results 1 to 10 of 10

Threaded View

  1. #4
    Join Date
    Jul 2010
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    My chip is a 18f4620.

    This is basically the code (Below) I am trying to use. It did work just a few days ago but now is compiling with the error I had listed.
    Really I am only posting the part of the code that is failing to compile. Problem with "Wout".

    Code:
    '****************************************************************
    '*  Name    : STRINGS-16.PBP                                    *
    '*  Author  : Darrel Taylor                                     *
    '*  Date    : 6/12/2005                                         *
    '*  Note:  Strings must be NULL Terminated                      *
    '****************************************************************
    DEFINE LOADER_USED 1       ' If using bootloader
    DEFINE OSC 4
    DEFINE HSER_TXSTA  24h     ' Use this for Higher Baud Rates
    DEFINE HSER_SPBRG  25      ' 9600 Baud at 4mhz
    
    Addr        var word
    Char        var byte
    
    Clear
    
    goto StartLoop ' Required
    
    String1:
    @ da "This is a string",0
    
    AnotherString:
    @ da "Here is another string",0
    
    '------------GetAddress Macro - Location insensitive -------------------------
    ASM
    GetAddress macro Label, Wout       ; Returns the Address of a Label as a Word
        CHK?RP Wout
        movlw low Label
        movwf Wout
        movlw High Label
        movwf Wout + 1
        endm
    ENDASM
    
    
    StartLoop  ' This loop repeats continuously just as a test.
       @ GetAddress _String1, _Addr        ' Get address of String
       gosub StringOut                     ' Send the String
       hserout [13,10]                     ' New Line
    
       @ GetAddress _AnotherString, _Addr  ' Get address of String
       gosub StringOut                     ' Send the String
       hserout [13,10]                     ' New Line
       pause 500
    goto StartLoop                         ' Repeat
    
    
    StringOut:  ' Send the string out via Hserout
        Readcode Addr, Char           ' Get a character
        if Char  = 0 then StringDone  ' Look for Null char, Stop if found
        hserout [Char]                ' Send char
        Addr = Addr + 1               ' Point to next character
        goto StringOut                ' Continue with rest of the string
      StringDone:
    return
    
    
    end
    Last edited by BrianS; - 23rd August 2010 at 18:24.

Members who have read this thread : 0

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