PDA

View Full Version : Problems with mpasm



electrosolve
- 19th July 2003, 22:38
Hi All

I need to modify an existing program to include the floating point maths routines from Microchip. To do this I understand I have to compile using mpasm.

Before trying to use the routines from Microchip, I have tried assembling my existing program using mpasm. This produces a number of errors

All of the errors produced are "Symbol not previously defined"

These are a few of them

Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 766 : Symbol not
previously defined (PCLATH)
Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 773 : Symbol not
previously defined (PCLATH)
Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 712 : Symbol not
previously defined (PCLATH)
Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 719 : Symbol not
previously defined (PCLATH)

The program compiles fine using the Melabs assembler.

The device is a 16F876

Any ideas?

Thanks

Reg Smith

cphillips82
- 30th April 2008, 23:07
i'm having the same problem

mister_e
- 30th April 2008, 23:32
Did you checked the wind direction?

CODE (ALL)
PIC
PBP version
MPASM VERSION

iw2fvo
- 28th June 2008, 15:31
Hi,
I am new to this forum: I do have the same problem: I compile a basic program with MP and everything goes fine. If the same program is compiled using MPASM I do have the same error list.
Have you some directions for me ?
Thanks
Ambro
IW2FVO





Hi All

I need to modify an existing program to include the floating point maths routines from Microchip. To do this I understand I have to compile using mpasm.

Before trying to use the routines from Microchip, I have tried assembling my existing program using mpasm. This produces a number of errors

All of the errors produced are "Symbol not previously defined"

These are a few of them

Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 766 : Symbol not
previously defined (PCLATH)
Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 773 : Symbol not
previously defined (PCLATH)
Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 712 : Symbol not
previously defined (PCLATH)
Error[113] C:\OLDHARD\PROGRAMS\PBP\PBPPIC14.LIB 719 : Symbol not
previously defined (PCLATH)

The program compiles fine using the Melabs assembler.

The device is a 16F876

Any ideas?

Thanks

Reg Smith

b1arrk5
- 1st July 2008, 02:48
I'll take a guess, how old is your version of MPASM? I think the new one is 5.14. As Steve mentioned, it's easier to get help if you post the code, and version numbers, as chips, programs, etc. change pretty often, and they update the include files, etc. fairly often.
HTH,

Jerry

iw2fvo
- 1st July 2008, 22:21
Hi,
first of all i have to apologize in advance because of my English ( I am Italian ) and because i am very new to this forum and to PIC world.

I wrote a basic program for the 877 target pic and I found stange behaviors of the system.
The source is written using microcode studio.
The program uses a FP routins called DDS in the source file. If the DDS routine is included in a subroutine then i do not have any compiling error BUT the pic does not work at all.
If I call out the routine every time it is needed then the system works . If the routine is called out more than three times then no error during compiling is observed BUT the Pic does not work.
I did several tentative using the MPASM and using the MPLAB : the error lists are attached .
I did rem_out the first two lines of the program using Mpasm. Using Mpasm I did rem_out "c" and "z" register bit declaration to avoid additional errors !
I am not really sure if the use of FP routines have some limitation...
Thanks a lot for any direction on the matter.
Ambrogio
IW2FVO



I'll take a guess, how old is your version of MPASM? I think the new one is 5.14. As Steve mentioned, it's easier to get help if you post the code, and version numbers, as chips, programs, etc. change pretty often, and they update the include files, etc. fairly often.
HTH,

Jerry

skimask
- 1st July 2008, 22:27
How much programming of PICs have you done in your new world?
Have you made a blinky LED yet or anything of the sort? If not, I'd highly suggest building a few simpler 'things' and build up.
The WARNINGs are just that, warnings, and not errors, and generally don't matter much, in this case, they don't mean much.
The last line in the 2nd file...BUILD SUCCEEDED...that's what matters.

iw2fvo
- 2nd July 2008, 10:32
the Mpasm is the one included in the MPLAB 8.10
Tnks
Ambrogio
IW2FVO


I'll take a guess, how old is your version of MPASM? I think the new one is 5.14. As Steve mentioned, it's easier to get help if you post the code, and version numbers, as chips, programs, etc. change pretty often, and they update the include files, etc. fairly often.
HTH,

Jerry

Bruce
- 2nd July 2008, 16:39
Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.

iw2fvo
- 2nd July 2008, 18:14
hi Bruce,
Yes, I disabled the case sensitive, ( no tick ).
Thanks
ambrogio iw2fvo

Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.

iw2fvo
- 2nd July 2008, 20:04
I still have a problem compiling with MPASM a picbasic program that includes Melabs floating point.
The program is attached to the message.
The error list that appears to me using Mpasm and the pic18f452 is here:

Executing: "c:\pbp_250\PBPW.EXE" -ampasmwin -oq -z -p18F452 "452_9912_3.pbp"
PICBASIC PRO(TM) Compiler 2.50, (c) 1998, 2007 microEngineering Labs, Inc.
All Rights Reserved.
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 805 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 1222 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 1411 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 1895 : Symbol not previously defined (flo3232)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2369 : Symbol not previously defined (fsr)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2376 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2377 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2379 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2381 : Symbol not previously defined (indf)
Error[113] D:\PRJ_ACTIVE\452_9912_3.ASM 2382 : Symbol not previously defined (fsr)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2386 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2386 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2387 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2387 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2388 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2388 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2389 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2389 : Illegal opcode (_binary)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2390 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2390 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2391 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2391 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2392 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2392 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2393 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2393 : Illegal opcode (_bcd)
Warning[207] D:\PRJ_ACTIVE\452_9912_3.ASM 2394 : Found label after column 1. (rlf)
Error[122] D:\PRJ_ACTIVE\452_9912_3.ASM 2394 : Illegal opcode (_bcd)
Loaded D:\prj_active\452_9912_3.COD.
BUILD SUCCEEDED: Wed Jul 02 18:07:22 2008

Any suggestion ?
Thank you
regards,
Ambrogio
IW2FVO


Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.

skimask
- 2nd July 2008, 20:47
I still have a problem compiling with MPASM a picbasic program that includes Melabs floating point.
The program is attached to the message.
The error list that appears to me using Mpasm and the pic18f452 is here:

Why do you need to use the floating point routines in the first place?
I don't really see a need for them in that code...

Bruce
- 2nd July 2008, 21:26
It looks like your bin_bcd routine was writen for a 16F part. RLF is not an 18F instruction.

The 18F equivalent would be RLCF.

Also FSR and INDF are different on the 18F parts. You have FSR0, FSR1, FSR2, and INDF0,
INDF1, INDF2. See the 18F data sheet for details. You'll need to make a few changes to
compile this for an 18F.

Your example compiles fine with these changes to bin_bcd;


bin_bcd:
asm
;************************************************* *****************
; Convert 32-bit binary number at <bin> into a bcd number
; at <bcd>. Uses Mike Keitz's procedure for handling bcd
; adjust; Modified Microchip AN526 for 32-bits.

b2bcd movlw 32 ; 32-bits
movwf _ii ; make cycle counter
clrf _bcd ; clear result area
clrf _bcd+1
clrf _bcd+2
clrf _bcd+3
clrf _bcd+4

b2bcd2 movlw _bcd ; make pointer
movwf fsr0
movlw 5
movwf _cnt

; Mike's routine:

b2bcd3 movlw 0x33
addwf indf0,f ; add to both nybbles
btfsc indf0,3 ; test if low result > 7
andlw 0xf0 ; low result >7 so take the 3 out
btfsc indf0,7 ; test if high result > 7
andlw 0x0f ; high result > 7 so ok
subwf indf0,f ; any results <= 7, subtract back
incf fsr0,f ; point to next
decfsz _cnt
goto b2bcd3

rlcf _binary+3,f ; get another bit
rlcf _binary+2,f
rlcf _binary+1,f
rlcf _binary+0,f
rlcf _bcd+4,f ; put it into bcd
rlcf _bcd+3,f
rlcf _bcd+2,f
rlcf _bcd+1,f
rlcf _bcd+0,f
decfsz _ii,f ; all done?
goto b2bcd2 ; no, loop
; yes
endasm
return
I can't say if it works or not, but it does compile without a single error.

iw2fvo
- 3rd July 2008, 13:25
Hi,
I am happy because I understand that you have read the basic program but I am really interested in knowing how can my program be wtitten without using the F P.
Could you please inform how it can be done ? It will be a very interesting solution.
Thanks for the help
regards,
Ambrogio
iw2fvo
Italy


Why do you need to use the floating point routines in the first place?
I don't really see a need for them in that code...

iw2fvo
- 3rd July 2008, 13:30
Bruce,
your reply is a very good solution for the compiling errors.
As you point out the program compiles with NO errors.
That is great ! Thanks a lot for the help.

I will run the program on the 542 to see if it will work.
Bye
Ambrogio
IW2FVO
North Italy



It looks like your bin_bcd routine was writen for a 16F part. RLF is not an 18F instruction.

The 18F equivalent would be RLCF.

Also FSR and INDF are different on the 18F parts. You have FSR0, FSR1, FSR2, and INDF0,
INDF1, INDF2. See the 18F data sheet for details. You'll need to make a few changes to
compile this for an 18F.

Your example compiles fine with these changes to bin_bcd;


bin_bcd:
asm
;************************************************* *****************
; Convert 32-bit binary number at <bin> into a bcd number
; at <bcd>. Uses Mike Keitz's procedure for handling bcd
; adjust; Modified Microchip AN526 for 32-bits.

b2bcd movlw 32 ; 32-bits
movwf _ii ; make cycle counter
clrf _bcd ; clear result area
clrf _bcd+1
clrf _bcd+2
clrf _bcd+3
clrf _bcd+4

b2bcd2 movlw _bcd ; make pointer
movwf fsr0
movlw 5
movwf _cnt

; Mike's routine:

b2bcd3 movlw 0x33
addwf indf0,f ; add to both nybbles
btfsc indf0,3 ; test if low result > 7
andlw 0xf0 ; low result >7 so take the 3 out
btfsc indf0,7 ; test if high result > 7
andlw 0x0f ; high result > 7 so ok
subwf indf0,f ; any results <= 7, subtract back
incf fsr0,f ; point to next
decfsz _cnt
goto b2bcd3

rlcf _binary+3,f ; get another bit
rlcf _binary+2,f
rlcf _binary+1,f
rlcf _binary+0,f
rlcf _bcd+4,f ; put it into bcd
rlcf _bcd+3,f
rlcf _bcd+2,f
rlcf _bcd+1,f
rlcf _bcd+0,f
decfsz _ii,f ; all done?
goto b2bcd2 ; no, loop
; yes
endasm
return
I can't say if it works or not, but it does compile without a single error.

skimask
- 3rd July 2008, 14:43
Hi,
I am happy because I understand that you have read the basic program but I am really interested in knowing how can my program be wtitten without using the F P.
Could you please inform how it can be done ? It will be a very interesting solution.

Nothing interesting about it.
Where is the program using numbers between 0 and 1? Or fractions for that matter?
All I see is numbers that go above 16 bit. If that's the case, and you are using an 18Fxxx part, then you can use LONG variables to handle 32 bit (large) numbers.

Bruce
- 3rd July 2008, 15:07
MeLabs has a nice intro to longs here: http://www.microengineeringlabs.com/resources/articles/longs.pdf

iw2fvo
- 3rd July 2008, 15:39
Hi,
thanks for the interest:
this is the peace of program that in my opinion needs a fp:

'DDS: '------------------------------------------------------------------------

AARGB0=f0
AARGB1=f1
AARGB2=f2
AARGB3=f3

ASM
CALL flo3232
ENDASM

debug HEX2 f0," ", HEX2 f1," ", HEX2 f2, " " , HEX2 f3, 13,10




' CALCOLO DELLA FTW DA INVIARE AL DDS
' 2^48/1.000.000.000= 281474,976710656
' USARE IL PROGRAMMA FREP.EXE DELLE ROUTINES FP PER CONVERTIRLO DIRETTAMENTE
' ATTENZIONE: USARE $81 INVECE DI 91 PERCHE' I 2 BYTE MENO SIGNUFICATIVI LI LASCIO
' A ZERO ( VEDERE MAIL DI i0cg )


BEXP=$81
BARGB0=$09
BARGB1=$70
BARGB2=$5F

GOSUB FPMUL

ASM
CALL INT3232
ENDASM

'debug " start ",dec aargb0," ",dec aargb1," ", dec aargb2," ",dec aargb3,13,10

LOW DDSCSB
'SHIFTOUT DDSDAT,DDSCLK,1,[%01100001,%10101011,aargb0,aargb1,aargb2,aargb3,$0 0,$00]
HIGH DDSCSB
HIGH DDSUPDT
LOW DDSUPDT

-------------------------------------------------------------------------------------
Have you some differents indication for me ?
( I am sorry for my bad English .. I am Italian )
Sometimes is very hard for me to understand the real meaning of the things !

Thanks again
Ambrogio
IW2FVO







Nothing interesting about it.
Where is the program using numbers between 0 and 1? Or fractions for that matter?
All I see is numbers that go above 16 bit. If that's the case, and you are using an 18Fxxx part, then you can use LONG variables to handle 32 bit (large) numbers.

skimask
- 3rd July 2008, 15:45
Hi,
thanks for the interest:
this is the peace of program that in my opinion needs a fp:

Why does it need floating point?
Just because the program has it there, doesn't mean it has to be there.
Rewrite the program to NOT use floating point.
Again, I don't see any decimals points needed here. At most, a 32 bit variable.

iw2fvo
- 3rd July 2008, 15:59
Ok , Thanks Bruce I will have a look to longs as suggested.
I am writing a program in order to control the Analog Device AD9912 DDS: this device will be used as a RF signal generator for radio ham use. The point is that I have to multiply a number as like as
2^48/1000000000 ( 281474.976711) by another number that is the readout of the real output frequency ( from 1 Hz to 400 MHz ) . At the moment the Melabs FP works well and gives me the correct output frequency.
Unfortunately i can not put the " DDS" piece of program in a subroutine : in this case i do have no errors after compiling but the 16F877 does not work.
And, if I recall the "DDS" piece of program more than three times in my program i do have the same result.

>> question: how can i set the HS oscillator using the Mpasm and pic16f877 with no problem ?

Thanks a lot.
Ambrogio
IW2FVO





MeLabs has a nice intro to longs here: http://www.microengineeringlabs.com/resources/articles/longs.pdf

skimask
- 3rd July 2008, 16:38
I am writing a program in order to control the Analog Device AD9912 DDS
Would've been a lot handier to have that information awhile back ya think?
Now I see what you're trying to do. I suppose it's a matter of how you look at it. You need the ability to handle large numbers more than you need floating point specifically...and to be able to handle those numbers with some precision. If I remember right, PBP can handle some 48 bit math (more specifically, I think you can retrieve some of the overflow from a 32x32 multiply). I don't have the manual handy, so I don't want to comment on it at the moment.

Bruce
- 3rd July 2008, 18:05
Have you seen this? http://www.picbasic.co.uk/forum/showthread.php?t=1942

iw2fvo
- 3rd July 2008, 23:12
I want to set up the HS oscillator mode for the pic 16f877 using Mpasm.

I did use the following for the PM:

@ device PIC16F877,HS_OSC,LVP_OFF, PROTECT_OFF ' use for PM only

What shoul I write for the Mpasm use without having the overwrite error message?
What .INC file should I have to modify ? ( pbp or mpasm ? ), if any.

Thanks a lot
Bye
Ambrogio
IW2FVO

Bruce
- 4th July 2008, 00:26
See here: http://www.picbasic.co.uk/forum/showthread.php?t=543

iw2fvo
- 4th July 2008, 13:25
Very good !
I found what I need !
Now it OK.
Thanks
Ambrogio
Iw2fvo



See here: http://www.picbasic.co.uk/forum/showthread.php?t=543

iw2fvo
- 4th July 2008, 13:32
Hi,
is the picbasic pro manual " 3 / 04" applicable to the 2.50 version of PBP ?
Tnks
Bye
Ambrogio
IW2FVO


Would've been a lot handier to have that information awhile back ya think?
Now I see what you're trying to do. I suppose it's a matter of how you look at it. You need the ability to handle large numbers more than you need floating point specifically...and to be able to handle those numbers with some precision. If I remember right, PBP can handle some 48 bit math (more specifically, I think you can retrieve some of the overflow from a 32x32 multiply). I don't have the manual handy, so I don't want to comment on it at the moment.

skimask
- 4th July 2008, 19:14
Hi,
is the picbasic pro manual " 3 / 04" applicable to the 2.50 version of PBP ?
Tnks
Bye
Ambrogio
IW2FVO

No...
You should've gotten a new version of the manual when you BOUGHT (and/or upgraded to) PicBasicPro 2.50
So...I guess we know where you stand...

iw2fvo
- 6th July 2008, 21:23
I bought the earlier versione named 2.46 years ago and i do have the manual. If you are so interested this version did cost to me around 230 € here.
A German radio ham gave me a recent version that is the 2.50 but without any manual.
I am waiting to receive manual or instruction from him soon.

Speaking from a more actractive point of view, I am interest in implementing the program using the new "long" capability of the basic. I will try to modify the program.
I stand here!
Any help is appreciated.
Regards,
Ambro




No...
You should've gotten a new version of the manual when you BOUGHT (and/or upgraded to) PicBasicPro 2.50
So...I guess we know where you stand...

mackrackit
- 6th July 2008, 22:10
I bought the earlier versione named 2.46 years ago and i do have the manual. If you are so interested this version did cost to me around 230 € here.
A German radio ham gave me a recent version that is the 2.50 but without any manual.
I am waiting to receive manual or instruction from him soon.

Speaking from a more actractive point of view, I am interest in implementing the program using the new "long" capability of the basic. I will try to modify the program.
I stand here!
Any help is appreciated.
Regards,
Ambro
At least you are honest about having an illegal copy.

Why not just spend the $25.00 USD and upgrade?

Then you will have a manual.

Archangel
- 6th July 2008, 22:33
<font color=green><b>At least you are honest about having an illegal copy.</font color></b>

Why not just spend the $25.00 USD and upgrade?

Then you will have a manual.

By the time the Fachisi in the E U get done taxing that $25 it will be $75, I wonder if that GERMAN HAM would be so quick to share if M E Labs were a German company.
BTW mackrackit<font color=green><b> that statement is a bit of an oxymoron</b></font color> wouldn't you say?

mackrackit
- 6th July 2008, 22:52
Yep :D
Kind of like bacterial soap.

Adrian
- 7th July 2008, 15:59
Off topic...sorry

....E U get done taxing that $25 it will be $75....

You're right! Tax is the buzz word here at present. UK diesel price about $12 gallon, at present conversion rates. Tax rate on fuel is over 150% and set to rise in October. Hold onto your hats!!

Adrian

iw2fvo
- 7th July 2008, 16:29
It seems to me that the forum argument now is the update to version 2.50 of the old version of the pbp that i bought in the past year. I have not pay for the update : we are two radio hams both working on the same NON PROFIT DDS control at radio Ham level only. I really do not think to be "illegal" since the other radio ham did pay for the update.
But I am understanding ( if I am not wrong .. English is my second language that i do not know well ) I am not receiving technical help because of the illegality.
If it is like this, I could consider to pay 25 USD for the update that I already have .
Our target is to have the DDS control working for the Analog devices AD9912 chip.
I am also convinced that most of the people who read the forum are more interestd on the real technical aspects.
Anyway,
thanks to the people on the forum.
Ambro

skimask
- 7th July 2008, 21:47
we are two radio hams both working on the same NON PROFIT DDS
The overwhelming vast majority of us here are NON PROFIT hobbyists here. We all pay the same amount for the same software (well most of us anyways). We all get to fork out the $250USD (plus any applicable taxes) for the same product, the same support, the same everything. I don't think anybody here is any more special than anybody else (with a few exceptions).

On the back of the first page of the manual, there is a statement:

"Use of the PICBASIC PRO Compiler without first obtaining a license is a violation of the law."

Sounds fairly straight forward to me...