Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Error[113] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4.ASM 4 : Symbol not previously defi

Status
Not open for further replies.

jokilike

New Member
i get an error when i build this program am new to programming pl help


Error[113] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4.ASM 4 : Symbol not previously defined (D)



processor 16f84a
include <p16f84a.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON
movlw D '5'
clrw
nop
end
 
https://www.electro-tech-online.com/microcontrollers/127278-error-113-c-projects-pic-t

Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4.ASM 4 : Executable code and data must be defined in an appropriate section

this is the code:

processor 16f84a
include <p16f84a.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON
movlw .5
clrw
nop
end


i changed "movlw .5" to " movlw D'5' " and its still not working. pls help am new to programming.:confused:
 
Have you disabled case sensitivity? Project>Build Options>check box

John

Edit: Or use lower case b or d, as appropriate. I don't believe there should be a space after the b or d either. A space will also make it fail.
 
Last edited:
"not working' can mean a lot of things. What error code do you get? Can you post the exact code you used? What you printed above has both a case error and space error.

Also, you have three threads going on this subject that seem to be very similar. Maybe a moderator can merge them to prevent confusion as we work to solve the problem(s).

John
 
Last edited:
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4.mcp' started.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 03:26:53 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "lesson4.asm" /l"lesson4.lst" /e"lesson4.err" /o"lesson4.o" /d__DEBUG=1 /c- /rDEC
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4.ASM 4 : Executable code and data must be defined in an appropriate section
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4.ASM 5 : Executable code and data must be defined in an appropriate section
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4.ASM 6 : Executable code and data must be defined in an appropriate section
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4.mcp' failed.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 03:26:56 2012
----------------------------------------------------------------------
BUILD FAILED
 
You should also go to the Project Wizard and use the appropriate Microchip template for your code. You aren't telling the program where to start. That's probably the cause of the error 152 you are getting.

John
 
Last edited:
The template should look something like this:

Code:
;**********************************************************************


	list      p=16F84A            ; list directive to define processor
	#include <p16F84A.inc>        ; processor specific variable definitions

	__CONFIG   _CP_OFF & _WDT_ON & _PWRTE_ON & _RC_OSC

; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.




;***** VARIABLE DEFINITIONS
;w_temp        EQU     0x0C        ; variable used for context saving 
;status_temp   EQU     0x0D        ; variable used for context saving








;**********************************************************************
		ORG     0x000             ; processor reset vector
  		goto    main              ; go to beginning of program

main

; remaining code goes here

		END                     ; directive 'end of program'
 
processor 16f84a
include <p16f84a.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON
movlw D'5'
clrw
nop
end



i did all u said but still have errors


----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4a.mcp' started.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 04:06:48 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "lesson4a.asm" /l"lesson4a.lst" /e"lesson4a.err" /o"lesson4a.o" /d__DEBUG=1 /c-
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 1 : Found directive in column 1. (PROCESSOR)
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 2 : Found directive in column 1. (INCLUDE)
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 3 : Found directive in column 1. (__CONFIG)
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 4 : Found opcode in column 1. (MOVLW)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 4 : Executable code and data must be defined in an appropriate section
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 5 : Found opcode in column 1. (CLRW)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 5 : Executable code and data must be defined in an appropriate section
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 6 : Found opcode in column 1. (NOP)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 6 : Executable code and data must be defined in an appropriate section
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 7 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4a.mcp' failed.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 04:06:51 2012
----------------------------------------------------------------------
BUILD FAILED




but when delete movlw D'5', clrw and nop the program builds succesfully.
 
processor 16f84a
include <p16f84a.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON
movlw D'5'
clrw
nop
end



i did all u said but still have errors


----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4a.mcp' started.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 04:06:48 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "lesson4a.asm" /l"lesson4a.lst" /e"lesson4a.err" /o"lesson4a.o" /d__DEBUG=1 /c-
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 1 : Found directive in column 1. (PROCESSOR)
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 2 : Found directive in column 1. (INCLUDE)
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 3 : Found directive in column 1. (__CONFIG)
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 4 : Found opcode in column 1. (MOVLW)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 4 : Executable code and data must be defined in an appropriate section
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 5 : Found opcode in column 1. (CLRW)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 5 : Executable code and data must be defined in an appropriate section
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 6 : Found opcode in column 1. (NOP)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 6 : Executable code and data must be defined in an appropriate section
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 7 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4a.mcp' failed.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 04:06:51 2012
----------------------------------------------------------------------
BUILD FAILED




but when i delete ( movlw D'5', clrw and nop ) the program builds succesfully.
 
Last edited:
LIST P=16F84A
include <p16f84a.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON
movlw D'5'
clrw
nop
end



----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4a.mcp' started.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 04:24:21 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "lesson4a.asm" /l"lesson4a.lst" /e"lesson4a.err" /o"lesson4a.o" /d__DEBUG=1 /c-
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 1 : Found directive in column 1. (LIST)
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 2 : Found directive in column 1. (INCLUDE)
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 3 : Found directive in column 1. (__CONFIG)
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 4 : Found opcode in column 1. (MOVLW)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 4 : Executable code and data must be defined in an appropriate section
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 5 : Found opcode in column 1. (CLRW)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 5 : Executable code and data must be defined in an appropriate section
Warning[203] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 6 : Found opcode in column 1. (NOP)
Error[152] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 6 : Executable code and data must be defined in an appropriate section
Warning[205] C:\PROJECTS\PIC\TEST\LESSON4A\LESSON4A.ASM 7 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Projects\PIC\Test\Lesson4a\Lesson4a.mcp' failed.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Preprocessor symbol `__DEBUG' is defined.
Tue May 08 04:24:25 2012
----------------------------------------------------------------------
BUILD FAILED
 
build succeeded

but i dont get it why is the one am learning from the pdf wrong, and the one from the template correct how would i understand if the pdf teaching me how to program a pic is wrong. any recommendation pls seriously i want to learn how to program the pic because i would be asked questions on my project defense. any recommened reading material pls :confused:
 
I have assembled this in MPLABIDE and MPASMWIN... Both assembled fine.#

Use "project / quickbuild" tell me what happens... also tab every line into column 2


Good.... its working then..... To learn assembler use Nigel's tutorials in my sigature.... (its for a 16f628a but the only difference is the comparator)
 
Last edited:
If you have not downloaded the User's Guide, you can find it here: https://www.electro-tech-online.com/custompdfs/2012/05/MPLAB_User_Guide_51519c.pdf

Part 2, Chapters 4 & 5 have tutorials. Chapter 4 is a good place to start.

I am sure experienced programmers (Ian Rogers being one) can simply sit down and write a working program on a blank screen. I am not one of those people and always begin with the Project Wizard and a Microchip template. Albeit, for some chips, you have to get a template that is close to what you need and modify it.

Starting with that template, delete what you don't need. Then add your program.

As a relative beginner, I can say that keeping the terms straight in one's mind can be difficult. Here is a source that I found useful; although, it is for a more advanced chip than the 16F84A: https://www.electro-tech-online.com/custompdfs/2012/05/1401839673_ch02.pdf

John
 
I think that you need a

org 0x00

after the config statement.

That tells the compiler that the code that follows is to start at the bottom of the program memory.

You can use other start positions, and you might want to if using interrupts.
 
Status
Not open for further replies.

Latest threads

Back
Top