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.

MP Lab Program Help

Status
Not open for further replies.

bamafan54

New Member
Hello All.

I am trying to complete a project for my senior design course. Our project is involves creating the electronics for a glass front vendor coke machine. My portion of the project is to control the two dc motors and the solenoids to release the product I have most of my code written (using MP Lab and assembler language). I am also using a PIC16F877A as the uController and the MCP2515 as the can bus controller.

Upon compiling my code I came up with numerous errors. Could someone please take a look at it and advise where I have went wrong. If I have done things correctly all of my .asm files should be attached.
 

Attachments

  • Initialization.asm
    999 bytes · Views: 321
  • Can_Comm.asm
    528 bytes · Views: 252
  • Interrupt.asm
    6.8 KB · Views: 242
  • Main.asm
    773 bytes · Views: 311
  • Timer_Routines.asm
    1.7 KB · Views: 231
  • Variables.asm
    608 bytes · Views: 221
Hi,
Why you're not combining everything into a single file?
I see the first file has:
Code:
	MOVLW	0X1B98
	MOVWF	CONFIGURATION_WORD
which I don't think working, because w register is a 8-bit long register, no 16 bits.
The configuration setting is usually after the header file of the variables (p16F877a.inc) like this:
Code:
LIST	  P=16F877A
#INCLUDE <P16F877A.INC>
  __config   0x1b98
And you don't need the Variables.asm for those special function registers, only for your general purpose registers will do.

What did you get when you try to assemble the code?
 
bananasiong,

Here is the error I recieve. I have all of the below files in a single project as a .mcp file, but I could not upload a file with this extension.



Make: The target "F:\Senior Design II\Can_Comm.o" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F877A "Can_Comm.asm" /l"Can_Comm.lst" /e"Can_Comm.err" /o"Can_Comm.o"
Error[150] F:\SENIOR DESIGN II\CAN_COMM.ASM 6 : Labels must be defined in a code or data section when making an object file
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 7 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 8 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 9 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 10 : Executable code and data must be defined in an appropriate section
Error[150] F:\SENIOR DESIGN II\CAN_COMM.ASM 11 : Labels must be defined in a code or data section when making an object file
Message[302] F:\SENIOR DESIGN II\CAN_COMM.ASM 11 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 11 : Executable code and data must be defined in an appropriate section
Error[151] F:\SENIOR DESIGN II\CAN_COMM.ASM 12 : Operand contains unresolvable labels or is too complex
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 12 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 13 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 14 : Executable code and data must be defined in an appropriate section
Error[150] F:\SENIOR DESIGN II\CAN_COMM.ASM 17 : Labels must be defined in a code or data section when making an object file
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 18 : Executable code and data must be defined in an appropriate section
Error[150] F:\SENIOR DESIGN II\CAN_COMM.ASM 19 : Labels must be defined in a code or data section when making an object file
Message[302] F:\SENIOR DESIGN II\CAN_COMM.ASM 19 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 19 : Executable code and data must be defined in an appropriate section
Error[151] F:\SENIOR DESIGN II\CAN_COMM.ASM 20 : Operand contains unresolvable labels or is too complex
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 20 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 21 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 22 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 23 : Executable code and data must be defined in an appropriate section
Error[150] F:\SENIOR DESIGN II\CAN_COMM.ASM 25 : Labels must be defined in a code or data section when making an object file
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 26 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 27 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 28 : Executable code and data must be defined in an appropriate section
Error[150] F:\SENIOR DESIGN II\CAN_COMM.ASM 29 : Labels must be defined in a code or data section when making an object file
Message[302] F:\SENIOR DESIGN II\CAN_COMM.ASM 29 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 29 : Executable code and data must be defined in an appropriate section
Error[151] F:\SENIOR DESIGN II\CAN_COMM.ASM 30 : Operand contains unresolvable labels or is too complex
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 30 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 31 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 32 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 33 : Executable code and data must be defined in an appropriate section
Error[152] F:\SENIOR DESIGN II\CAN_COMM.ASM 34 : Executable code and data must be defined in an appropriate section
Error[129] F:\SENIOR DESIGN II\CAN_COMM.ASM 35 : Expected (END)
Halting build on first failure as requested.
BUILD FAILED: Thu Oct 18 21:09:16 2007


I have no idea what it is trying to say to me. I aplologize if I seem ignorant when it comes to this, but this is about the second time I have even attempted to write code.
 
Remember that in MPLAB if you double click on the error, it will take you right to the place in the source file that caused the error.
But I think the error comes from the fact that you've got
ORG 0X004
In Interrupt.asm Coming BEFORE
ORG 0X000
in Main.asm
This is because the #include<file.asm> directive works exactly the same as if you had pasted the code from file.asm where the #include directive is typed.
EDIT:
Also, since you are writing Absolute Code, take all the files out of the project file except for main.asm since you are using the #include directive to include them in main.asm. Otherwise MPLAB will try to compile these files on their own giving you errors because there are no ORG statements for it to decide where the code resides in each file.
 
Last edited:
Micro C code for running two stepper motors

how to run 2 stepper motors using 2 switches???
(Micro C code for running two stepper motors simultaneously and independently using PIC16F877.)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top