Error when compiling- New user lots of questions


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Sep 2007
    Posts
    59

    Default Error when compiling- New user lots of questions

    Okay, so let me start by saying that I'm not a programer, I don't even play one on tv. But I'm trying to learn and here's what I've got and am trying to do. I recently purchased PicBasic Pro, MicroCode Studio Plus and I have a Microengineering Labs programmer. I've used the programmer and have programmed my chip successfully in the past using a hex file that was provided to me. I'm using the PIC 18F6520.

    I have the source code which supposedly created the hex file. I would like to play with this code and use it as a starting point for learning. So before I start to play with it, I want to successfully compile and program the source code so I have a reference point.

    I cannot guarantee that I have everything set up correctly but I think so. I did read the book that came with the Pic Basic Pro Compiler but still don't have enough information to even be considered dangerous.

    When I compile the code I get 6 error messages or actually it looks like 3 pairs of errors.
    The results says:
    Error[118] c:\progra~1\mecani~1\.....asm694: Overwriting previous address contents (0000)
    The next line states:
    Error[118] c:\progra~1\mecani~1\.....asm694: Overwriting previous address contents (0001)

    That line of code is:
    EndIf ' End If for Host or LineHead Mode


    The rest of the errors are about the same. This doesn't look like anything goofy here. So any help on what I need to be checking would be usefull.

    Thank you for your assistance with the ignorant new guy!

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


    Did you find this post helpful? Yes | No

    Default

    Hello Hylan,
    When you compile, the compiler creates a bunch of files with your file name, and different extensions. In the file with the suffix .asm you will find the instruction which is causing the error, so asm694 means the error is at line 694, since you did not post the code it is difficult to know by checking it myself, and as I do not have enough experience in assembler to answer. It will do you good to open each of those files to see what they contain. One very common error is the config fuses you set in your code conflict or try to overwrite the ones in the pic18Fxxxx (name your chip) .inc file, located in your PBP root directory. To fix that simply add an ( semicolon to the beginning of the line that says
    __config XX_OSC, & _SOMETHING & MORE_SOMETHING, save it and close it up, or leave it open until you finish compiling, afterwhich you can put it back if you desire.
    JS
    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
    Sep 2007
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Error

    I will look at the files. I thought that the number refered to a line number, but I was looking at that line number in the original code and not the .asm file. I'll look at that closer and see if it makes more sense.

    I also have an original .asm file which is much longer than the one that was created when I tried to compile. So I am concerned that I'm not creating the same thing. Although once I can get an actual .hex file I can load and test it.

    Thank you for the help.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    i ran into similar errors when i tried to compile my first blinky program with msasm. switched to pmasm and the errors went away. i did have to change the config line for pmasm. oh and i got weird errors when i forgot to set the chip type in micro studio, it defaulted to the 16f84. not that any of that will help.

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


    Did you find this post helpful? Yes | No

    Default

    Which assembler are you using? The question is easy, if you did not change to MPASM then the answer is PM. Those messages looked to me like MPASM errors and I treated them as such. To change assemblers, at the top of Microcode studio, click view, move down the list to Compile and Program Options and click. A window will open with 3 tabs at the top, click on assembler, there is a box marked Use Mpasm. It must be checked if you want to use mpasm, if not checked you will be using PM. Right now it is only important to know which assembler you are using, because they use different config statements, and those statements will give you a long list of errors if mixed. Check the link posted to see the differences.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    You know ,I am not sure, but I think you have to use MPASM to program 18fxxx chips. . .
    JS
    Last edited by Archangel; - 2nd October 2007 at 06:47.
    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.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Joe, you're correct. 18Xxxxx need MPASM or i will never compile anyway.

    Let's open any 18Xxxx.INC in PBP folder..
    Code:
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F452, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F452.INC"   ; MPASM  Header
            ;__CONFIG    _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
            ;__CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            ;__CONFIG    _CONFIG4L, _LVP_OFF_4L
            NOLIST
        endif
    If you don't select MPASM, it will show you that message.

    At very least, this is one reason why i don't use PM, always MPASM. Kinda annoying stuff to switch everytime between one and the other.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Sep 2007
    Posts
    59


    Did you find this post helpful? Yes | No

    Default

    Hmmm,
    I'm going to have to look and see if I can figure out which compiler was originally used. I know that I did have the MPASM checked and I did change the chip.

    I haven't had a chance to go through all the posts and suggestions yet. Hopefully today.

  8. #8
    Join Date
    Sep 2007
    Posts
    59


    Did you find this post helpful? Yes | No

    Default

    So, as best I can tell. I have everything set up right, not that that means much. However, I still get the errors.

    I've attached the code, pbc file-zipped.

    Any help is appreciated.

    Thank you,
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Can you post your 18F6520.inc file here?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    Sep 2007
    Posts
    59


    Did you find this post helpful? Yes | No

    Default

    I can post that. However, what's the best way to make sure I find and post the right file?

    I ask because I have PicBasic, PicBasicPro and the free IDE from Microchip on my computer. So I got to thinking that there might be more than one version on my computer. Is there a way to tell where PicBasicPro is looking?

    Thank you

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    OK, the file i'm talking about is located in the PBP folder. Just to make sure it's the right one, you could still rename it and try to compile... if this return an error, you got it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Sep 2007
    Posts
    59


    Did you find this post helpful? Yes | No

    Default

    Alright, so needless to say with the different free IDE's I'd downloaded before I finally coughed up for the paid versions, I had several duplicate files on my computer. I found the one the computer was using and it is now attached. I looked at the file and saw the areas that it looks like the code is noting to change but wasn't sure how to change.

    Okay, so I tried to make changes and deleted some lines and played around with others and then just got more errors. But I viewed that as a positive thing as I was able to at least evoke a change to the system. Going in the wrong direction, but sometimes any movement is good!

    I appreciate everyone's patience and input.
    Attached Files Attached Files

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Miip, that's the one MPLAB/MPASM use, the one you need to find and modify is located in your PBP folder and should, once modified, looks like the following

    Code:
    ;****************************************************************
    ;*  18F6520.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2007 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 07/09/07                                        *
    ;*  Version   : 2.50                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F6520, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F6520.INC"	; MPASM  Header
            ;__CONFIG    _CONFIG1H, _OSC_XT_1H
            ;__CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            ;__CONFIG    _CONFIG4L, _LVP_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	8
    If you're using MicrocCode studio, click on View>Compile and Program Option In Compiler tab it should write the compiler path just over the Find automatically button. In my case C:\pbp

    This should cure the problem.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Join Date
    Sep 2007
    Posts
    59


    Did you find this post helpful? Yes | No

    Smile

    Huh, it worked, sweet!

    I copied the notes from the top of the code into the file and it compiled without problem.

    I haven't programmed the chip yet to confirm everything in real life, but this is very cool!

    So for future learnings, what is the file that we modified? Is this a normal thing to have to change these settings and what are these settings?

    Is there a good beginners book, text or source (other than bugging the forum) that would help me in learning?

    Thank you, I'll let you know once I test it on the chip.

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The best thread i would suggest is the following

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

    Yeah it's an huge one, but everything is covered in. I would suggest Melabs to add a specific statement which could allow to set the configuration fuse in the code, without having to comment them in their .INC file every time we choose a new PIC model. That could be sweet. But yes, this would probably imply they change all .INC file. On the other side... once they're commented... there's no more problem. No default config fuse is still an option.

    Probably there's still a pre-compilation access we could have.... who knows. I have a few ideas and i plan to do something around that one day.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. LOTS of questions....
    By reaper0995 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd March 2008, 17:00

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