PDA

View Full Version : Embedded strings in code mpasm error



BrianS
- 23rd August 2010, 17:38
I'm using the code below. I am keep receiving these errors and can't figure out why. It did work before for me but now doesn't. Any help would be greatly appreciated. I'm using the latest version of PBP and MPLab 8.4 with associated MPASM. Seems it doesn't recognize "Wout" .

ERROR: Unable to execute mpasmwin.Error[113] C:\PBP\PBPPI18L.LIB 593 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 601 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 601 : Symbol not previously defined (Wout)
Error[113] C:\PBP\LSI\PORTEXPANDER\PORTEXPANDER.ASM 672 : Symbol not previously defined (Wout)
Error[113] C:\PBP\LSI\PORTEXPANDER\PORTEXPANDER.ASM 674 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 593 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 601 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 601 : Symbol not previously defined (Wout)
Error[113] C:\PBP\LSI\PORTEXPANDER\PORTEXPANDER.ASM 672 : Symbol not previously defined (Wout)
Error[113] C:\PBP\LSI\PORTEXPANDER\PORTEXPANDER.ASM 674 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 593 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 601 : Symbol not previously defined (Wout)
Error[113] C:\PBP\PBPPI18L.LIB 601 : Symbol not previously defined (Wout)
Error[113] C:\PBP\LSI\PORTEXPANDER\PORTEXPANDER.ASM 672 : Symbol not previously defined (Wout)
Error[113] C:\PBP\LSI\PORTEXPANDER\PORTEXPANDER.ASM 674 : Symbol not previously defined (Wout)





'------------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

malc-c
- 23rd August 2010, 17:57
Not that I have the answer, but if you could inform us what the target PIC is it might helpw those with more knowledge than I to advise.

My guess is that you need to edit the associated .INC file for the chip you are using by commenting out the config lines. This file is located in the PBP folder.

EG:


;************************************************* ***************
;* 18F4580.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2008 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 09/15/08 *
;* Version : 2.60 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F4580, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F4580.INC" ; MPASM Header
;__CONFIG _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
;__CONFIG _CONFIG3H, _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
;__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _BBSIZ_1024_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 8


Also... if using microcode studio to edit... make sure you have the correct target chip selected

Acetronics2
- 23rd August 2010, 18:08
Hi, Brian

As Malc gently tells ...

I am totally unable to understand what you are talking about... as long as your project is " top secret classified " !!! ;)

Could you provide a piece of program with config part, and enough to understand what you try to do ... ???

I only suppose the " MCP23S17 " secret code appears somewhere ...

Could this help ??? http://www.picbasic.co.uk/forum/showthread.php?t=12951&pagenumber=

Ok ... once more Darrel has striken here ... http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10


Alain

BrianS
- 23rd August 2010, 18:21
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".


'************************************************* ***************
'* 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

mackrackit
- 23rd August 2010, 18:53
Is Wout defined as a VAR?
In the ASM part
_Wout

BrianS
- 23rd August 2010, 19:03
It is used in C:\PBP\PBPPI18L.LIB but does not seem to be declared as a var in that file.



Is Wout defined as a VAR?
In the ASM part
_Wout

Acetronics2
- 23rd August 2010, 19:43
Hi, Brian

Darrel's code compiles without any problem, either with MPLAB 8.56 or MCS
PBP is 2.60 a

soooo ... error is elsewhere ...

Alain

BryanSw
- 23rd August 2010, 20:03
It compiles fine on my laptop too, and did compile on my work computer also. But not today. Now it is giving those stated errors and I'm trying to track down what is causing it. I am trying to figure out why "wout" is showing up as not defined on my work computer.

Brian


Hi, Brian

Darrel's code compiles without any problem, either with MPLAB 8.56 or MCS
PBP is 2.60 a

soooo ... error is elsewhere ...

Alain

Bruce
- 23rd August 2010, 20:31
Wout doesn't get defined as a variable. It's an argument passed to the macro at the time the macro is invoked.

Example: @ GetAddress _String1, _Addr

The address of String1 gets passed to the macro as the Label argument. The address of your word variable Addr gets passed to the macro as the Wout argument.

You most likely have wout somewhere VS Wout and have case sensitivity turned ON in MPASM. Start MPASMWIN.EXE and uncheck the case sensitivity option.

The error from the library file is where the CHK?RP macro can't find Wout either.

Your code as posted above compiles fine here.

BryanSw
- 23rd August 2010, 21:21
Found the problem. Also sorry for the confusion and appreciate all your help. The cause of the problem was bad commenting in the inline assembly. It is not apparent in my posted code as I copied that from my backup code. Seems I was sticking to the PBP way of commenting even in inline assembly.

Here is why it wouldn't compile.


Bad Code

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

Good Code

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

Once again thanks for for help. Didn't catch this to easily as it looked normal to me to use a ' instead of a ;
Maybe something for others to watch out for too.
Thanks,
Bryan