Problems with mpasm


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    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
    If your oscilloscope costs more than your car...

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


    Did you find this post helpful? Yes | No

    Default fp, mpasm, pm, mplab

    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


    Quote Originally Posted by b1arrk5 View Post
    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
    Attached Files Attached Files

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    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.

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


    Did you find this post helpful? Yes | No

    Default mpasm

    the Mpasm is the one included in the MPLAB 8.10
    Tnks
    Ambrogio
    IW2FVO

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

  5. #5
    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

  6. #6
    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.

  7. #7
    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

  8. #8
    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...

  9. #9
    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

  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

    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.

  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,
    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...

  12. #12
    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.

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