Migrating to MPASM


Closed Thread
Results 1 to 16 of 16
  1. #1
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86

    Default Migrating to MPASM

    I switched over to MPASM several months ago when I started using an 18F4520. I'm going back to some of my other code that needs an update and am having trouble with a 16F631. I have commented out the config lines in the inc file. I get "Error[113] c:\pbp\pbppic14.lib 5985 : Symbol not previously defined (EEPGD)"

    After stripping down the code I have isolated the error to anytime I use a read or write statement. If I switch back to PM all is well.

    Code:
    define osc 8
    Clear
    
    '@     device pic16F631, INTOSCIO, wdt_on, pwrt_on, MCLR_OFF, protect_on, IESO_OFF
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _IESO_ON
     
    OSCCON = %01110101              'set internal osc on to 8 mhz
    		
    
    Prev_Baud   var byte
    
    
    ANSEL = 0               'set port to digital
    OPTION_REG.7 = 0        'enable pull ups on A and B
    
    
    read 0, Prev_Baud
    if Prev_Baud > 4 then   'don't allow anything over 19200, default to 9600
        write 0, 3
    endif
    
    Pause 1000
    
    main:
    
    goto main
    
    End
    Any ideas? I would rather not have to always switch back and forth depending on which chip I'm using. I uninstalled and removed MPASM and installed the newest version already.

    David

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Luckyborg View Post
    I switched over to MPASM several months ago when I started using an 18F4520. I'm going back to some of my other code that needs an update and am having trouble with a 16F631. I have commented out the config lines in the inc file. I get "Error[113] c:\pbp\pbppic14.lib 5985 : Symbol not previously defined (EEPGD)"

    After stripping down the code I have isolated the error to anytime I use a read or write statement. If I switch back to PM all is well.

    Code:
    define osc 8
    Clear
    
    '@     device pic16F631, INTOSCIO, wdt_on, pwrt_on, MCLR_OFF, protect_on, IESO_OFF
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _IESO_ON
     
    OSCCON = %01110101              'set internal osc on to 8 mhz
    		
    
    Prev_Baud   var byte
    
    
    ANSEL = 0               'set port to digital
    OPTION_REG.7 = 0        'enable pull ups on A and B
    
    
    read 0, Prev_Baud
    if Prev_Baud > 4 then   'don't allow anything over 19200, default to 9600
        write 0, 3
    endif
    
    Pause 1000
    
    main:
    
    goto main
    
    End
    Any ideas? I would rather not have to always switch back and forth depending on which chip I'm using. I uninstalled and removed MPASM and installed the newest version already.

    David
    Hi David,
    I cannot duplicate the error, I copied and pasted your code into an existing program, ditto for your config and it compiles fine for a 16F631 for me PBP ver 2.6. I thought the omission of eecon1 settings might be your problem, but alas it compiles without error without it. What version of PBP are you using? Maybe the latest ver. has added something because I see no mention of EEPGD in my lib until line 6069 and there is mention of EECON1 in there, try setting the EECON1 register and see it that works. The 16F631 series resets with eeprom write disabled to prevent accidental writes on power up.
    Last edited by Archangel; - 13th August 2009 at 22:03.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86


    Did you find this post helpful? Yes | No

    Default

    I'm using compiler version 2.47, maybe that is the problem. I see melabs updated some RAM issues with this chip. I don't know enough to know if the compiler will pass the code off to the PM assembler correctly but not to MPASM. My code has seemed to work correctly for quite a while, but perhaps I'm not pushing the right buttons to make it break.

    Thanks for checking for me Joe.

    Anyone else out there with 2.47 who can try to compile the above for me to see if they get the same results or not?

    David

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


    Did you find this post helpful? Yes | No

    Default

    The RAM issue is an easy fix. Open your 16F631.BAS file and change BANK0 $0020, $007F
    to BANK0 $0040, $007F. RAM on this one starts at $40 not $20. Save & exit.

    The EEPGD thing is due to the 16F631 not having this bit available, since it can't read/write
    to its own program memory. But the library functions for READ and WRITE use it.

    You can fix the READ/WRITE library routines:

    Open your pbppic14.lib, and scroll down to the READ library routine.

    Comment the bcf EECON1,EEPGD and add the clrf EECON1 just below it.
    Code:
     ;bcf  EECON1, EEPGD	; Read from data memory
      clrf  EECON1		; Read from data memory
    Scroll down a ways to the WRITE library routine, and do the same thing.

    I don't have a 16F631 to test, so let me know if this fixes it for you.
    Regards,

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

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I am still using PBP2.5 and I get the ram errors also.

    The 16f631.bas currently has
    BANK0 $0040, $007F

    RAM END MUST BE DEFINED is the error.

    EDIT>>>
    I get the same errors with PM also... So it must not be a MPASM thing
    Last edited by mackrackit; - 13th August 2009 at 22:55.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86


    Did you find this post helpful? Yes | No

    Default

    I had the RAM issue already fixed. I had forgotten Charles LEO helped with that back in 07 when I first started with this chip. I have since made the 2 changes to the read and write routines that Bruce gave and the errors went away. Now all that is left to do is to test it out. Thanks to everyone for your help

    David

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Luckyborg View Post
    I had the RAM issue already fixed. I had forgotten Charles LEO helped with that back in 07 when I first started with this chip. I have since made the 2 changes to the read and write routines that Bruce gave and the errors went away. Now all that is left to do is to test it out. Thanks to everyone for your help

    David
    How were the ram errors fixed?
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86


    Did you find this post helpful? Yes | No

    Default

    I had modified the file manually at Charles instructions. I originally emailed MELabs and they told me what to fix for the RAM bank problem. Bruce's instructions got rid of the 2 errors I originally posted. I never got the same error that you posted. I never had any problems with PM.

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    That is interesting.
    I do not have that chip so I guess I will not worry about it on this version.

    Thanks.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Dave,

    I tried this with 2.50c and didn't get the error you show. Have you downloaded/installed
    the 2.50c patch?
    Regards,

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

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Hi, Bruce

    No error nor with PbP 2.50c / MCS / MPASM ...

    The 2.50c release has .bas and .lib genuine corrected files

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  12. #12
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Looks like I need the patch. But darn, I have modified files. Time for the upgrade.

    Thanks for the info..
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Looks like I need the patch. But darn, I have modified files. Time for the upgrade.

    Thanks for the info..
    Hi Dave,
    The "Upgrade" will not only waack your modified files, you<b> WILL</b> have to modify all your programs where you used " LOOP" as a label, because they added a<b> DO LOOP</b> function. Thinking out loud . . . I wonder if I can stop that function by editing it out of the library . . .
    Last edited by Archangel; - 14th August 2009 at 17:12. Reason: html
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  14. #14
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Unhappy

    Hi, Dave

    you lucky Americans ...

    2.60 Upgrade in Europe = ... ~ 60 US $ ...

    http://www.crownhill.co.uk/product.php?prod=2127

    you said strange ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  15. #15
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Dave

    you lucky Americans ...

    2.60 Upgrade in Europe = ... ~ 60 US $ ...

    http://www.crownhill.co.uk/product.php?prod=2127

    you said strange ???

    Alain
    Yes, and You lucky Europeans got PICKit2 much cheaper than we did But seriously, wait a couple of more weeks and $60 US will be worth what . . . about 12 Euros ?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  16. #16
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hi Dave,
    The "Upgrade" will not only waack your modified files, you<b> WILL</b> have to modify all your programs where you used " LOOP" as a label, because they added a<b> DO LOOP</b> function. Thinking out loud . . . I wonder if I can stop that function by editing it out of the library . . .
    Looks like the new version is going to be a lot of fun.

    Quote Originally Posted by Acetronics View Post
    Hi, Dave

    you lucky Americans ...

    2.60 Upgrade in Europe = ... ~ 60 US $ ...

    http://www.crownhill.co.uk/product.php?prod=2127

    you said strange ???

    Alain
    You gotta pay something to float the CDs and keep the manual dry going across the pond.

    Strange?? I resemble that
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. 16F914 and MPASM
    By jderson in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th February 2009, 03:21
  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. 18F8722 and MPASM confusion!
    By Jackson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd April 2006, 01:24
  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