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

Thread Starter

riad_00

Joined Feb 9, 2008
19
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
;##############################

:(
 

sukumaar

Joined Feb 11, 2008
2
M i doing anything wrong?...I m using MPLAB version 8.00
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
 

Thread Starter

riad_00

Joined Feb 9, 2008
19
I'm sorry again, here is the o/p text msges
Rich (BB code):
Clean: Deleting intermediary and output files.
Clean: Done.
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"
Warning[205] E:\MPLAB\SAMPLE CODE\LED.ASM 2 : Found directive in column 1. (list)
Warning[205] E:\MPLAB\SAMPLE CODE\LED.ASM 4 : Found directive in column 1. (__CONFIG)
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 17 : Found opcode in column 1. (bsf)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 17 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 18 : Found opcode in column 1. (movlw)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 18 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 19 : Found opcode in column 1. (movwf)
Message[302] E:\MPLAB\SAMPLE CODE\LED.ASM 19 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 19 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 20 : Found opcode in column 1. (bcf)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 20 : Executable code and data must be defined in an appropriate section
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 24 : Executable code and data must be defined in an appropriate section
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 25 : Executable code and data must be defined in an appropriate section
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 29 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 33 : Found opcode in column 1. (movlw)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 33 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 34 : Found opcode in column 1. (movwf)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 34 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 38 : Found opcode in column 1. (call)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 38 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 42 : Found opcode in column 1. (goto)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 42 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 48 : Found opcode in column 1. (decfsz)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 48 : Executable code and data must be defined in an appropriate section
Error[113]   E:\MPLAB\SAMPLE CODE\LED.ASM 49 : Symbol not previously defined (Loop1)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 49 : Executable code and data must be defined in an appropriate section
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 50 : Executable code and data must be defined in an appropriate section
Error[113]   E:\MPLAB\SAMPLE CODE\LED.ASM 51 : Symbol not previously defined (Loop1)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 51 : Executable code and data must be defined in an appropriate section
Warning[203] E:\MPLAB\SAMPLE CODE\LED.ASM 52 : Found opcode in column 1. (return)
Error[152]   E:\MPLAB\SAMPLE CODE\LED.ASM 52 : Executable code and data must be defined in an appropriate section
Warning[205] E:\MPLAB\SAMPLE CODE\LED.ASM 56 : Found directive in column 1. (end)
Halting build on first failure as requested.
BUILD FAILED: Thu Feb 14 22:29:08 2008
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
 

n9352527

Joined Oct 14, 2005
1,198
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
 

Thread Starter

riad_00

Joined Feb 9, 2008
19
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'

Rich (BB code):
Clean: Deleting intermediary and output files.
Clean: Deleted file "E:\mplab\New Folder (3)\led_test.mcs".
Clean: Done.
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"
Warning[205] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 2 : Found directive in column 1. (list)
Warning[205] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 4 : Found directive in column 1. (__CONFIG)
Message[302] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 34 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 53 : Found opcode in column 1. (movlw)
Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 54 : Found opcode in column 1. (movwf)
Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 59 : Found opcode in column 1. (call)
Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 65 : Found opcode in column 1. (goto)
Warning[203] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 76 : Found opcode in column 1. (return)
Warning[205] E:\MPLAB\NEW FOLDER (3)\LED_TEST.ASM 83 : Found directive in column 1. (end)
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
MPLINK 4.14, Linker
Copyright (c) 2007 Microchip Technology Inc.
Errors    : 0

MP2HEX 4.14, COFF to HEX File Converter
Copyright (c) 2007 Microchip Technology Inc.
Errors    : 0

Loaded E:\mplab\New Folder (3)\led_test.cof.
BUILD SUCCEEDED: Sun Feb 17 21:54:27 2008
 

n9352527

Joined Oct 14, 2005
1,198
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:

Rich (BB code):
lbl_example
        btfss    my_flag, 0
        call     fn_explore
        ....
 

chenna85

Joined Jun 3, 2009
1
I'm sorry, I don't open any zip file. Just the output text message in full would be sufficient.
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
 
Top