Searching \ for '[PIC]: Very New User Problem' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Very New User Problem'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Very New User Problem'
2006\11\13@145132 by Dr. Ed Edmondson, PhD

picon face
I am attempting to use the "PIC Elmer 160 Course" as referenced on the new user FAQ. My problem is every time I try to build the code I get an Error 152 on lines 5 thru 9. Error 152 tells me: "Executable code and data must be defined in an appropriate section"  
 
 I looked the error up in Chapter 8 of the Assembler,Linker/Librarian User Guide and it tells me that "When generating an object file, all executable code and data declarations must be placed within appopriate sections". I am using MPLAB 7.43 (what I downloaded from the Microchip web site) an installed it on my computer which runs Windows XP. I am using the Microchip 16F84.lnk .
 
 The code is as follows:
 
 1.   Processor 16F84
 2.   include <p16f84.inc>
 3.   __config _HS_OSC & _WDT_OFF & _PWRTE_ON
 4.  spot1   equ   H'30'
 5.  movlw   D'5'
 6.  movwf   spot1
 7.  clrw
 8.  clrf   spot1
 9.  nop
 10. end
 
 Please tell me what I am missing? I have been working on this problem for several days now.
 
 Thanks, Ed


---------------------------------
Want to start your own business? Learn how on Yahoo! Small Business.

2006\11\13@152312 by Jan-Erik Söderholm

face picon face
Hi !

First, please use your ENTER key now and then to enter line-breakes
at suitable intervalls to get a nice and readable text.

Now,
Since you're adding a LNK file, MPLAB/MPASM expects a source file
written using "relocatable code". You're code isn't.
First try to simply remove the LNK file from your project.
Or add the CODE and other stuff to your source to make
it a true reloctable source file.

Regards,
Jan-Erik.

PS.
Are you aure that you're not usinf the 16F84A processor ?



Dr. Ed Edmondson, PhD wrote :
{Quote hidden}

2006\11\13@155056 by Jorge Valerio

picon face
>  1.   Processor 16F84
>  2.   include <p16f84.inc>
>  3.   __config _HS_OSC & _WDT_OFF & _PWRTE_ON
>  4.  spot1   equ   H'30'
org    0000H    ;you always have to indicate where is the origin of your
code in the program memory
>  5.  movlw   D'5'
>  6.  movwf   spot1
>  7.  clrw
>  8.  clrf   spot1
>  9.  nop
>  10. end

good luck!!

Jorge.

{Original Message removed}

2006\11\13@155711 by Steve Smith

flavicon
face
Ed:
Try the following from line 4
Spot_1                EQU                030H        ; some register
       movlw                        .5                        ; decimal value
declared by"."
       movwf                        spot_1                ; put value in reg
       clrw                                                ; clear w
       clrf                        spot_1                ; and the register
       nop                                                ; then wait for a
bit
end        

Mplab expects to see directives in different columns to code. The "." is a
good (but not the only) way of defining a dec number and a hex definition
usually has a leading zero and a "h or H"at the end

Regards Steve

{Original Message removed}

2006\11\13@160246 by Steve Smith

flavicon
face
Jan-Erik

Linker ??? its an include header file not a linker file

Steve

-----Original Message-----
From: spam_OUTpiclist-bouncesTakeThisOuTspammit.edu [.....piclist-bouncesKILLspamspam@spam@mit.edu] On Behalf Of
Jan-Erik Söderholm
Sent: 13 November 2006 20:22
To: Microcontroller discussion list - Public.
Subject: Re: [PIC]: Very New User Problem

Hi !

First, please use your ENTER key now and then to enter line-breakes
at suitable intervalls to get a nice and readable text.

Now,
Since you're adding a LNK file, MPLAB/MPASM expects a source file
written using "relocatable code". You're code isn't.
First try to simply remove the LNK file from your project.
Or add the CODE and other stuff to your source to make
it a true reloctable source file.

Regards,
Jan-Erik.

PS.
Are you aure that you're not usinf the 16F84A processor ?



Dr. Ed Edmondson, PhD wrote :
> I am attempting to use the "PIC Elmer 160 Course" as referenced on the new
user FAQ. My problem is every time I try to build the code I get an Error
152 on lines 5 thru 9. Error 152 tells me: "Executable code and data must be
defined in an appropriate section"  
>    
>   I looked the error up in Chapter 8 of the Assembler,Linker/Librarian
User Guide and it tells me that "When generating an object file, all
executable code and data declarations must be placed within appopriate
sections". I am using MPLAB 7.43 (what I downloaded from the Microchip web
site) an installed it on my computer which runs Windows XP. I am using the
Microchip 16F84.lnk .
{Quote hidden}

for several days now.
>    
>   Thanks, Ed
>
>  
> ---------------------------------
> Want to start your own business? Learn how on Yahoo! Small Business.

2006\11\13@165530 by Jan-Erik Söderholm

face picon face
"16F84.lnk" is an "linker script"
What file are you talking about ??

Jan-Erik.

Steve Smith skrev:
> Jan-Erik
>
> Linker ??? its an include header file not a linker file
>
> Steve
>
> {Original Message removed}

2006\11\13@170442 by Jan-Erik Söderholm

face picon face
How sure are you about that ?
ORG is not used with relocatable mode.
Jan-Erik.


Jorge Valerio skrev:
{Quote hidden}

> {Original Message removed}

2006\11\13@170921 by Shawn Wilton

picon face
On 11/13/06, Jan-Erik Söderholm <jan-erik.soderholmspamKILLspamtelia.com> wrote:
>
> Hi !
>
> First, please use your ENTER key now and then to enter line-breakes
> at suitable intervalls to get a nice and readable text.
>

His post was readable to me.  If your mail client does not break lines at 80
characters, choose a new mail client.  There are many to choose from.

--

Shawn

2006\11\17@113531 by Dr. Ed Edmondson, PhD

picon face
 I just wanted to thank every one for their assistance with this problem.
 
 I was able to build the lesson code with no further problems.
 
 I have gone to lesson 5b and it had the same problem as 5a and wouldn't compile completely. So I went back and entered the org statement that fixed lesson 5a and another problem popped up.
 
 I get the following error when I try and build this lesson:
 
 MPLINK 4.05 LINKER
 Copyright (c) 2006 Microchip Technology Inc.
 ERROR-Section 'org_0' cannot fit the absolute section
 Section 'org_0' start 0x00000004. Length 0x00000012
 Errors: 1
 
 The code is:
 
 processor 16f84
 include <p16f84.inc>
 __config _HS_OSC & _WDT_OFF & _PWRTE_ON
 cblock H'20'
 spot1
 spot2
 endc
 org 0x0000
 bcf Status,Z
 bcf Status, C
 bcf Status,DC
 clrf spot1
 movlw D'15'
 movwf spot2
 movlw D'03'
 addwf spot2,F
 nop
 end
 
 I have the above code formatted correctly in the IDE. I just typed it in this way so it wouldn't run all over the page.
 
 Can some one please tell me what the error is and why the org statement would not fix the problem like it did in lesson 5a.
 
 I started this tutorial earlier this year and don't recall having any of these problems? I just restarted this tutorial as a refresher and all these problems popped up. The only difference is I am using a newer version of MPLAB v7.43.
 
 Thanks,
 Ed
 
 



---------------------------------
Sponsored Link

$420,000 Mortgage for $1,399/month -   Think You Pay Too Much For Your Mortgage? Find Out!

2006\11\17@120056 by Tamas Rudnai

face picon face
On this mail every line in your code looks like it was placed in the very
beginning of the line. I guess it is just because of the mailing program,
but in your original text file only the labels and comments started at there
and all others indented with at least 1 space or tab?

Tamas




On 11/17/06, Dr. Ed Edmondson, PhD <.....dredwinphdKILLspamspam.....yahoo.com> wrote:
{Quote hidden}

> -

2006\11\17@134635 by Jan-Erik Söderholm

face picon face
If you are *still* using a "linker script" (LKR file),
you should also have source code in relocatable mode
format. That's is, no CBLOCK and no CODE. Use the RES
and CODE directives. Or simple remove the LKR file
from the project.

I do not understand why you are trapped into this again...

Jan-Erik.

Dr. Ed Edmondson, PhD skrev:
{Quote hidden}

2006\11\17@165621 by Jan-Erik Söderholm

face picon face
Sorry, the text below should have read :

"...no CBLOCK or *ORG*. Use the RES and CODE..."

Jan-Erik.



Jan-Erik Söderholm wrote :
{Quote hidden}

2006\11\17@182955 by Dave Wheeler

flavicon
face
Jan-Eric,

We all started somewhere...

This guy has said he is a newbie, and I wish him the luck in the world.

Ed, Something you may not have realised is that there are 2 very
different ways of using MPLAB. Absolute and relocatable.

With absolute, you specify how things are done and due to this you have
to ensure that thing are done correctly, the examples you are using may
not have too many issues but there are pages and banks that need to be
considered.
With relocatable, the linker does most of the work but you still have to
take certain precautionary measures.

If you copy and paste lesson 5a into MPLAB and set up the environment
for absolute, it should compile, by the time you get to lesson 16, the
examples change to relocatable.

Most of my 'old' projects were written using absolute mode and do
exactly what they were designed to do.

As Jan-Eric has stated, when using relocatable code, you do not specify
addresses, you reserve variables and workspace and the linker does most
of the rest for you. When using absolute mode, you specify the
addresses. Also, when you make an error and are advised why, making the
same error and asking for the same help can wind engineers up :-)

Cheers,

Dave (G0GMK)

Jan-Erik Söderholm wrote:
{Quote hidden}

>

2006\11\17@190218 by Jan-Erik Söderholm

face picon face
He, well I din't ment to "point" at Ed in any way.
It was rather a lose thought about getting in this
absolute/reloc mess when using examples from the site.
They should probably work as-is.

My guess is that the examples are OK, but Ed hasn't
setup MPLAB correctly. *Probably* all examples works
just fine if one simple remove the LKR file from the
project...

Jan-Erik.



Dave Wheeler skrev:
{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...