Problems with mpasm


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

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

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default mpasm

    hi Bruce,
    Yes, I disabled the case sensitive, ( no tick ).
    Thanks
    ambrogio iw2fvo
    Quote Originally Posted by Bruce View Post
    Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.

  3. #3
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default mpasm and Melabs Floating Point

    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

    Quote Originally Posted by Bruce View Post
    Have you disabled case sensitivity in MPASM? This can cause a lot of odd problems.
    Attached Files Attached Files

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iw2fvo View Post
    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...

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    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;
    Code:
    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.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Mpasm and Melabs F P

    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


    Quote Originally Posted by Bruce View Post
    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;
    Code:
    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.

  7. #7
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default mpasm and Melabs f p

    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

    Quote Originally Posted by skimask View Post
    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...

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iw2fvo View Post
    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.

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    MeLabs has a nice intro to longs here: http://www.microengineeringlabs.com/...cles/longs.pdf
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  10. #10
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default mpasm and Melabs F P

    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




    Quote Originally Posted by Bruce View Post
    MeLabs has a nice intro to longs here: http://www.microengineeringlabs.com/...cles/longs.pdf

  11. #11
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default mpasm and melabs F P

    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






    Quote Originally Posted by skimask View Post
    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.

  12. #12
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iw2fvo View Post
    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.

Similar Threads

  1. Moved from PM to MPASM and have fuse definition problems
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th November 2008, 22:27
  2. 12F675 MCLR directive MPASM
    By OLDSCHOOL in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th May 2008, 01:29
  3. MPASM 18F4550 getting started
    By BrianT in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th September 2007, 23:59
  4. MPASM problems
    By BrianT in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 31st August 2007, 01:29
  5. Converting to MPASM
    By btaylor in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th November 2005, 01:35

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