Need help.........MPLAB project building

Discussion in 'Embedded Systems and Microcontrollers' started by riad_00, Feb 9, 2008.

  1. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    Hi....I m new in microcontroller..As a starter i m tring to compile a simple program to turn a led on and off......But everytime i try to build a project it fails...I m following the steps as follows...selecting the device then project wizard>select the device>select the language tool>create a new project>addexisting files (both the asm and linker file)>finish...And after that whenever i go to 'build all' step it fails to build the project....M i doing anything wrong?...I m using MPLAB version 8.00 and this is my program and i m using PIC 16F84.....Can someone help me out here please...thanx a lot

    STATUS equ 03h
    TRISA equ 85h
    PORTA equ 05h
    COUNT1 equ 08h
    COUNT2 equ 09h

    ;****Set up the port****

    bsf STATUS,5
    movlw 00h
    movwf TRISA
    bcf STATUS,5

    ;****Turn the LED on****

    Start movlw 02h
    movwf PORTA

    ;****Add a delay

    call Delay

    ;****Delay finished, now turn the LED off****

    movlw 00h
    movwf PORTA

    ;****Add another delay****

    call Delay

    ;****Now go back to the start of the program

    goto Start

    ;****Here is our Subroutine

    Delay

    decfsz COUNT1,1
    goto Loop1
    decfsz COUNT2,1
    goto Loop1
    return

    ;****End of the program****

    end
    ;##############################

    :(
     
  2. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Please post the output so we can see what and where the failure was.
     
  3. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    Thanx for repling..........please find the the output (attached copy)......I would really be appriciated for the help
     
  4. sukumaar

    New Member

    Feb 11, 2008
    2
    0
    1. Header file is missing in ur program...Or else u have to specify the library path in Project->build options....(MPLAB version 8.00)
    2. u didn't call the Start main routine.. u have to redirect the reset vector and interrupt vector.
    3. ur JPG file is not clear i cant able to see the error msg fully
     
  5. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Copy the text message and post it here. In full.
     
  6. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    here is zipped file of the codes and other files...........
     
  7. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    I'm sorry, I don't open any zip file. Just the output text message in full would be sufficient.
     
  8. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    I'm sorry again, here is the o/p text msges
    Code ( (Unknown Language)):
    1.  
    2. Clean: Deleting intermediary and output files.
    3. Clean: Done.
    4. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84 "E:\mplab\sample code\led.asm" /l"led.lst" /e"led.err" /o"led.o"
    5. Warning[205] E:\MPLAB\SAMPLE CODE\LED.ASM 2 : Found directive in column 1. (list)
    6. Warning[205] E:\MPLAB\SAMPLE CODE\LED.ASM 4 : Found directive in column 1. (__CONFIG)
    7. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 17 : Found opcode in column 1. (bsf)
    8. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 17 : Executable code and data must be defined in an appropriate section
    9. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 18 : Found opcode in column 1. (movlw)
    10. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 18 : Executable code and data must be defined in an appropriate section
    11. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 19 : Found opcode in column 1. (movwf)
    12. Message[302] E:\MPLAB\SAMPLE CODE\LED.ASM 19 : Register in operand not in bank 0.  Ensure that bank bits are correct.
    13. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 19 : Executable code and data must be defined in an appropriate section
    14. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 20 : Found opcode in column 1. (bcf)
    15. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 20 : Executable code and data must be defined in an appropriate section
    16. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 24 : Executable code and data must be defined in an appropriate section
    17. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 25 : Executable code and data must be defined in an appropriate section
    18. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 29 : Executable code and data must be defined in an appropriate section
    19. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 33 : Found opcode in column 1. (movlw)
    20. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 33 : Executable code and data must be defined in an appropriate section
    21. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 34 : Found opcode in column 1. (movwf)
    22. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 34 : Executable code and data must be defined in an appropriate section
    23. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 38 : Found opcode in column 1. (call)
    24. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 38 : Executable code and data must be defined in an appropriate section
    25. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 42 : Found opcode in column 1. (goto)
    26. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 42 : Executable code and data must be defined in an appropriate section
    27. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 48 : Found opcode in column 1. (decfsz)
    28. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 48 : Executable code and data must be defined in an appropriate section
    29. Error[113]   E:\MPLAB\SAMPLE CODE\LED.ASM 49 : Symbol not previously defined (Loop1)
    30. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 49 : Executable code and data must be defined in an appropriate section
    31. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 50 : Executable code and data must be defined in an appropriate section
    32. Error[113]   E:\MPLAB\SAMPLE CODE\LED.ASM 51 : Symbol not previously defined (Loop1)
    33. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 51 : Executable code and data must be defined in an appropriate section
    34. Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 52 : Found opcode in column 1. (return)
    35. Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 52 : Executable code and data must be defined in an appropriate section
    36. Warning[205] E:\MPLAB\SAMPLE CODE\LED.ASM 56 : Found directive in column 1. (end)
    37. Halting build on first failure as requested.
    38. BUILD FAILED: Thu Feb 14 22:29:08 2008
    39.  
    Can u tell me plz what i m doing wrong here....or step by step what i have to do to compile codes written in MPLAB.....

    Thanx a lot
     
  9. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    You need to define the code segment or the origin of the code, depending on your project type. Open the template folder in the MPLAB installation folder, there are two types of template files, one called object and the other is code.

    Follow the skeleton in the template file, especially the lines that contain CODE statements for object type, or the ORG statement for the code type. These lines tell the compiler where to put the codes you've written.

    For object type project, something like:

    RESET CODE 0x000
    goto main

    ISR CODE 0x004
    goto isr_handler

    MAIN CODE
    isr_handler
    .... ; interrupt code goes here

    main
    .... ; your code goes here

    For code type project, something like:

    ORG 0x000
    goto main

    ORG 0x004
    ... ; interrupt code goes here

    main
    ... ; your code goes here
     
  10. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    Thanx a lot again...I really appriciate the help......I can build the project now...here is the O/P ....just wandering...do i need wory abt the 'warnings'

    Code ( (Unknown Language)):
    1.  
    2. Clean: Deleting intermediary and output files.
    3. Clean: Deleted file "E:\mplab\New Folder (3)\led_test.mcs".
    4. Clean: Done.
    5. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84 "led_test.asm" /l"led_test.lst" /e"led_test.err" /o"led_test.o"
    6. Warning[205] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 2 : Found directive in column 1. (list)
    7. Warning[205] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 4 : Found directive in column 1. (__CONFIG)
    8. Message[302] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 34 : Register in operand not in bank 0.  Ensure that bank bits are correct.
    9. Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 53 : Found opcode in column 1. (movlw)
    10. Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 54 : Found opcode in column 1. (movwf)
    11. Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 59 : Found opcode in column 1. (call)
    12. Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 65 : Found opcode in column 1. (goto)
    13. Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 76 : Found opcode in column 1. (return)
    14. Warning[205] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 83 : Found directive in column 1. (end)
    15. Executing: "C:\Program Files\Microchip\MPASM Suite\MPLink.exe" "C:\Program Files\Microchip\MPASM Suite\LKR\16f84.lkr" "E:\mplab\New Folder (3)\led_test.o" /o"led_test.cof" /M"led_test.map" /W
    16. MPLINK 4.14, Linker
    17. Copyright (c) 2007 Microchip Technology Inc.
    18. Errors    : 0
    19.  
    20. MP2HEX 4.14, COFF to HEX File Converter
    21. Copyright (c) 2007 Microchip Technology Inc.
    22. Errors    : 0
    23.  
    24. Loaded E:\mplab\New Folder (3)\led_test.cof.
    25. BUILD SUCCEEDED: Sun Feb 17 21:54:27 2008
    26.  
    27.  
     
  11. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Nothing to worry about. The conventions are the labels are flushed to the left and the instructions are indented from the left margin by using spaces or tabs. These would create a cleaner layout which is easier to work with. That's what those warnings are.

    Like the example below:

    Code ( (Unknown Language)):
    1.  
    2. lbl_example
    3.         btfss    my_flag, 0
    4.         call     fn_explore
    5.         ....        
    6.  
     
  12. chenna85

    New Member

    Jun 3, 2009
    1
    0
    I have the fallowing error message
    Warning[203] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 30 : Found opcode in column 1. (call)
    Error[151] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 30 : Operand contains unresolvable labels or is too complex
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 30 : Executable code and data must be defined in an appropriate section
    Warning[203] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 34 : Found opcode in column 1. (goto)
    Error[151] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 34 : Operand contains unresolvable labels or is too complex
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 34 : Executable code and data must be defined in an appropriate section
    Error[150] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 38 : Labels must be defined in a code or data section when making an object file
    Warning[203] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 40 : Found opcode in column 1. (decfsz)
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 40 : Executable code and data must be defined in an appropriate section
    Error[113] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 41 : Symbol not previously defined (Loop1)
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 41 : Executable code and data must be defined in an appropriate section
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 42 : Executable code and data must be defined in an appropriate section
    Error[113] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 43 : Symbol not previously defined (Loop1)
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 43 : Executable code and data must be defined in an appropriate section
    Warning[203] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 44 : Found opcode in column 1. (return)
    Error[152] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 44 : Executable code and data must be defined in an appropriate section
    Warning[205] C:\USERS\CHENNA\APPDATA\LOCAL\TEMP\TEMP1_SAMPLE CODE.ZIP\SAMPLE CODE\LED.ASM 48 : Found directive in column 1. (end)
    Halting build on first failure as requested.
    ----------------------------------------------------------------------
    Release build of project `C:\Users\chenna\AppData\Local\Temp\Temp1_sample code.zip\sample code\led.mcp' failed.
    Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01
    Wed Jun 03 16:25:12 2009
    ----------------------------------------------------------------------
    BUILD FAILED

    Please help me I am new one for mplab
     
Loading...