Converting to MPASM


Closed Thread
Results 1 to 12 of 12

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    MPASM is a component part of MPLAB. MPLAB 7.22 is the latest at this time containing MPASM 5.0 of 30 September 2005.

  2. #2
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default MPASM saga continues

    OOPS a duplicate some how.
    Last edited by btaylor; - 4th November 2005 at 00:11.

  3. #3
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default MPASM saga continues

    Hello Melanie.

    As you suggested, I went to the microchip homepage and clicked QUICKLINKS then Development Software and downloaded the 38 Mbyte zip file of MPLAB IDE ver 7.22 which I believe to be the latest version. MPLAB includes MPASM.

    I unzipped this into a directory C:\MPASM. From that directory I clicked MPLAB_v722.exe and let it install the full MPLAB system to the default directory C:\program files\microchip\etc.

    I then loaded MicroCode Studio Plus, (ver 2.2.1.1) and clicked view\Compile & Programme Options then made MPASM as the default compiler. MPASM was found automatically.

    I am running PBP ver 2.46 and have an incomplete, but running, program of 370 lines. The target processor is a PIC16F877 and I am using the MCSP Bootloader to program the chip. This compiles under PBP/PM to 2715 words with no errors. The first few lines of this program are attached.

    Under PBP/PM, the following configuration line is active.
    @ Device pic16F877, HS_OSC, BOD_OFF, PWRT_ON, WDT_ON, PROTECT_OFF

    To suit MPASM, I changed this to
    @ _config_HS_OSC &_BOD_OFF &_PWRT_ON &_WDT_ON &_PROTECT_OFF

    I get 1259 errors when I try to compile under MPASM, zero errors under PBP/PM.

    CHeers
    Brian

    Here is the start of the program. This snippet does compile under PBP/PM but not under MPASM.

    data @0, "DeckUnit v5.00 BDT 3 NOV 05 "
    data @30, 01, $E0, $15, 200, 50 ' ID, Fcntr.lo, Fcntr.hi, Fdev, bitrate
    data @35, 0, 5, 12, 48 ' MasterSlave, matches, syncbits, repeats
    data @39, 0, 60 ' TxPower, sleeptime

    '************************************************* ********
    '* Name : DeckUnit500.PBP *
    '* : *
    '************************************************* ********

    DEFINE OSC 20
    DEFINE loader_used 1
    DEFINE CHAR_PACING 1000
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 500

    @ Device pic16F877, HS_OSC, BOD_OFF, PWRT_ON, WDT_ON, PROTECT_OFF
    '@ _config_HS_OSC &_BOD_OFF &_PWRT_ON &_WDT_ON &_PROTECT_OFF

    trisa = %11111111
    trisb = %11111111
    trisc = %10011111
    trisd = %00000000
    trise = %00000000
    OPTION_REG = %10001111 ' no pullups, prescaler to WDT /128

    '***************** Hardware definition **********************
    DiagLED var porta.0 ' Olimex standard LED
    GoLED var portc.5 ' pin 24 on '877

    '******************* Software variables **********************
    A var byte
    B var byte

    '*************************** Initialise ********************************
    Startup:
    Initialise:
    OPTION_REG = %00001111 ' no pullups, prescaler to WDT /128
    INTCON = %00000000
    PIE1 = %00110000
    PIE2 = %00000000 ' guessing here
    ADCON1 = %00000111
    TRISE = %00000000
    CCP1CON = %00000000

    TestLED:
    for a = 0 to 9
    high goled
    high diagled
    pause 100
    low goled
    low diagled
    pause 100
    next a
    trisa = %11111111
    Last edited by btaylor; - 4th November 2005 at 00:02.

  4. #4
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default MPASM woes - Path length perhaps?

    My problems with MPASM appears to be a path, path length, or similar problem. Plus a remnant @ _config_ issue.

    I found a comment on the PICBasic List.

    (quote) When ever I use MPLAB I make sure there is a full copy of PBP in the Mplab directory and place my PBP program in the directory too. This prevents all
    the problem with paths etc. (endquote)

    I also found other comments that the total path length must be short so I shifted my code from 'my documents' up to an entry in c:\ and I copied all my PBP files to c:\program files\microchip\MPASM Suite.

    It nearly works now. I still get errors when I use the line
    @ _config_HS_OSC &_BOD_OFF &_PWRT_ON &_WDT_ON &_PROTECT_OFF

    If I comment that line out completely I get no errors, just warnings about page boundaries which I assume PBP has taken care of for me. I would rather have the explicit configuration line active.

    Nearly there maybe. What a drama.

    Cheers
    Brian
    Last edited by btaylor; - 4th November 2005 at 00:18.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Brian,

    In the CONFIG line for MPASM, there must be 2 underscores before the word CONFIG, and a space after it. And some of the options should be different
    Code:
    @ __CONFIG _HS_OSC &_BODEN_OFF &_PWRTE_ON &_WDT_ON &_CP_OFF
    And keep in mind that MPASM is CASE Sensitive (unless you use the command line option to disable case sensitivity).

    HTH,
       Darrel
    Last edited by Darrel Taylor; - 4th November 2005 at 00:36.

  6. #6
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default MPASM - still not quite there

    Thanks Darrel,

    I copied your line into my code. It tellls me I now have 2 errors but only one error gets shown with three messages on the bottom of the MCSP screen.

    Error [118].....Overwriting previous address contents (2007)
    Message [306] Crossing page boundary..ensure page bits are set.
    Message [306] Crossing page boundary..ensure page bits are set.
    Message [306] Crossing page boundary..ensure page bits are set.

    Do the page bits get set autometically?

    What does error 118 mean and how do I fix it?

    Brian

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    2007 is the address of the CONFIG word in the PIC. The "error [118] Overwriting previous address contents" means that it's already been set.

    In the 16F877.inc file in your PBP folder, comment out the __CONFIG line with a semicolon ";" Then try again.

    Just remember, that once commented, every time you write a program for a 16F877, you''l need to have a CONFIG line at the top of your program, since the defaults aren't there anymore.

    You may also want to add _LVP_OFF to the CONFIG in your program to turn off the Low Voltage Programming input.

    And <b>@ errorlevel -306</b> will turn off the Crossing page boundary warnings
    <br>
    Last edited by Darrel Taylor; - 4th November 2005 at 03:45.
    DT

Similar Threads

  1. Help setting up MPASM with MicroCode studio
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 23rd November 2008, 05:12
  2. 12F675 MCLR directive MPASM
    By OLDSCHOOL in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th May 2008, 01:29
  3. MPASM vs PM
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th October 2007, 01:29
  4. MPASM 18F4550 getting started
    By BrianT in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th September 2007, 23:59
  5. 18F8722 and MPASM confusion!
    By Jackson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd April 2006, 01:24

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