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 while building.

Status
Not open for further replies.

Nick'

New Member
Code:
include "P16F628A.INC"
bsf STATUS,5  
movlw 00h    
movwf TRISA
bcf STATUS,5 
movlw b'00000101'
movwf PORTA

Code:
----------------------------------------------------------------------
Debug build of project `C:\Documents and Settings\user\My Documents\MPLAB\LED.mcp' started.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined.
Mon Sep 28 13:26:00 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628A "LedAsmProject.asm" /l"LedAsmProject.lst" /e"LedAsmProject.err" /o"LedAsmProject.o" /d__DEBUG=1
Warning[205] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 1 : Found directive in column 1. (include)
Warning[203] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 2 : Found opcode in column 1. (bsf)
Error[152]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 2 : Executable code and data must be defined in an appropriate section
Warning[203] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 3 : Found opcode in column 1. (movlw)
Error[152]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 3 : Executable code and data must be defined in an appropriate section
Warning[203] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 4 : Found opcode in column 1. (movwf)
Message[302] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 4 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 4 : Executable code and data must be defined in an appropriate section
Warning[203] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 5 : Found opcode in column 1. (bcf)
Error[152]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 5 : Executable code and data must be defined in an appropriate section
Warning[203] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 6 : Found opcode in column 1. (movlw)
Error[152]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 6 : Executable code and data must be defined in an appropriate section
Warning[203] C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 7 : Found opcode in column 1. (movwf)
Error[152]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 7 : Executable code and data must be defined in an appropriate section
Error[129]   C:\DOCUMENTS AND SETTINGS\USER\MY DOCUMENTS\MPLAB\LEDASMPROJECT.ASM 8 : Expected (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Documents and Settings\user\My Documents\MPLAB\LED.mcp' failed.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined.
Mon Sep 28 13:26:01 2009
----------------------------------------------------------------------
BUILD FAILED

I have created a simple project where 2 LEDs will be on. I have added the header file, "P16F628A.INC" into the header files folder in the LED.mcw. What is the problem here? It stated there that i did not define those.
 
You have selected relocatable or added a linker script. I suggest you start with absolute code. Start a new project and choose absolute when asked, then add the following,
Code:
		#include "p16f628A.inc" 

		__config _INTRC_OSC_NOCLKOUT & _PWRTE_ON & _BODEN_ON & _MCLRE_ON & _WDT_OFF & _CP_OFF 


		org	0x0000 

		bsf	STATUS,5  
		movlw	00h    
		movwf	TRISA
		bcf	STATUS,5 
		movlw	b'00000101'
		movwf	PORTA

stop		goto	stop

		end

Mike.
 
Last edited:
__config _INTRC_OSC_NOCLKOUT & _PWRTE_ON & _BODEN_ON & _MCLRE_ON & _WDT_OFF & _CP_OFF
it is so complicated.What are those for?

Cant i do something like import the modules eg. #include "p16f628A.inc" and continue with my codes as usual? As when the header file is imported, using the declared/defined keywords should be fine.
 
it is so complicated.What are those for?

Cant i do something like import the modules eg. #include "p16f628A.inc" and continue with my codes as usual? As when the header file is imported, using the declared/defined keywords should be fine.


Those are the fuses. You need to set them before burning the pic. In this case the pic will use the internal oscillator, and you need to connect master clear to vcc.

What I usually do is to define my settings once and then copy and paste it to each new project I do.
 
Code:
		#include "p16f628A.inc" 

		__config _INTRC_OSC_NOCLKOUT & _PWRTE_ON & _BODEN_ON & _MCLRE_ON & _WDT_OFF & _CP_OFF 


		org	0x0000
                      movlw	0x07              ; I think these should also be added
	           movwf	CMCON          

		bsf	STATUS,5  
		movlw	00h    
		movwf	TRISA
		bcf	STATUS,5 
		movlw	b'00000101'
		movwf	PORTA

stop		goto	stop

		end

My first Flashing LED never worked until I figured you need to add those 2 lines
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top